Package org.oa4mp.client.loader
Class OA2MPService
- java.lang.Object
-
- org.oa4mp.client.api.AbstractOA4MPService
-
- org.oa4mp.client.api.OA4MPService
-
- org.oa4mp.client.loader.OA2MPService
-
public class OA2MPService extends OA4MPService
Created by Jeff Gaynor
on 2/21/14 at 2:50 PM
-
-
Field Summary
Fields Modifier and Type Field Description static intEXCHANGE_ACCESS_TOKENstatic intEXCHANGE_DEFAULTstatic intEXCHANGE_ID_TOKENstatic intEXCHANGE_REFRESH_TOKEN-
Fields inherited from class org.oa4mp.client.api.AbstractOA4MPService
BASE64_URI_CAPUT, SKIN_PARAMETER
-
-
Constructor Summary
Constructors Constructor Description OA2MPService(ClientEnvironment environment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected net.sf.json.JSONObjectexchangeIt(OA2Asset asset, Map<String,String> additionalParameters, boolean isErsatz)Actual workhorse.net.sf.json.JSONObjectexchangeRefreshToken(OA2Asset asset, org.oa4mp.delegation.common.token.impl.TokenImpl subjectToken, Map additionalParameters, int requestedTokenType, String subjectType, boolean isErsatz)Use this to either just get a new refresh token (getAT = false) or to use the refresh token to get a new access token (most usual case).protected org.oa4mp.delegation.common.token.impl.TokenImplfigureOutToken(String rawToken, boolean isRT)Note that NO verification is done for this!ATResponse2getAccessToken(OA2Asset asset, org.oa4mp.delegation.common.token.AuthorizationGrant ag)ATResponse2getAccessToken(OA2Asset asset, org.oa4mp.delegation.common.token.AuthorizationGrant ag, Map<String,Object> additionalParameters)protected OA2AssetgetAsset2(String id)protected Map<String,Object>getATParameters(Asset asset, org.oa4mp.delegation.common.token.AuthorizationGrant ag)OA2AssetgetCert(String id)Note that this requires the identifier, not a token.protected AssetResponsegetCert(Asset a, org.oa4mp.delegation.common.token.AuthorizationGrant ag)AssetResponsegetCert(OA2Asset a, ATResponse2 atResponse2)StringgetRequestedScopes()Override this if you need to request custom scopes (i.e. those not in the basic OA4MP specification) for a server.edu.uiuc.ncsa.security.servlet.ServiceClientgetRFC8623ServiceClient()edu.uiuc.ncsa.security.servlet.ServiceClientgetServiceClient()UserInfogetUserInfo(String identifier)net.sf.json.JSONObjectintrospect(OA2Asset asset, boolean doRT)protected voidOLDupdateExchangedAsset(OA2Asset asset, net.sf.json.JSONObject claims)voidpreGetCert(Asset asset, Map parameters)voidpreRequestCert(Asset asset, Map parameters)org.oa4mp.delegation.client.request.RTResponserefresh(String identifier)This will take the identifier and make the necessary calls to the service to update the refresh token and access token.org.oa4mp.delegation.client.request.RTResponserefresh(String assetID, Map additionalParameters)booleanrevoke(OA2Asset dummyAsset, boolean revokeRT)net.sf.json.JSONObjectrfc6749_4_4(OA2Asset asset, Map parameters, boolean useRFC7523)net.sf.json.JSONObjectrfc7523(OA2Asset asset, Map parameters)ATResponse2rfc8628Request(OA2Asset asset, String deviceCode, Map<String,String> additionalParameters)protected voidupdateExchangedAsset(OA2Asset asset, net.sf.json.JSONObject claims)-
Methods inherited from class org.oa4mp.client.api.OA4MPService
postGetCert, postRequestCert
-
Methods inherited from class org.oa4mp.client.api.AbstractOA4MPService
getAssetParameters, getAssetProvider, getAssetStore, getCert, getEnvironment, getNextKeyPair, makeb64Uri, requestCert, requestCert, requestCert, requestCert, requestCert, setAssetProvider
-
-
-
-
Field Detail
-
EXCHANGE_ID_TOKEN
public static final int EXCHANGE_ID_TOKEN
- See Also:
- Constant Field Values
-
EXCHANGE_ACCESS_TOKEN
public static final int EXCHANGE_ACCESS_TOKEN
- See Also:
- Constant Field Values
-
EXCHANGE_REFRESH_TOKEN
public static final int EXCHANGE_REFRESH_TOKEN
- See Also:
- Constant Field Values
-
EXCHANGE_DEFAULT
public static final int EXCHANGE_DEFAULT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OA2MPService
public OA2MPService(ClientEnvironment environment)
-
-
Method Detail
-
preGetCert
public void preGetCert(Asset asset, Map parameters)
- Overrides:
preGetCertin classOA4MPService
-
getATParameters
protected Map<String,Object> getATParameters(Asset asset, org.oa4mp.delegation.common.token.AuthorizationGrant ag)
- Overrides:
getATParametersin classAbstractOA4MPService
-
getRequestedScopes
public String getRequestedScopes()
Override this if you need to request custom scopes (i.e. those not in the basic OA4MP specification) for a server. This returns a blank delimited list of scopes, e.g. "openid email profile". Note that if you override this method, and the server id OIDC, then the openid scope must always be included or the server will refuse to service the request. The basic operation is to take the basic scopes for the OA4MP OIDC spec and add any that are specified in the configuration file in the "scopes" element.- Returns:
-
rfc8628Request
public ATResponse2 rfc8628Request(OA2Asset asset, String deviceCode, Map<String,String> additionalParameters)
-
preRequestCert
public void preRequestCert(Asset asset, Map parameters)
- Overrides:
preRequestCertin classOA4MPService
-
getAccessToken
public ATResponse2 getAccessToken(OA2Asset asset, org.oa4mp.delegation.common.token.AuthorizationGrant ag, Map<String,Object> additionalParameters)
-
getAccessToken
public ATResponse2 getAccessToken(OA2Asset asset, org.oa4mp.delegation.common.token.AuthorizationGrant ag)
-
getCert
public AssetResponse getCert(OA2Asset a, ATResponse2 atResponse2)
-
getCert
protected AssetResponse getCert(Asset a, org.oa4mp.delegation.common.token.AuthorizationGrant ag)
- Overrides:
getCertin classAbstractOA4MPService
-
refresh
public org.oa4mp.delegation.client.request.RTResponse refresh(String identifier)
This will take the identifier and make the necessary calls to the service to update the refresh token and access token. This returns the asset or null if no such asset exists.- Parameters:
identifier-
-
refresh
public org.oa4mp.delegation.client.request.RTResponse refresh(String assetID, Map additionalParameters)
-
getCert
public OA2Asset getCert(String id)
Note that this requires the identifier, not a token.- Parameters:
id-- Returns:
-
exchangeRefreshToken
public net.sf.json.JSONObject exchangeRefreshToken(OA2Asset asset, org.oa4mp.delegation.common.token.impl.TokenImpl subjectToken, Map additionalParameters, int requestedTokenType, String subjectType, boolean isErsatz)
Use this to either just get a new refresh token (getAT = false) or to use the refresh token to get a new access token (most usual case).- Parameters:
asset-subjectToken-additionalParameters-requestedTokenType-- Returns:
-
exchangeIt
protected net.sf.json.JSONObject exchangeIt(OA2Asset asset, Map<String,String> additionalParameters, boolean isErsatz)
Actual workhorse. Takes the token and the type then does the exchange. This updates the asset and returns then entire response fromm the server.- Parameters:
asset-additionalParameters-- Returns:
-
getServiceClient
public edu.uiuc.ncsa.security.servlet.ServiceClient getServiceClient()
-
getRFC8623ServiceClient
public edu.uiuc.ncsa.security.servlet.ServiceClient getRFC8623ServiceClient()
-
updateExchangedAsset
protected void updateExchangedAsset(OA2Asset asset, net.sf.json.JSONObject claims)
-
figureOutToken
protected org.oa4mp.delegation.common.token.impl.TokenImpl figureOutToken(String rawToken, boolean isRT)
Note that NO verification is done for this! It will take a raw string and a flag and return a token (access or refresh)- Parameters:
rawToken-isRT-- Returns:
-
OLDupdateExchangedAsset
protected void OLDupdateExchangedAsset(OA2Asset asset, net.sf.json.JSONObject claims)
-
revoke
public boolean revoke(OA2Asset dummyAsset, boolean revokeRT)
-
introspect
public net.sf.json.JSONObject introspect(OA2Asset asset, boolean doRT)
-
rfc6749_4_4
public net.sf.json.JSONObject rfc6749_4_4(OA2Asset asset, Map parameters, boolean useRFC7523)
-
-