Class ServerUtil

java.lang.Object
io.jans.as.server.util.ServerUtil

public class ServerUtil extends Object
Version:
0.9, 26/12/2012
Author:
Yuriy Zabrovarnyy, Yuriy Movchan
  • Method Details

    • sanitizeUsernameForLog

      public static String sanitizeUsernameForLog(String username)
      Sanitized username before output by logger
      Parameters:
      username - username
      Returns:
      sanitized username
    • prepareForLogs

      public static Map<String,String[]> prepareForLogs(Map<String,String[]> parameters)
    • now

      public static GregorianCalendar now()
    • nowAsSeconds

      public static int nowAsSeconds()
    • calculateTtl

      public static int calculateTtl(Integer expirationDateAsSeconds)
    • calculateTtl

      public static int calculateTtl(Date creationDate, Date expirationDate)
    • asJsonSilently

      public static String asJsonSilently(Object obj)
    • daemonThreadFactory

      public static ThreadFactory daemonThreadFactory()
    • asPrettyJson

      public static String asPrettyJson(Object obj) throws IOException
      Throws:
      IOException
    • asJson

      public static String asJson(Object obj) throws IOException
      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

      public static io.jans.orm.model.base.CustomAttribute getAttributeByName(List<io.jans.orm.model.base.CustomAttribute> list, String attributeName)
    • getAttributeValueByName

      public static String getAttributeValueByName(List<io.jans.orm.model.base.CustomAttribute> list, String attributeName)
    • urlDecode

      public static String urlDecode(String str)
    • createExecutor

      public static ScheduledExecutorService createExecutor()
    • convert

      public static io.jans.as.model.uma.UmaPermission convert(io.jans.as.model.uma.persistence.UmaPermission permission, UmaScopeService umaScopeService)
    • getFirstValue

      public static String getFirstValue(Map<String,String[]> map, String key)
    • getIpAddress

      public static String getIpAddress(jakarta.servlet.http.HttpServletRequest httpRequest)
      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

      public static boolean isSameRequestPath(String url1, String url2) throws MalformedURLException
      Throws:
      MalformedURLException
    • dateToSeconds

      public static Integer dateToSeconds(Date date)