Class StatelessSSOProvider
- java.lang.Object
-
- org.forgerock.openam.sso.providers.stateless.StatelessSSOProvider
-
- All Implemented Interfaces:
SSOProvider,SSOProviderPlugin,ServiceListener
public class StatelessSSOProvider extends Object implements SSOProviderPlugin, ServiceListener
A provider for explicitly stateless SSO tokens. Exists as a service listener to ensure that updates to whether or not stateless sessions are enabled are cached per realm. Acts as the gateway barrier for stateless sessions to hit up against when stateless sessions are not enabled (they fail validation to be handled by this provider).
-
-
Field Summary
-
Fields inherited from interface com.sun.identity.sm.ServiceListener
ADDED, MODIFIED, REMOVED
-
-
Constructor Summary
Constructors Constructor Description StatelessSSOProvider(StatelessSessionManager statelessSessionManager, Blacklist<Session> sessionBlacklist, StatelessAdminRestriction restriction, Debug debug)Default constructor is required by interface.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SSOTokencreateSSOToken(jakarta.servlet.http.HttpServletRequest request)Creates an SSOToken.SSOTokencreateSSOToken(String sid)Creates an SSOToken.SSOTokencreateSSOToken(String sid, boolean invokedByAuth)SSOTokencreateSSOToken(String sid, boolean invokedByAuth, boolean possiblyResetIdleTime)Creates an SSOToken.SSOTokencreateSSOToken(String sid, String clientIP)Creates an SSOToken.SSOTokencreateSSOToken(Principal user, String password)Creates an SSOToken.voiddestroyToken(SSOToken token)Destroys an SSOToken.voiddestroyToken(SSOToken destroyer, SSOToken destroyed)Destroys an SSOToken.Set<SSOToken>getValidSessions(SSOToken requester, String server)Returns valid Sessions.voidglobalConfigChanged(String serviceName, String version, String groupName, String serviceComponent, int type)This method will be invoked when a service's global configuration data has been changed.booleanisApplicable(jakarta.servlet.http.HttpServletRequest request)Determines whether this SSOProvider is applicable to the given servlet request.booleanisApplicable(String tokenId)Determines whether this SSOProvider is applicable to the given token id.booleanisValidToken(SSOToken token)Checks if an SSOToken is valid or not.booleanisValidToken(SSOToken token, boolean refresh)Checks if an SSOToken is valid or not.voidlogout(SSOToken token)Logs out of the session underlying this SSOToken.voidorganizationConfigChanged(String serviceName, String version, String orgName, String groupName, String serviceComponent, int type)This method will be invoked when a service's organization configuration data has been changed.voidrefreshSession(SSOToken token)Refresh the Session corresponding to the SSOToken from the Session Server, always resetting the idle time.voidrefreshSession(SSOToken token, boolean resetIdle)Refresh the Session corresponding to the SSOToken from the Session Server, but only optionally resetting the idle time.voidschemaChanged(String serviceName, String version)This method will be invoked when a service's schema has been changed.voidvalidateToken(SSOToken token)Checks if the SSOToken is valid.
-
-
-
Constructor Detail
-
StatelessSSOProvider
@Inject public StatelessSSOProvider(StatelessSessionManager statelessSessionManager, Blacklist<Session> sessionBlacklist, StatelessAdminRestriction restriction, @Named("amSession") Debug debug)
Default constructor is required by interface.
-
-
Method Detail
-
isApplicable
public boolean isApplicable(jakarta.servlet.http.HttpServletRequest request)
Description copied from interface:SSOProviderPluginDetermines whether this SSOProvider is applicable to the given servlet request.- Specified by:
isApplicablein interfaceSSOProviderPlugin- Parameters:
request- the request to check.- Returns:
trueif the request contains an SSOToken that can be handled by this provider.
-
isApplicable
public boolean isApplicable(String tokenId)
Description copied from interface:SSOProviderPluginDetermines whether this SSOProvider is applicable to the given token id.- Specified by:
isApplicablein interfaceSSOProviderPlugin- Parameters:
tokenId- the token id.- Returns:
trueif the given token id can be parsed by this provider.
-
createSSOToken
public SSOToken createSSOToken(jakarta.servlet.http.HttpServletRequest request) throws UnsupportedOperationException, SSOException
Description copied from interface:SSOProviderCreates an SSOToken.- Specified by:
createSSOTokenin interfaceSSOProvider- Parameters:
request- HttpServletRequest- Returns:
- SSOToken
- Throws:
SSOException- is thrown if the SSOToken can't be created.UnsupportedOperationException
-
createSSOToken
public SSOToken createSSOToken(Principal user, String password) throws SSOException, UnsupportedOperationException
Description copied from interface:SSOProviderCreates an SSOToken.- Specified by:
createSSOTokenin interfaceSSOProvider- Parameters:
user- Principal representing a user or servicepassword- LDAP password of the user or service- Returns:
- SSOToken
- Throws:
SSOException- is thrown if the SSOToken can't be created.UnsupportedOperationException- is thrown when other errors occur during the token creation.
-
createSSOToken
public SSOToken createSSOToken(String sid) throws SSOException, UnsupportedOperationException
Description copied from interface:SSOProviderCreates an SSOToken.- Specified by:
createSSOTokenin interfaceSSOProvider- Parameters:
sid- String representing the SSOToken Id- Returns:
- SSOToken
- Throws:
SSOException- is thrown if the SSOToken can't be created.UnsupportedOperationException- is thrown when other unsupported operation is performed.
-
createSSOToken
public SSOToken createSSOToken(String sid, boolean invokedByAuth) throws SSOException, UnsupportedOperationException
-
createSSOToken
public SSOToken createSSOToken(String sid, boolean invokedByAuth, boolean possiblyResetIdleTime) throws SSOException, UnsupportedOperationException
Description copied from interface:SSOProviderCreates an SSOToken.- Specified by:
createSSOTokenin interfaceSSOProvider- Parameters:
sid- String representing the SSOToken IdinvokedByAuth- boolean flag indicating that this method has been invoked by the AuthContext.getSSOToken() API.possiblyResetIdleTime- If true, the idle time of the token/session may be reset to zero. If false, the idle time will never be reset.- Returns:
- SSOToken
- Throws:
SSOException- is thrown if the SSOToken can't be created.UnsupportedOperationException- is thrown when other unsupported operation is performed.
-
createSSOToken
public SSOToken createSSOToken(String sid, String clientIP) throws SSOException, UnsupportedOperationException
Description copied from interface:SSOProviderCreates an SSOToken.- Specified by:
createSSOTokenin interfaceSSOProvider- Parameters:
sid- representing the SSOToken IdclientIP- representing the IP address of the client- Returns:
- SSOToken
- Throws:
SSOException- is thrown if the SSOToken can't be created.UnsupportedOperationException
-
destroyToken
public void destroyToken(SSOToken token) throws SSOException
Description copied from interface:SSOProviderDestroys an SSOToken.- Specified by:
destroyTokenin interfaceSSOProvider- Parameters:
token- The SSOToken object to be destroyed- Throws:
SSOException- is thrown if the SSOToken can't be destroyed.
-
logout
public void logout(SSOToken token) throws SSOException
Description copied from interface:SSOProviderLogs out of the session underlying this SSOToken.- Specified by:
logoutin interfaceSSOProvider- Parameters:
token- the sso token to log out.- Throws:
SSOException- if an error occurs during logout.
-
isValidToken
public boolean isValidToken(SSOToken token)
Description copied from interface:SSOProviderChecks if an SSOToken is valid or not. Your token may be refreshed.- Specified by:
isValidTokenin interfaceSSOProvider- Parameters:
token- The SSOToken object to be validated.- Returns:
- true or false, true if the token is valid
-
isValidToken
public boolean isValidToken(SSOToken token, boolean refresh)
Description copied from interface:SSOProviderChecks if an SSOToken is valid or not.- Specified by:
isValidTokenin interfaceSSOProvider- Parameters:
token- The SSOToken object to be validated.refresh- Refresh the token only if this flag is set to true.- Returns:
- true if the token is valid, false otherwise
-
validateToken
public void validateToken(SSOToken token) throws SSOException
Description copied from interface:SSOProviderChecks if the SSOToken is valid.- Specified by:
validateTokenin interfaceSSOProvider- Throws:
SSOException- is thrown if the SSOToken is not valid.
-
refreshSession
public void refreshSession(SSOToken token) throws SSOException
Description copied from interface:SSOProviderRefresh the Session corresponding to the SSOToken from the Session Server, always resetting the idle time.- Specified by:
refreshSessionin interfaceSSOProvider- Parameters:
token- SSOToken- Throws:
SSOException- thrown if the session cannot be refreshed for the token
-
refreshSession
public void refreshSession(SSOToken token, boolean resetIdle) throws SSOException
Description copied from interface:SSOProviderRefresh the Session corresponding to the SSOToken from the Session Server, but only optionally resetting the idle time.- Specified by:
refreshSessionin interfaceSSOProvider- Parameters:
token- SSOTokenresetIdle- if true, reset the idle time to zero, if false, do not do this.- Throws:
SSOException- thrown if the session cannot be refreshed for the token
-
destroyToken
public void destroyToken(SSOToken destroyer, SSOToken destroyed) throws SSOException
Description copied from interface:SSOProviderDestroys an SSOToken.- Specified by:
destroyTokenin interfaceSSOProvider- Parameters:
destroyer- The SSOToken object used to authorize the operationdestroyed- The SSOToken object to be destroyed.- Throws:
SSOException- thrown if the there was an error during communication with session service.
-
getValidSessions
public Set<SSOToken> getValidSessions(SSOToken requester, String server) throws SSOException
Description copied from interface:SSOProviderReturns valid Sessions.- Specified by:
getValidSessionsin interfaceSSOProvider- Parameters:
requester- The SSOToken object used to authorize the operationserver- The server for which the valid sessions are to be retrieved- Returns:
- Set The set of Valid Sessions
- Throws:
SSOException- thrown if the there was an error during communication with session service.
-
schemaChanged
public void schemaChanged(String serviceName, String version)
Description copied from interface:ServiceListenerThis method will be invoked when a service's schema has been changed.- Specified by:
schemaChangedin interfaceServiceListener- Parameters:
serviceName- name of the serviceversion- version of the service
-
globalConfigChanged
public void globalConfigChanged(String serviceName, String version, String groupName, String serviceComponent, int type)
Description copied from interface:ServiceListenerThis method will be invoked when a service's global configuration data has been changed. The parametergroupNamedenote the name of the configuration grouping (e.g. default) andserviceComponentdenotes the service's sub-component that changed (e.g./NamedPolicy,/Templates).- Specified by:
globalConfigChangedin interfaceServiceListener- Parameters:
serviceName- name of the service.version- version of the service.groupName- name of the configuration grouping.serviceComponent- name of the service components that changed.type- change type, i.e., ADDED, REMOVED or MODIFIED.
-
organizationConfigChanged
public void organizationConfigChanged(String serviceName, String version, String orgName, String groupName, String serviceComponent, int type)
Description copied from interface:ServiceListenerThis method will be invoked when a service's organization configuration data has been changed. The parametersorgName,groupNameandserviceComponentdenotes the organization name, configuration grouping name and service's sub-component that are changed respectively.- Specified by:
organizationConfigChangedin interfaceServiceListener- Parameters:
serviceName- name of the serviceversion- version of the serviceorgName- organization name as DNgroupName- name of the configuration groupingserviceComponent- the name of the service components that changedtype- change type, i.e., ADDED, REMOVED or MODIFIED
-
-