Package io.jans.as.server.model.common
Class AbstractAuthorizationGrant
- java.lang.Object
-
- io.jans.as.server.model.common.AbstractAuthorizationGrant
-
- All Implemented Interfaces:
IAuthorizationGrant
- Direct Known Subclasses:
AuthorizationGrant
public abstract class AbstractAuthorizationGrant extends Object implements IAuthorizationGrant
- Version:
- September 30, 2021
- Author:
- Yuriy Zabrovarnyy, Javier Rojas Blum, Yuriy Movchan
-
-
Field Summary
Fields Modifier and Type Field Description protected ConcurrentMap<String,AccessToken>accessTokensprotected io.jans.as.model.configuration.AppConfigurationappConfigurationprotected ConcurrentMap<String,RefreshToken>refreshTokensprotected ScopeCheckerscopeChecker
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractAuthorizationGrant()protectedAbstractAuthorizationGrant(io.jans.as.common.model.common.User user, AuthorizationGrantType authorizationGrantType, io.jans.as.common.model.registration.Client client, Date authenticationTime)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcheckScopesPolicy(String requestedScopes)Checks the scopes policy configured according to the type of the authorization grant to limit the issued token scopes.AccessTokencreateAccessToken(ExecutionContext executionContext)RefreshTokencreateRefreshToken(ExecutionContext context)RefreshTokencreateRefreshToken(ExecutionContext context, int lifetime)AbstractTokengetAccessToken(String tokenCode)Gets the access token instance from the id token list or the access token list given its code.intgetAccessTokenLifetimeInSeconds(ExecutionContext executionContext)List<AccessToken>getAccessTokens()Returns a list with all the issued access tokens.Set<String>getAccessTokensCodes()Returns a list with all the issued access tokens codes.StringgetAcrValues()DategetAuthenticationTime()AuthorizationCodegetAuthorizationCode()Returns theAuthorizationCode.AuthorizationGrantTypegetAuthorizationGrantType()Returns theAuthorizationGrantType.StringgetClaims()io.jans.as.common.model.registration.ClientgetClient()Returns theClient.StringgetClientDn()StringgetClientId()StringgetCodeChallenge()StringgetCodeChallengeMethod()StringgetGrantId()IdTokengetIdToken()JwtAuthorizationRequestgetJwtAuthorizationRequest()AccessTokengetLongLivedAccessToken()StringgetNonce()RefreshTokengetRefreshToken(String refreshTokenCode)Gets the refresh token instance from the refresh token list given its code.List<RefreshToken>getRefreshTokens()Returns a list with all the issued refresh tokens.Set<String>getRefreshTokensCodes()Returns a list with all the issued refresh tokens codes.Set<String>getScopes()Returns a list of the scopes granted to the client.StringgetSessionDn()StringgetTokenBindingHash()TokenEntitygetTokenEntity()io.jans.as.common.model.common.UsergetUser()Returns the resource owner's.StringgetUserDn()StringgetUserId()StringgetX5cs256()protected voidinit(io.jans.as.common.model.common.User user, AuthorizationGrantType authorizationGrantType, io.jans.as.common.model.registration.Client client, Date authenticationTime)voidsetAccessTokens(List<AccessToken> accessTokens)voidsetAcrValues(String acrValues)voidsetAuthenticationTime(Date authenticationTime)voidsetAuthorizationCode(AuthorizationCode authorizationCode)Sets theAuthorizationCode.voidsetClaims(String claims)voidsetCodeChallenge(String codeChallenge)voidsetCodeChallengeMethod(String codeChallengeMethod)voidsetGrantId(String grantId)voidsetIdToken(IdToken idToken)voidsetJwtAuthorizationRequest(JwtAuthorizationRequest jwtAuthorizationRequest)voidsetLongLivedAccessToken(AccessToken longLivedAccessToken)voidsetNonce(String nonce)voidsetRefreshTokens(List<RefreshToken> refreshTokens)voidsetScopes(Collection<String> scopes)voidsetSessionDn(String sessionDn)voidsetTokenBindingHash(String tokenBindingHash)voidsetTokenEntity(TokenEntity tokenEntity)voidsetX5cs256(String x5cs256)StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.jans.as.server.model.common.IAuthorizationGrant
checkExpiredTokens, createIdToken, getGrantType, getSub, revokeAllTokens, save
-
-
-
-
Field Detail
-
appConfiguration
@Inject protected io.jans.as.model.configuration.AppConfiguration appConfiguration
-
scopeChecker
@Inject protected ScopeChecker scopeChecker
-
accessTokens
protected final ConcurrentMap<String,AccessToken> accessTokens
-
refreshTokens
protected final ConcurrentMap<String,RefreshToken> refreshTokens
-
-
Constructor Detail
-
AbstractAuthorizationGrant
protected AbstractAuthorizationGrant()
-
AbstractAuthorizationGrant
protected AbstractAuthorizationGrant(io.jans.as.common.model.common.User user, AuthorizationGrantType authorizationGrantType, io.jans.as.common.model.registration.Client client, Date authenticationTime)
-
-
Method Detail
-
init
protected void init(io.jans.as.common.model.common.User user, AuthorizationGrantType authorizationGrantType, io.jans.as.common.model.registration.Client client, Date authenticationTime)
-
getGrantId
public String getGrantId()
- Specified by:
getGrantIdin interfaceIAuthorizationGrant
-
setGrantId
public void setGrantId(String grantId)
- Specified by:
setGrantIdin interfaceIAuthorizationGrant
-
getAuthorizationCode
public AuthorizationCode getAuthorizationCode()
Returns theAuthorizationCode.- Specified by:
getAuthorizationCodein interfaceIAuthorizationGrant- Returns:
- The authorization code.
-
setAuthorizationCode
public void setAuthorizationCode(AuthorizationCode authorizationCode)
Sets theAuthorizationCode.- Specified by:
setAuthorizationCodein interfaceIAuthorizationGrant- Parameters:
authorizationCode- The authorization code.
-
getTokenBindingHash
public String getTokenBindingHash()
-
setTokenBindingHash
public void setTokenBindingHash(String tokenBindingHash)
-
getX5cs256
public String getX5cs256()
-
setX5cs256
public void setX5cs256(String x5cs256)
-
getNonce
public String getNonce()
- Specified by:
getNoncein interfaceIAuthorizationGrant
-
setNonce
public void setNonce(String nonce)
- Specified by:
setNoncein interfaceIAuthorizationGrant
-
getCodeChallenge
public String getCodeChallenge()
-
setCodeChallenge
public void setCodeChallenge(String codeChallenge)
-
getCodeChallengeMethod
public String getCodeChallengeMethod()
-
setCodeChallengeMethod
public void setCodeChallengeMethod(String codeChallengeMethod)
-
getClaims
public String getClaims()
-
setClaims
public void setClaims(String claims)
-
getRefreshTokensCodes
public Set<String> getRefreshTokensCodes()
Returns a list with all the issued refresh tokens codes.- Specified by:
getRefreshTokensCodesin interfaceIAuthorizationGrant- Returns:
- List with all the issued refresh tokens codes.
-
getAccessTokensCodes
public Set<String> getAccessTokensCodes()
Returns a list with all the issued access tokens codes.- Specified by:
getAccessTokensCodesin interfaceIAuthorizationGrant- Returns:
- List with all the issued access tokens codes.
-
getAccessTokens
public List<AccessToken> getAccessTokens()
Returns a list with all the issued access tokens.- Specified by:
getAccessTokensin interfaceIAuthorizationGrant- Returns:
- List with all the issued access tokens.
-
setScopes
public void setScopes(Collection<String> scopes)
- Specified by:
setScopesin interfaceIAuthorizationGrant
-
getLongLivedAccessToken
public AccessToken getLongLivedAccessToken()
- Specified by:
getLongLivedAccessTokenin interfaceIAuthorizationGrant
-
setLongLivedAccessToken
public void setLongLivedAccessToken(AccessToken longLivedAccessToken)
- Specified by:
setLongLivedAccessTokenin interfaceIAuthorizationGrant
-
getIdToken
public IdToken getIdToken()
- Specified by:
getIdTokenin interfaceIAuthorizationGrant
-
setIdToken
public void setIdToken(IdToken idToken)
- Specified by:
setIdTokenin interfaceIAuthorizationGrant
-
getTokenEntity
public TokenEntity getTokenEntity()
- Specified by:
getTokenEntityin interfaceIAuthorizationGrant
-
setTokenEntity
public void setTokenEntity(TokenEntity tokenEntity)
- Specified by:
setTokenEntityin interfaceIAuthorizationGrant
-
getUser
public io.jans.as.common.model.common.User getUser()
Returns the resource owner's.- Specified by:
getUserin interfaceIAuthorizationGrant- Returns:
- The resource owner's.
-
getAcrValues
public String getAcrValues()
- Specified by:
getAcrValuesin interfaceIAuthorizationGrant
-
setAcrValues
public void setAcrValues(String acrValues)
- Specified by:
setAcrValuesin interfaceIAuthorizationGrant
-
getSessionDn
public String getSessionDn()
- Specified by:
getSessionDnin interfaceIAuthorizationGrant
-
setSessionDn
public void setSessionDn(String sessionDn)
- Specified by:
setSessionDnin interfaceIAuthorizationGrant
-
checkScopesPolicy
public String checkScopesPolicy(String requestedScopes)
Checks the scopes policy configured according to the type of the authorization grant to limit the issued token scopes.- Specified by:
checkScopesPolicyin 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
-
getAccessTokenLifetimeInSeconds
public int getAccessTokenLifetimeInSeconds(ExecutionContext executionContext)
-
createAccessToken
public AccessToken createAccessToken(ExecutionContext executionContext)
- Specified by:
createAccessTokenin interfaceIAuthorizationGrant
-
createRefreshToken
public RefreshToken createRefreshToken(ExecutionContext context)
- Specified by:
createRefreshTokenin interfaceIAuthorizationGrant
-
createRefreshToken
public RefreshToken createRefreshToken(ExecutionContext context, int lifetime)
- Specified by:
createRefreshTokenin interfaceIAuthorizationGrant
-
getUserId
public String getUserId()
- Specified by:
getUserIdin interfaceIAuthorizationGrant
-
getUserDn
public String getUserDn()
- Specified by:
getUserDnin interfaceIAuthorizationGrant
-
getAuthorizationGrantType
public AuthorizationGrantType getAuthorizationGrantType()
Returns theAuthorizationGrantType.- Specified by:
getAuthorizationGrantTypein interfaceIAuthorizationGrant- Returns:
- The authorization grant type.
-
getClient
public io.jans.as.common.model.registration.Client getClient()
Returns theClient. An application making protected resource requests on behalf of the resource owner and with its authorization.- Specified by:
getClientin interfaceIAuthorizationGrant- Returns:
- The client.
-
getClientId
public String getClientId()
- Specified by:
getClientIdin interfaceIAuthorizationGrant
-
getClientDn
public String getClientDn()
- Specified by:
getClientDnin interfaceIAuthorizationGrant
-
getAuthenticationTime
public Date getAuthenticationTime()
- Specified by:
getAuthenticationTimein interfaceIAuthorizationGrant
-
setAuthenticationTime
public void setAuthenticationTime(Date authenticationTime)
-
getScopes
public Set<String> getScopes()
Returns a list of the scopes granted to the client.- Specified by:
getScopesin interfaceIAuthorizationGrant- Returns:
- List of the scopes granted to the client.
-
getJwtAuthorizationRequest
public JwtAuthorizationRequest getJwtAuthorizationRequest()
- Specified by:
getJwtAuthorizationRequestin interfaceIAuthorizationGrant
-
setJwtAuthorizationRequest
public void setJwtAuthorizationRequest(JwtAuthorizationRequest jwtAuthorizationRequest)
- Specified by:
setJwtAuthorizationRequestin interfaceIAuthorizationGrant
-
setAccessTokens
public void setAccessTokens(List<AccessToken> accessTokens)
- Specified by:
setAccessTokensin interfaceIAuthorizationGrant
-
getRefreshTokens
public List<RefreshToken> getRefreshTokens()
Returns a list with all the issued refresh tokens.- Specified by:
getRefreshTokensin interfaceIAuthorizationGrant- Returns:
- List with all the issued refresh tokens.
-
setRefreshTokens
public void setRefreshTokens(List<RefreshToken> refreshTokens)
- Specified by:
setRefreshTokensin interfaceIAuthorizationGrant
-
getRefreshToken
public RefreshToken getRefreshToken(String refreshTokenCode)
Gets the refresh token instance from the refresh token list given its code.- Specified by:
getRefreshTokenin interfaceIAuthorizationGrant- Parameters:
refreshTokenCode- The code of the refresh token.- Returns:
- The refresh token instance or
nullif not found.
-
getAccessToken
public AbstractToken getAccessToken(String tokenCode)
Gets the access token instance from the id token list or the access token list given its code.- Specified by:
getAccessTokenin interfaceIAuthorizationGrant- Parameters:
tokenCode- The code of the access token.- Returns:
- The access token instance or
nullif not found.
-
-