Class OpenIdConnectSSOProvider
- java.lang.Object
-
- org.forgerock.openidconnect.ssoprovider.OpenIdConnectSSOProvider
-
- All Implemented Interfaces:
SSOProvider,SSOProviderPlugin
@Singleton public class OpenIdConnectSSOProvider extends Object implements SSOProviderPlugin
Implements anSSOProviderthat accepts OpenID Connect ID Tokens issued by this instance of OpenAM and treats them as SSOTokens. It does this by looking up the session associated with the ID Token and using that. If storing OPS tokens is disabled then this will not work and ID Tokens will not be accepted as valid sessions.All methods here apart from createToken and isApplicable throw UnsupportedOperationException as they should never be called: all tokens will ultimately be created by a different SSOProvider, which will handle all methods after creation.
- Since:
- 14.0.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SSOTokencreateSSOToken(jakarta.servlet.http.HttpServletRequest request)Creates an SSOToken.SSOTokencreateSSOToken(String idToken)Creates an SSOToken.SSOTokencreateSSOToken(String idToken, boolean invokedByAuth, boolean possiblyResetIdleTime)Creates an SSOToken.SSOTokencreateSSOToken(String idToken, 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.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.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.voidvalidateToken(SSOToken token)Checks if the SSOToken is valid.
-
-
-
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 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.
-
createSSOToken
public SSOToken createSSOToken(Principal user, String password) throws SSOException
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.
-
createSSOToken
public SSOToken createSSOToken(String idToken) throws SSOException
Description copied from interface:SSOProviderCreates an SSOToken.- Specified by:
createSSOTokenin interfaceSSOProvider- Parameters:
idToken- String representing the SSOToken Id- Returns:
- SSOToken
- Throws:
SSOException- is thrown if the SSOToken can't be created.
-
createSSOToken
public SSOToken createSSOToken(String idToken, boolean invokedByAuth, boolean possiblyResetIdleTime) throws SSOException
Description copied from interface:SSOProviderCreates an SSOToken.- Specified by:
createSSOTokenin interfaceSSOProvider- Parameters:
idToken- 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.
-
createSSOToken
public SSOToken createSSOToken(String idToken, String clientIP) throws SSOException
Description copied from interface:SSOProviderCreates an SSOToken.- Specified by:
createSSOTokenin interfaceSSOProvider- Parameters:
idToken- representing the SSOToken IdclientIP- representing the IP address of the client- Returns:
- SSOToken
- Throws:
SSOException- is thrown if the SSOToken can't be created.
-
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.
-
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.
-
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.
-
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.
-
-