Class DefaultUserContext

java.lang.Object
com.atlassian.administration.quicksearch.impl.spi.DefaultUserContext
All Implemented Interfaces:
RenderingContext, UserContext

public class DefaultUserContext extends Object implements UserContext
Default implementation of UserContext.
Since:
1.0
  • Constructor Details

    • DefaultUserContext

      public DefaultUserContext(String username, Locale locale, com.atlassian.sal.api.message.I18nResolver resolver, jakarta.servlet.http.HttpServletRequest request, Map<String,Object> context)
    • DefaultUserContext

      public DefaultUserContext(String username, Locale locale, com.atlassian.sal.api.message.I18nResolver resolver, jakarta.servlet.http.HttpServletRequest request)
  • Method Details

    • unauthenticated

      public static UserContext unauthenticated(jakarta.servlet.http.HttpServletRequest request)
    • getUsername

      public String getUsername()
      Description copied from interface: UserContext
      Name of the current user. If there is no authenticated user associated with the executing request, return null.
      Specified by:
      getUsername in interface UserContext
      Returns:
      current user, or null if no user authenticated
    • isAuthenticated

      public boolean isAuthenticated()
      Description copied from interface: UserContext
      Check whether there is an authenticated user.
      Specified by:
      isAuthenticated in interface UserContext
      Returns:
      true, if there is an authenticated user associated with the current request.
    • getLocale

      @Nonnull public Locale getLocale()
      Description copied from interface: UserContext
      Get locale associated with the current user. Default locale if UserContext.isAuthenticated() returns false.
      Specified by:
      getLocale in interface UserContext
      Returns:
      get user locale
    • getI18nResolver

      @Nonnull public com.atlassian.sal.api.message.I18nResolver getI18nResolver()
      Description copied from interface: UserContext
      Get I18n resolver associated with the current user. Default language resolver if no user associated with this context (UserContext.isAuthenticated() returns false).
      Specified by:
      getI18nResolver in interface UserContext
      Returns:
      i18n resolver
    • getRequest

      @Nonnull public jakarta.servlet.http.HttpServletRequest getRequest()
      Description copied from interface: RenderingContext
      Get current executing request.
      Specified by:
      getRequest in interface RenderingContext
      Returns:
      HTTP request
    • getContextMap

      @Nonnull public Map<String,Object> getContextMap()
      Description copied from interface: RenderingContext
      Get the rendering context map.
      Specified by:
      getContextMap in interface RenderingContext
      Returns:
      context map