Package org.gluu.oxauth.model.common
Class AbstractAuthorizationGrant
- java.lang.Object
-
- org.gluu.oxauth.model.common.AbstractAuthorizationGrant
-
- All Implemented Interfaces:
IAuthorizationGrant
- Direct Known Subclasses:
AuthorizationGrant
public abstract class AbstractAuthorizationGrant extends java.lang.Object implements IAuthorizationGrant
- Version:
- November 28, 2018
- Author:
- Yuriy Zabrovarnyy, Javier Rojas Blum, Yuriy Movchan
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.ConcurrentMap<java.lang.String,AccessToken>
accessTokens
protected AppConfiguration
appConfiguration
protected java.util.concurrent.ConcurrentMap<java.lang.String,RefreshToken>
refreshTokens
protected ScopeChecker
scopeChecker
-
Constructor Summary
Constructors Modifier Constructor Description AbstractAuthorizationGrant()
protected
AbstractAuthorizationGrant(User user, AuthorizationGrantType authorizationGrantType, Client client, java.util.Date authenticationTime)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
checkScopesPolicy(java.lang.String requestedScopes)
Checks the scopes policy configured according to the type of the authorization grant to limit the issued token scopes.AccessToken
createAccessToken(java.lang.String certAsPem, ExecutionContext executionContext)
RefreshToken
createRefreshToken(ExecutionContext executionContext)
AbstractToken
getAccessToken(java.lang.String tokenCode)
Gets the access token instance from the id token list or the access token list given its code.java.util.List<AccessToken>
getAccessTokens()
Returns a list with all the issued access tokens.java.util.Set<java.lang.String>
getAccessTokensCodes()
Returns a list with all the issued access tokens codes.java.lang.String
getAcrValues()
java.util.Date
getAuthenticationTime()
AuthorizationCode
getAuthorizationCode()
Returns theAuthorizationCode
.AuthorizationGrantType
getAuthorizationGrantType()
Returns theAuthorizationGrantType
.java.lang.String
getClaims()
Client
getClient()
Returns theClient
.java.lang.String
getClientDn()
java.lang.String
getClientId()
java.lang.String
getCodeChallenge()
java.lang.String
getCodeChallengeMethod()
java.lang.String
getGrantId()
IdToken
getIdToken()
JwtAuthorizationRequest
getJwtAuthorizationRequest()
AccessToken
getLongLivedAccessToken()
java.lang.String
getNonce()
RefreshToken
getRefreshToken(java.lang.String refreshTokenCode)
Gets the refresh token instance from the refresh token list given its code.java.util.List<RefreshToken>
getRefreshTokens()
Returns a list with all the issued refresh tokens.java.util.Set<java.lang.String>
getRefreshTokensCodes()
Returns a list with all the issued refresh tokens codes.java.util.Set<java.lang.String>
getScopes()
Returns a list of the scopes granted to the client.java.lang.String
getSessionDn()
java.lang.String
getTokenBindingHash()
TokenLdap
getTokenLdap()
User
getUser()
Returns the resource owner's.java.lang.String
getUserDn()
java.lang.String
getUserId()
java.lang.String
getX5cs256()
protected void
init(User user, AuthorizationGrantType authorizationGrantType, Client client, java.util.Date authenticationTime)
void
setAccessTokens(java.util.List<AccessToken> accessTokens)
void
setAcrValues(java.lang.String acrValues)
void
setAuthenticationTime(java.util.Date authenticationTime)
void
setAuthorizationCode(AuthorizationCode authorizationCode)
Sets theAuthorizationCode
.void
setClaims(java.lang.String claims)
void
setCodeChallenge(java.lang.String codeChallenge)
void
setCodeChallengeMethod(java.lang.String codeChallengeMethod)
void
setGrantId(java.lang.String p_grantId)
void
setIdToken(IdToken idToken)
void
setJwtAuthorizationRequest(JwtAuthorizationRequest p_jwtAuthorizationRequest)
void
setLongLivedAccessToken(AccessToken longLivedAccessToken)
void
setNonce(java.lang.String nonce)
void
setRefreshTokens(java.util.List<RefreshToken> refreshTokens)
void
setScopes(java.util.Collection<java.lang.String> scopes)
void
setSessionDn(java.lang.String sessionDn)
void
setTokenBindingHash(java.lang.String tokenBindingHash)
void
setTokenLdap(TokenLdap p_tokenLdap)
void
setX5cs256(java.lang.String x5cs256)
java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.gluu.oxauth.model.common.IAuthorizationGrant
checkExpiredTokens, createIdToken, getGrantType, getSub, revokeAllTokens, save
-
-
-
-
Field Detail
-
appConfiguration
@Inject protected AppConfiguration appConfiguration
-
scopeChecker
@Inject protected ScopeChecker scopeChecker
-
accessTokens
protected final java.util.concurrent.ConcurrentMap<java.lang.String,AccessToken> accessTokens
-
refreshTokens
protected final java.util.concurrent.ConcurrentMap<java.lang.String,RefreshToken> refreshTokens
-
-
Constructor Detail
-
AbstractAuthorizationGrant
public AbstractAuthorizationGrant()
-
AbstractAuthorizationGrant
protected AbstractAuthorizationGrant(User user, AuthorizationGrantType authorizationGrantType, Client client, java.util.Date authenticationTime)
-
-
Method Detail
-
init
protected void init(User user, AuthorizationGrantType authorizationGrantType, Client client, java.util.Date authenticationTime)
-
getGrantId
public java.lang.String getGrantId()
- Specified by:
getGrantId
in interfaceIAuthorizationGrant
-
setGrantId
public void setGrantId(java.lang.String p_grantId)
- Specified by:
setGrantId
in interfaceIAuthorizationGrant
-
getAuthorizationCode
public AuthorizationCode getAuthorizationCode()
Returns theAuthorizationCode
.- Specified by:
getAuthorizationCode
in interfaceIAuthorizationGrant
- Returns:
- The authorization code.
-
setAuthorizationCode
public void setAuthorizationCode(AuthorizationCode authorizationCode)
Sets theAuthorizationCode
.- Specified by:
setAuthorizationCode
in interfaceIAuthorizationGrant
- Parameters:
authorizationCode
- The authorization code.
-
getTokenBindingHash
public java.lang.String getTokenBindingHash()
-
setTokenBindingHash
public void setTokenBindingHash(java.lang.String tokenBindingHash)
-
getX5cs256
public java.lang.String getX5cs256()
-
setX5cs256
public void setX5cs256(java.lang.String x5cs256)
-
getNonce
public java.lang.String getNonce()
- Specified by:
getNonce
in interfaceIAuthorizationGrant
-
setNonce
public void setNonce(java.lang.String nonce)
- Specified by:
setNonce
in interfaceIAuthorizationGrant
-
getCodeChallenge
public java.lang.String getCodeChallenge()
-
setCodeChallenge
public void setCodeChallenge(java.lang.String codeChallenge)
-
getCodeChallengeMethod
public java.lang.String getCodeChallengeMethod()
-
setCodeChallengeMethod
public void setCodeChallengeMethod(java.lang.String codeChallengeMethod)
-
getClaims
public java.lang.String getClaims()
-
setClaims
public void setClaims(java.lang.String claims)
-
getRefreshTokensCodes
public java.util.Set<java.lang.String> getRefreshTokensCodes()
Returns a list with all the issued refresh tokens codes.- Specified by:
getRefreshTokensCodes
in interfaceIAuthorizationGrant
- Returns:
- List with all the issued refresh tokens codes.
-
getAccessTokensCodes
public java.util.Set<java.lang.String> getAccessTokensCodes()
Returns a list with all the issued access tokens codes.- Specified by:
getAccessTokensCodes
in interfaceIAuthorizationGrant
- Returns:
- List with all the issued access tokens codes.
-
getAccessTokens
public java.util.List<AccessToken> getAccessTokens()
Returns a list with all the issued access tokens.- Specified by:
getAccessTokens
in interfaceIAuthorizationGrant
- Returns:
- List with all the issued access tokens.
-
setScopes
public void setScopes(java.util.Collection<java.lang.String> scopes)
- Specified by:
setScopes
in interfaceIAuthorizationGrant
-
getLongLivedAccessToken
public AccessToken getLongLivedAccessToken()
- Specified by:
getLongLivedAccessToken
in interfaceIAuthorizationGrant
-
setLongLivedAccessToken
public void setLongLivedAccessToken(AccessToken longLivedAccessToken)
- Specified by:
setLongLivedAccessToken
in interfaceIAuthorizationGrant
-
getIdToken
public IdToken getIdToken()
- Specified by:
getIdToken
in interfaceIAuthorizationGrant
-
setIdToken
public void setIdToken(IdToken idToken)
- Specified by:
setIdToken
in interfaceIAuthorizationGrant
-
getTokenLdap
public TokenLdap getTokenLdap()
- Specified by:
getTokenLdap
in interfaceIAuthorizationGrant
-
setTokenLdap
public void setTokenLdap(TokenLdap p_tokenLdap)
- Specified by:
setTokenLdap
in interfaceIAuthorizationGrant
-
getUser
public User getUser()
Returns the resource owner's.- Specified by:
getUser
in interfaceIAuthorizationGrant
- Returns:
- The resource owner's.
-
getAcrValues
public java.lang.String getAcrValues()
- Specified by:
getAcrValues
in interfaceIAuthorizationGrant
-
setAcrValues
public void setAcrValues(java.lang.String acrValues)
- Specified by:
setAcrValues
in interfaceIAuthorizationGrant
-
getSessionDn
public java.lang.String getSessionDn()
- Specified by:
getSessionDn
in interfaceIAuthorizationGrant
-
setSessionDn
public void setSessionDn(java.lang.String sessionDn)
- Specified by:
setSessionDn
in interfaceIAuthorizationGrant
-
checkScopesPolicy
public java.lang.String checkScopesPolicy(java.lang.String requestedScopes)
Checks the scopes policy configured according to the type of the authorization grant to limit the issued token scopes.- Specified by:
checkScopesPolicy
in interfaceIAuthorizationGrant
- Parameters:
requestedScopes
- A space-delimited list of values in which the order of values does not matter.- Returns:
- A space-delimited list of scopes
-
createAccessToken
public AccessToken createAccessToken(java.lang.String certAsPem, ExecutionContext executionContext)
- Specified by:
createAccessToken
in interfaceIAuthorizationGrant
-
createRefreshToken
public RefreshToken createRefreshToken(ExecutionContext executionContext)
- Specified by:
createRefreshToken
in interfaceIAuthorizationGrant
-
getUserId
public java.lang.String getUserId()
- Specified by:
getUserId
in interfaceIAuthorizationGrant
-
getUserDn
public java.lang.String getUserDn()
- Specified by:
getUserDn
in interfaceIAuthorizationGrant
-
getAuthorizationGrantType
public AuthorizationGrantType getAuthorizationGrantType()
Returns theAuthorizationGrantType
.- Specified by:
getAuthorizationGrantType
in interfaceIAuthorizationGrant
- Returns:
- The authorization grant type.
-
getClient
public Client getClient()
Returns theClient
. An application making protected resource requests on behalf of the resource owner and with its authorization.- Specified by:
getClient
in interfaceIAuthorizationGrant
- Returns:
- The client.
-
getClientId
public java.lang.String getClientId()
- Specified by:
getClientId
in interfaceIAuthorizationGrant
-
getClientDn
public java.lang.String getClientDn()
- Specified by:
getClientDn
in interfaceIAuthorizationGrant
-
getAuthenticationTime
public java.util.Date getAuthenticationTime()
- Specified by:
getAuthenticationTime
in interfaceIAuthorizationGrant
-
setAuthenticationTime
public void setAuthenticationTime(java.util.Date authenticationTime)
-
getScopes
public java.util.Set<java.lang.String> getScopes()
Returns a list of the scopes granted to the client.- Specified by:
getScopes
in interfaceIAuthorizationGrant
- Returns:
- List of the scopes granted to the client.
-
getJwtAuthorizationRequest
public JwtAuthorizationRequest getJwtAuthorizationRequest()
- Specified by:
getJwtAuthorizationRequest
in interfaceIAuthorizationGrant
-
setJwtAuthorizationRequest
public void setJwtAuthorizationRequest(JwtAuthorizationRequest p_jwtAuthorizationRequest)
- Specified by:
setJwtAuthorizationRequest
in interfaceIAuthorizationGrant
-
setAccessTokens
public void setAccessTokens(java.util.List<AccessToken> accessTokens)
- Specified by:
setAccessTokens
in interfaceIAuthorizationGrant
-
getRefreshTokens
public java.util.List<RefreshToken> getRefreshTokens()
Returns a list with all the issued refresh tokens.- Specified by:
getRefreshTokens
in interfaceIAuthorizationGrant
- Returns:
- List with all the issued refresh tokens.
-
setRefreshTokens
public void setRefreshTokens(java.util.List<RefreshToken> refreshTokens)
- Specified by:
setRefreshTokens
in interfaceIAuthorizationGrant
-
getRefreshToken
public RefreshToken getRefreshToken(java.lang.String refreshTokenCode)
Gets the refresh token instance from the refresh token list given its code.- Specified by:
getRefreshToken
in interfaceIAuthorizationGrant
- Parameters:
refreshTokenCode
- The code of the refresh token.- Returns:
- The refresh token instance or
null
if not found.
-
getAccessToken
public AbstractToken getAccessToken(java.lang.String tokenCode)
Gets the access token instance from the id token list or the access token list given its code.- Specified by:
getAccessToken
in interfaceIAuthorizationGrant
- Parameters:
tokenCode
- The code of the access token.- Returns:
- The access token instance or
null
if not found.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-