Class ContextHelper


  • public class ContextHelper
    extends Object
    Helper class to get around the fact that some CREST Contexts are final and have package private constructors, i.e. UriRouterContext.
    Since:
    13.0.0
    • Constructor Detail

      • ContextHelper

        public ContextHelper()
    • Method Detail

      • getUserUid

        public String getUserUid​(org.forgerock.services.context.Context context)
        Gets the universal id for the user of the accessed resource.
        Parameters:
        context - The context.
        Returns:
        The resource users UID.
      • getUserUid

        public String getUserUid​(org.forgerock.services.context.Context context,
                                 String username)
        Gets the universal id for the given username.
        Parameters:
        context - The context.
        username - The username.
        Returns:
        The users UID.
      • getUserId

        public String getUserId​(org.forgerock.services.context.Context context)
        Gets the username for the user of the accessed resource.
        Parameters:
        context - The context.
        Returns:
        The resource users username.
      • getRealm

        public String getRealm​(org.forgerock.services.context.Context context)
        Gets the realm for the accessed resource.
        Parameters:
        context - The context.
        Returns:
        The resource realm.
      • getSubject

        public Subject getSubject​(org.forgerock.services.context.Context context)
        Gets the subject for the user of the accessed resource.
        Parameters:
        context - the context
        Returns:
        the subject attempting to access the resource