Class SSOTokenContext
- java.lang.Object
-
- org.forgerock.services.context.AbstractContext
-
- org.forgerock.openam.rest.resource.SSOTokenContext
-
- All Implemented Interfaces:
SubjectContext,org.forgerock.services.context.Context
- Direct Known Subclasses:
AdminSubjectContext
public class SSOTokenContext extends org.forgerock.services.context.AbstractContext implements SubjectContext
CREST context that provides a convenience method for getting hold of the caller as an authenticated subject based on the OpenAM SSO Token associated with the request.- Since:
- 12.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSSOTokenContext.FactoryGuice factory for SSOTokenContext instances
-
Constructor Summary
Constructors Modifier Constructor Description SSOTokenContext(Debug debug, SessionCache sessionCache, org.forgerock.services.context.Context parent)Construct a new SSOTokenContext from the parent, which is expected to contain aSecurityContext.protectedSSOTokenContext(Debug debug, SessionCache sessionCache, org.forgerock.services.context.Context parent, com.google.common.base.Supplier<SSOToken> token)Construct a new SSOTokenContext using a supplier for the SSOToken instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SessiongetCallerSession()Returns the session created from the session ID.SessionIDgetCallerSessionID()Returns the session ID created from the token ID.SSOTokengetCallerSSOToken()Returns the authenticated subjects sso token associated with this request.SubjectgetCallerSubject()Returns the authenticated subject associated with this request.static SSOTokengetSsoToken(org.forgerock.services.context.Context context)Obtain an SSOToken from a Context.-
Methods inherited from class org.forgerock.services.context.AbstractContext
asContext, containsContext, containsContext, getContext, getContextName, getId, getParent, isRootContext, toJsonValue, toString
-
-
-
-
Constructor Detail
-
SSOTokenContext
protected SSOTokenContext(Debug debug, SessionCache sessionCache, org.forgerock.services.context.Context parent, com.google.common.base.Supplier<SSOToken> token)
Construct a new SSOTokenContext using a supplier for the SSOToken instance.- Parameters:
debug- the debug logger used by this contextsessionCache- the session cache used to look up the session for the callerparent- The parent context.token- A supplier for the SSOToken to derive the other attributes of this context from.
-
SSOTokenContext
@Inject public SSOTokenContext(Debug debug, SessionCache sessionCache, org.forgerock.services.context.Context parent)
Construct a new SSOTokenContext from the parent, which is expected to contain aSecurityContext.- Parameters:
parent- The parent context.
-
-
Method Detail
-
getSsoToken
public static SSOToken getSsoToken(org.forgerock.services.context.Context context) throws SSOException
Obtain an SSOToken from a Context.- Parameters:
context- The context. Must contain a SecurityContext.- Returns:
- The SSOToken.
- Throws:
SSOException- If the token could not be obtained.
-
getCallerSubject
public Subject getCallerSubject()
Description copied from interface:SubjectContextReturns the authenticated subject associated with this request.- Specified by:
getCallerSubjectin interfaceSubjectContext- Returns:
- the authenticated subject associated with this request, or null if not authenticated.
-
getCallerSSOToken
public SSOToken getCallerSSOToken()
Description copied from interface:SubjectContextReturns the authenticated subjects sso token associated with this request.- Specified by:
getCallerSSOTokenin interfaceSubjectContext- Returns:
- the
SSOTokenassociated with this request
-
getCallerSessionID
public SessionID getCallerSessionID()
Description copied from interface:SubjectContextReturns the session ID created from the token ID.- Specified by:
getCallerSessionIDin interfaceSubjectContext- Returns:
- The
SessionIDinstance.
-
getCallerSession
public Session getCallerSession()
Description copied from interface:SubjectContextReturns the session created from the session ID.- Specified by:
getCallerSessionin interfaceSubjectContext- Returns:
- The
Sessioninstance.
-
-