@Singleton public class OpenIdConnectSSOProvider extends Object implements SSOProviderPlugin
SSOProvider
that 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.
Modifier and Type | Method and Description |
---|---|
SSOToken |
createSSOToken(javax.servlet.http.HttpServletRequest request)
Creates an SSOToken.
|
SSOToken |
createSSOToken(Principal user,
String password)
Creates an SSOToken.
|
SSOToken |
createSSOToken(String idToken)
Creates an SSOToken.
|
SSOToken |
createSSOToken(String idToken,
boolean invokedByAuth,
boolean possiblyResetIdleTime)
Creates an SSOToken.
|
SSOToken |
createSSOToken(String idToken,
String clientIP)
Creates an SSOToken.
|
void |
destroyToken(SSOToken token)
Destroys an SSOToken.
|
void |
destroyToken(SSOToken destroyer,
SSOToken destroyed)
Destroys an SSOToken.
|
Set<SSOToken> |
getValidSessions(SSOToken requester,
String server)
Returns valid Sessions.
|
boolean |
isApplicable(javax.servlet.http.HttpServletRequest request)
Determines whether this SSOProvider is applicable to the given servlet request.
|
boolean |
isApplicable(String tokenId)
Determines whether this SSOProvider is applicable to the given token id.
|
boolean |
isValidToken(SSOToken token)
Checks if an SSOToken is valid or not.
|
boolean |
isValidToken(SSOToken token,
boolean refresh)
Checks if an SSOToken is valid or not.
|
void |
logout(SSOToken token)
Logs out of the session underlying this SSOToken.
|
void |
refreshSession(SSOToken token)
Refresh the Session corresponding to the SSOToken from the Session
Server, always resetting the idle time.
|
void |
refreshSession(SSOToken token,
boolean resetIdle)
Refresh the Session corresponding to the SSOToken from the Session
Server, but only optionally resetting the idle time.
|
void |
validateToken(SSOToken token)
Checks if the SSOToken is valid.
|
public boolean isApplicable(javax.servlet.http.HttpServletRequest request)
SSOProviderPlugin
isApplicable
in interface SSOProviderPlugin
request
- the request to check.true
if the request contains an SSOToken that can be handled by this provider.public boolean isApplicable(String tokenId)
SSOProviderPlugin
isApplicable
in interface SSOProviderPlugin
tokenId
- the token id.true
if the given token id can be parsed by this provider.public SSOToken createSSOToken(javax.servlet.http.HttpServletRequest request) throws SSOException
SSOProvider
createSSOToken
in interface SSOProvider
request
- HttpServletRequestSSOException
- is thrown if the SSOToken can't be created.public SSOToken createSSOToken(Principal user, String password) throws SSOException
SSOProvider
createSSOToken
in interface SSOProvider
user
- Principal representing a user or servicepassword
- LDAP password of the user or serviceSSOException
- is thrown if the SSOToken can't be created.public SSOToken createSSOToken(String idToken) throws SSOException
SSOProvider
createSSOToken
in interface SSOProvider
idToken
- String representing the SSOToken IdSSOException
- is thrown if the SSOToken can't be
created.public SSOToken createSSOToken(String idToken, boolean invokedByAuth, boolean possiblyResetIdleTime) throws SSOException
SSOProvider
createSSOToken
in interface SSOProvider
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.SSOException
- is thrown if the SSOToken can't be created.public SSOToken createSSOToken(String idToken, String clientIP) throws SSOException
SSOProvider
createSSOToken
in interface SSOProvider
idToken
- representing the SSOToken IdclientIP
- representing the IP address of the clientSSOException
- is thrown if the SSOToken can't be created.public void destroyToken(SSOToken token) throws SSOException
SSOProvider
destroyToken
in interface SSOProvider
token
- The SSOToken object to be destroyedSSOException
- is thrown if the SSOToken can't be destroyed.public boolean isValidToken(SSOToken token)
SSOProvider
isValidToken
in interface SSOProvider
token
- The SSOToken object to be validated.public boolean isValidToken(SSOToken token, boolean refresh)
SSOProvider
isValidToken
in interface SSOProvider
token
- The SSOToken object to be validated.refresh
- Refresh the token only if this flag is set to true.public void validateToken(SSOToken token) throws SSOException
SSOProvider
validateToken
in interface SSOProvider
SSOException
- is thrown if the SSOToken is not valid.public void refreshSession(SSOToken token) throws SSOException
SSOProvider
refreshSession
in interface SSOProvider
token
- SSOTokenSSOException
- thrown if the session cannot be refreshed for the tokenpublic void refreshSession(SSOToken token, boolean resetIdle) throws SSOException
SSOProvider
refreshSession
in interface SSOProvider
token
- SSOTokenresetIdle
- if true, reset the idle time to zero, if false, do not do this.SSOException
- thrown if the session cannot be refreshed for the tokenpublic void destroyToken(SSOToken destroyer, SSOToken destroyed) throws SSOException
SSOProvider
destroyToken
in interface SSOProvider
destroyer
- The SSOToken object used to authorize the operationdestroyed
- The SSOToken object to be destroyed.SSOException
- thrown if the there was an error during communication with session service.public void logout(SSOToken token) throws SSOException
SSOProvider
logout
in interface SSOProvider
token
- the sso token to log out.SSOException
- if an error occurs during logout.public Set<SSOToken> getValidSessions(SSOToken requester, String server) throws SSOException
SSOProvider
getValidSessions
in interface SSOProvider
requester
- The SSOToken object used to authorize the operationserver
- The server for which the valid sessions are to be retrievedSSOException
- thrown if the there was an error during communication with session service.Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.