Class BasicRefreshTokenHandler
- java.lang.Object
-
- org.oa4mp.server.loader.oauth2.claims.AbstractPayloadHandler
-
- org.oa4mp.server.loader.oauth2.tokens.BasicRefreshTokenHandler
-
- All Implemented Interfaces:
Serializable,PayloadHandler,RefreshTokenHandlerInterface,OA2Scopes
public class BasicRefreshTokenHandler extends AbstractPayloadHandler implements RefreshTokenHandlerInterface
Created by Jeff Gaynor
on 8/5/20 at 9:18 AM- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.oa4mp.delegation.server.OA2Scopes
OA2Scopes.ScopeUtil
-
-
Field Summary
Fields Modifier and Type Field Description static StringREFRESH_TOKEN_BASIC_HANDLER_TYPEstatic StringREFRESH_TOKEN_DEFAULT_HANDLER_TYPE-
Fields inherited from class org.oa4mp.server.loader.oauth2.claims.AbstractPayloadHandler
client, oa2se, payload, request, transaction
-
Fields inherited from interface org.oa4mp.delegation.server.OA2Scopes
basicScopes, EDU_PERSON_ORC_ID, nonPublicScopes, SCOPE_ADDRESS, SCOPE_CILOGON_INFO, SCOPE_EMAIL, SCOPE_MYPROXY, SCOPE_OFFLINE_ACCESS, SCOPE_OPENID, SCOPE_PHONE, SCOPE_PROFILE, SCOPE_TOKEN_MANAGER, SCOPE_USER_INFO
-
-
Constructor Summary
Constructors Constructor Description BasicRefreshTokenHandler(PayloadHandlerConfigImpl payloadHandlerConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRequestState(edu.uiuc.ncsa.security.util.scripting.ScriptRunRequest req)Marshall any resources this script needs to make a request.voidcheckClaims()Called after the runner has gotten the claims so that this class can check integrity.voidfinish(String execPhase)Called at the very end of all processing, this lets the handler, clean up or whatever it needs to do.org.kordamp.json.JSONObjectgetPayload()The payload for this is the actual token created (payload is the middle of a JWT, e.g.)RefreshTokengetRefreshToken()protected RefreshTokenConfiggetRTConfig()RefreshTokenImplgetSignedPayload(edu.uiuc.ncsa.security.util.jwk.JSONWebKey key)RefreshTokenImplgetSignedPayload(edu.uiuc.ncsa.security.util.jwk.JSONWebKey key, String headerType)Take the payload of this and sign it with the given key, using the header as needed.List<ClaimSource>getSources()These are the sources that the runner will use to populate the claimsvoidhandleResponse(edu.uiuc.ncsa.security.util.scripting.ScriptRunResponse resp)This takes the response from a script and unmarshalls the resourcesvoidinit()Creates and initializes the claims object this class manages.voidrefreshAccountingInformation()This is used on refresh only.voidsaveState(String execPhase)Called at the end of each block, this lets the handler save its state.voidsetAccountingInformation()This sets the accounting information (such as the expiration and such) for a token.voidsetRefreshToken(RefreshToken refreshToken)voidsetRTData(org.kordamp.json.JSONObject rtData)-
Methods inherited from class org.oa4mp.server.loader.oauth2.claims.AbstractPayloadHandler
doServerVariables, doSubstitution, execute, getExtendedAttributes, getPhCfg, getResponseCode, getTXRecord, hasScript, hasTXRecord, isEmpty, listToString, refresh, setExtendedAttributes, setPayload, setPhCfg, setResponseCode
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.oa4mp.delegation.server.jwt.PayloadHandler
execute, getExtendedAttributes, getPhCfg, getResponseCode, hasScript, refresh, setPayload, setPhCfg, setResponseCode
-
-
-
-
Field Detail
-
REFRESH_TOKEN_DEFAULT_HANDLER_TYPE
public static final String REFRESH_TOKEN_DEFAULT_HANDLER_TYPE
- See Also:
- Constant Field Values
-
REFRESH_TOKEN_BASIC_HANDLER_TYPE
public static final String REFRESH_TOKEN_BASIC_HANDLER_TYPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BasicRefreshTokenHandler
public BasicRefreshTokenHandler(PayloadHandlerConfigImpl payloadHandlerConfig)
-
-
Method Detail
-
getRefreshToken
public RefreshToken getRefreshToken()
- Specified by:
getRefreshTokenin interfaceRefreshTokenHandlerInterface
-
setRefreshToken
public void setRefreshToken(RefreshToken refreshToken)
- Specified by:
setRefreshTokenin interfaceRefreshTokenHandlerInterface
-
getPayload
public org.kordamp.json.JSONObject getPayload()
Description copied from interface:PayloadHandlerThe payload for this is the actual token created (payload is the middle of a JWT, e.g.)- Specified by:
getPayloadin interfacePayloadHandler- Returns:
-
setRTData
public void setRTData(org.kordamp.json.JSONObject rtData)
-
getSignedPayload
public RefreshTokenImpl getSignedPayload(edu.uiuc.ncsa.security.util.jwk.JSONWebKey key)
- Specified by:
getSignedPayloadin interfacePayloadHandler
-
getSignedPayload
public RefreshTokenImpl getSignedPayload(edu.uiuc.ncsa.security.util.jwk.JSONWebKey key, String headerType)
Description copied from interface:PayloadHandlerTake the payload of this and sign it with the given key, using the header as needed.- Specified by:
getSignedPayloadin interfacePayloadHandler- Returns:
-
init
public void init() throws ThrowableDescription copied from interface:PayloadHandlerCreates and initializes the claims object this class manages.- Specified by:
initin interfacePayloadHandler- Throws:
Throwable
-
addRequestState
public void addRequestState(edu.uiuc.ncsa.security.util.scripting.ScriptRunRequest req) throws ThrowableDescription copied from interface:PayloadHandlerMarshall any resources this script needs to make a request. I.e., add specific state (if needed) from this handler to theScriptRunRequest.- Specified by:
addRequestStatein interfacePayloadHandler- Throws:
Throwable
-
handleResponse
public void handleResponse(edu.uiuc.ncsa.security.util.scripting.ScriptRunResponse resp) throws ThrowableDescription copied from interface:PayloadHandlerThis takes the response from a script and unmarshalls the resources- Specified by:
handleResponsein interfacePayloadHandler- Overrides:
handleResponsein classAbstractPayloadHandler- Throws:
Throwable
-
checkClaims
public void checkClaims() throws ThrowableDescription copied from interface:PayloadHandlerCalled after the runner has gotten the claims so that this class can check integrity. For instance, an OIDC server would need to see that the subject is set properly. SciTokens needs to check that its scopes (aka resource permissions) were set- Specified by:
checkClaimsin interfacePayloadHandler- Throws:
Throwable
-
getSources
public List<ClaimSource> getSources() throws Throwable
Description copied from interface:PayloadHandlerThese are the sources that the runner will use to populate the claims- Specified by:
getSourcesin interfacePayloadHandler- Returns:
- Throws:
Throwable
-
finish
public void finish(String execPhase) throws Throwable
Description copied from interface:PayloadHandlerCalled at the very end of all processing, this lets the handler, clean up or whatever it needs to do. It is called beforePayloadHandler.saveState(String)()}.- Specified by:
finishin interfacePayloadHandler- Parameters:
execPhase- - the current execution phase.- Throws:
Throwable
-
saveState
public void saveState(String execPhase) throws Throwable
Description copied from interface:PayloadHandlerCalled at the end of each block, this lets the handler save its state. Note that for OA4MP, the state is saved in the transaction which is saved once after the handlers run. Only put actual save code in here if needed, since it is apt to get called a lot.- Specified by:
saveStatein interfacePayloadHandler- Overrides:
saveStatein classAbstractPayloadHandler- Throws:
Throwable
-
getRTConfig
protected RefreshTokenConfig getRTConfig()
-
setAccountingInformation
public void setAccountingInformation()
Description copied from interface:PayloadHandlerThis sets the accounting information (such as the expiration and such) for a token. This is called when a token is created or refreshed.- Specified by:
setAccountingInformationin interfacePayloadHandler
-
refreshAccountingInformation
public void refreshAccountingInformation()
Description copied from interface:PayloadHandlerThis is used on refresh only. It will reset all the standard accounting information (such as timestamps) for an existing claims object.Usage
Create an instance of the handler with the constructor for any state, then invoke this method.- Specified by:
refreshAccountingInformationin interfacePayloadHandler
-
-