Package io.jans.as.server.util
Class ServerUtil
java.lang.Object
io.jans.as.server.util.ServerUtil
- Version:
- 0.9, 26/12/2012
- Author:
- Yuriy Zabrovarnyy, Yuriy Movchan
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
static String
asJsonSilently
(Object obj) static String
asPrettyJson
(Object obj) static jakarta.ws.rs.core.CacheControl
cacheControl
(boolean noStore) static jakarta.ws.rs.core.CacheControl
cacheControl
(boolean noStore, boolean noTransform) static jakarta.ws.rs.core.CacheControl
static int
calculateTtl
(Integer expirationDateAsSeconds) static int
calculateTtl
(Date creationDate, Date expirationDate) static io.jans.as.model.uma.UmaPermission
convert
(io.jans.as.model.uma.persistence.UmaPermission permission, UmaScopeService umaScopeService) static ScheduledExecutorService
static com.fasterxml.jackson.databind.ObjectMapper
static ThreadFactory
static Integer
dateToSeconds
(Date date) static io.jans.orm.model.base.CustomAttribute
getAttributeByName
(List<io.jans.orm.model.base.CustomAttribute> list, String attributeName) static String
getAttributeValueByName
(List<io.jans.orm.model.base.CustomAttribute> list, String attributeName) static String
getFirstValue
(Map<String, String[]> map, String key) static String
getIpAddress
(jakarta.servlet.http.HttpServletRequest httpRequest) static io.jans.orm.PersistenceEntryManager
static jakarta.servlet.http.HttpServletRequest
Safe retrieves http request from FacesContextstatic boolean
isSameRequestPath
(String url1, String url2) static com.fasterxml.jackson.databind.ObjectMapper
static com.fasterxml.jackson.databind.ObjectMapper
static GregorianCalendar
now()
static int
prepareForLogs
(Map<String, String[]> parameters) static String
sanitizeUsernameForLog
(String username) Sanitized username before output by loggerstatic String
toPrettyJson
(org.json.JSONObject jsonObject) static String
-
Method Details
-
sanitizeUsernameForLog
Sanitized username before output by logger- Parameters:
username
- username- Returns:
- sanitized username
-
prepareForLogs
-
now
-
nowAsSeconds
public static int nowAsSeconds() -
calculateTtl
-
calculateTtl
-
asJsonSilently
-
daemonThreadFactory
-
asPrettyJson
- Throws:
IOException
-
asJson
- Throws:
IOException
-
cacheControl
public static jakarta.ws.rs.core.CacheControl cacheControl(boolean noStore) -
cacheControl
public static jakarta.ws.rs.core.CacheControl cacheControl(boolean noStore, boolean noTransform) -
cacheControlWithNoStoreTransformAndPrivate
public static jakarta.ws.rs.core.CacheControl cacheControlWithNoStoreTransformAndPrivate() -
createJsonMapper
public static com.fasterxml.jackson.databind.ObjectMapper createJsonMapper() -
jsonMapperWithWrapRoot
public static com.fasterxml.jackson.databind.ObjectMapper jsonMapperWithWrapRoot() -
jsonMapperWithUnwrapRoot
public static com.fasterxml.jackson.databind.ObjectMapper jsonMapperWithUnwrapRoot() -
toPrettyJson
public static String toPrettyJson(org.json.JSONObject jsonObject) throws com.fasterxml.jackson.core.JsonProcessingException - Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
getLdapManager
public static io.jans.orm.PersistenceEntryManager getLdapManager() -
getAttributeByName
-
getAttributeValueByName
-
urlDecode
-
createExecutor
-
convert
public static io.jans.as.model.uma.UmaPermission convert(io.jans.as.model.uma.persistence.UmaPermission permission, UmaScopeService umaScopeService) -
getFirstValue
-
getIpAddress
- Parameters:
httpRequest
- interface to provide request information for HTTP servlets.- Returns:
- IP address of client
- See Also:
-
getRequestOrNull
public static jakarta.servlet.http.HttpServletRequest getRequestOrNull()Safe retrieves http request from FacesContext- Returns:
- http
-
isSameRequestPath
- Throws:
MalformedURLException
-
dateToSeconds
-