Package io.jans.as.server.model.common
Class AuthorizationGrant
- java.lang.Object
-
- io.jans.as.server.model.common.AbstractAuthorizationGrant
-
- io.jans.as.server.model.common.AuthorizationGrant
-
- All Implemented Interfaces:
IAuthorizationGrant
- Direct Known Subclasses:
AuthorizationCodeGrant
,CIBAGrant
,ClientCredentialsGrant
,DeviceCodeGrant
,ImplicitGrant
,ResourceOwnerPasswordCredentialsGrant
,SimpleAuthorizationGrant
public abstract class AuthorizationGrant extends AbstractAuthorizationGrant
Base class for all the types of authorization grant.- Version:
- September 30, 2021
- Author:
- Javier Rojas Blum, Yuriy Movchan
-
-
Field Summary
-
Fields inherited from class io.jans.as.server.model.common.AbstractAuthorizationGrant
accessTokens, appConfiguration, refreshTokens, scopeChecker
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AuthorizationGrant()
protected
AuthorizationGrant(io.jans.as.common.model.common.User user, AuthorizationGrantType authorizationGrantType, io.jans.as.common.model.registration.Client client, java.util.Date authenticationTime)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TokenEntity
asToken(AccessToken accessToken)
TokenEntity
asToken(AuthorizationCode authorizationCode)
TokenEntity
asToken(IdToken token)
TokenEntity
asToken(RefreshToken token)
TokenEntity
asTokenEntity(AbstractToken token)
void
checkExpiredTokens()
java.lang.String
checkScopesPolicy(java.lang.String scope)
Checks the scopes policy configured according to the type of the authorization grant to limit the issued token scopes.AccessToken
createAccessToken(ExecutionContext context)
java.lang.String
createAccessTokenAsJwt(AccessToken accessToken, ExecutionContext context)
IdToken
createIdToken(java.lang.String nonce, AuthorizationCode authorizationCode, AccessToken accessToken, RefreshToken refreshToken, java.lang.String state, ExecutionContext executionContext)
RefreshToken
createRefreshToken(ExecutionContext context)
RefreshToken
createRefreshToken(ExecutionContext context, int lifetime)
RefreshToken
createRefreshToken(ExecutionContext context, java.util.Date expirationDate)
java.lang.String
getScopesAsString()
java.lang.String
getSub()
void
init(io.jans.as.common.model.common.User user, AuthorizationGrantType authorizationGrantType, io.jans.as.common.model.registration.Client client, java.util.Date authenticationTime)
boolean
isCachedWithNoPersistence()
boolean
isImplicitFlow()
void
persist(AuthorizationCode code)
void
persist(TokenEntity token)
void
revokeAllTokens()
void
save()
Saves changes asynchronouslyvoid
setIsCachedWithNoPersistence(boolean isCachedWithNoPersistence)
-
Methods inherited from class io.jans.as.server.model.common.AbstractAuthorizationGrant
getAccessToken, getAccessTokenLifetimeInSeconds, getAccessTokens, getAccessTokensCodes, getAcrValues, getAuthenticationTime, getAuthorizationCode, getAuthorizationGrantType, getClaims, getClient, getClientDn, getClientId, getCodeChallenge, getCodeChallengeMethod, getGrantId, getIdToken, getJwtAuthorizationRequest, getLongLivedAccessToken, getNonce, getRefreshToken, getRefreshTokens, getRefreshTokensCodes, getScopes, getSessionDn, getTokenBindingHash, getTokenEntity, getUser, getUserDn, getUserId, getX5cs256, setAccessTokens, setAcrValues, setAuthenticationTime, setAuthorizationCode, setClaims, setCodeChallenge, setCodeChallengeMethod, setGrantId, setIdToken, setJwtAuthorizationRequest, setLongLivedAccessToken, setNonce, setRefreshTokens, setScopes, setSessionDn, setTokenBindingHash, setTokenEntity, setX5cs256, toString
-
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
getGrantType
-
-
-
-
Constructor Detail
-
AuthorizationGrant
protected AuthorizationGrant()
-
AuthorizationGrant
protected AuthorizationGrant(io.jans.as.common.model.common.User user, AuthorizationGrantType authorizationGrantType, io.jans.as.common.model.registration.Client client, java.util.Date authenticationTime)
-
-
Method Detail
-
init
public void init(io.jans.as.common.model.common.User user, AuthorizationGrantType authorizationGrantType, io.jans.as.common.model.registration.Client client, java.util.Date authenticationTime)
- Overrides:
init
in classAbstractAuthorizationGrant
-
checkScopesPolicy
public java.lang.String checkScopesPolicy(java.lang.String scope)
Description copied from class:AbstractAuthorizationGrant
Checks the scopes policy configured according to the type of the authorization grant to limit the issued token scopes.- Specified by:
checkScopesPolicy
in interfaceIAuthorizationGrant
- Overrides:
checkScopesPolicy
in classAbstractAuthorizationGrant
- Parameters:
scope
- A space-delimited list of values in which the order of values does not matter.- Returns:
- A space-delimited list of scopes
-
save
public void save()
Description copied from interface:IAuthorizationGrant
Saves changes asynchronously
-
isImplicitFlow
public boolean isImplicitFlow()
-
createAccessToken
public AccessToken createAccessToken(ExecutionContext context)
- Specified by:
createAccessToken
in interfaceIAuthorizationGrant
- Overrides:
createAccessToken
in classAbstractAuthorizationGrant
-
createAccessTokenAsJwt
public java.lang.String createAccessTokenAsJwt(AccessToken accessToken, ExecutionContext context) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createRefreshToken
public RefreshToken createRefreshToken(ExecutionContext context)
- Specified by:
createRefreshToken
in interfaceIAuthorizationGrant
- Overrides:
createRefreshToken
in classAbstractAuthorizationGrant
-
createRefreshToken
public RefreshToken createRefreshToken(ExecutionContext context, int lifetime)
- Specified by:
createRefreshToken
in interfaceIAuthorizationGrant
- Overrides:
createRefreshToken
in classAbstractAuthorizationGrant
-
createRefreshToken
public RefreshToken createRefreshToken(ExecutionContext context, java.util.Date expirationDate)
-
createIdToken
public IdToken createIdToken(java.lang.String nonce, AuthorizationCode authorizationCode, AccessToken accessToken, RefreshToken refreshToken, java.lang.String state, ExecutionContext executionContext)
-
persist
public void persist(TokenEntity token)
-
persist
public void persist(AuthorizationCode code)
-
asToken
public TokenEntity asToken(IdToken token)
-
asToken
public TokenEntity asToken(RefreshToken token)
-
asToken
public TokenEntity asToken(AuthorizationCode authorizationCode)
-
asToken
public TokenEntity asToken(AccessToken accessToken)
-
getScopesAsString
public java.lang.String getScopesAsString()
-
asTokenEntity
public TokenEntity asTokenEntity(AbstractToken token)
-
revokeAllTokens
public void revokeAllTokens()
-
checkExpiredTokens
public void checkExpiredTokens()
-
getSub
public java.lang.String getSub()
-
isCachedWithNoPersistence
public boolean isCachedWithNoPersistence()
-
setIsCachedWithNoPersistence
public void setIsCachedWithNoPersistence(boolean isCachedWithNoPersistence)
-
-