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 int
EXCHANGE_ACCESS_TOKEN
static int
EXCHANGE_DEFAULT
static int
EXCHANGE_ID_TOKEN
static int
EXCHANGE_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.JSONObject
exchangeIt(OA2Asset asset, Map<String,String> additionalParameters, boolean isErsatz)
Actual workhorse.net.sf.json.JSONObject
exchangeRefreshToken(OA2Asset asset, 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 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)ATResponse2
getAccessToken(OA2Asset asset, AuthorizationGrant ag)
ATResponse2
getAccessToken(OA2Asset asset, AuthorizationGrant ag, Map<String,Object> additionalParameters)
protected OA2Asset
getAsset2(String id)
protected Map<String,Object>
getATParameters(Asset asset, AuthorizationGrant ag)
This creates the parameter map for the access token request.OA2Asset
getCert(String id)
Note that this requires the identifier, not a token.protected AssetResponse
getCert(Asset a, AuthorizationGrant ag)
Does the actual work getting the cert.AssetResponse
getCert(OA2Asset a, ATResponse2 atResponse2)
String
getRequestedScopes()
Override this if you need to request custom scopes (i.e.edu.uiuc.ncsa.security.servlet.ServiceClient
getRFC8623ServiceClient()
edu.uiuc.ncsa.security.servlet.ServiceClient
getServiceClient()
UserInfo
getUserInfo(String identifier)
net.sf.json.JSONObject
introspect(OA2Asset asset, boolean doRT)
protected void
OLDupdateExchangedAsset(OA2Asset asset, net.sf.json.JSONObject claims)
void
preGetCert(Asset asset, Map parameters)
void
preRequestCert(Asset asset, Map parameters)
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.RTResponse
refresh(String assetID, Map additionalParameters)
boolean
revoke(OA2Asset dummyAsset, boolean revokeRT)
net.sf.json.JSONObject
rfc6749_4_4(OA2Asset asset, Map parameters, boolean useRFC7523)
net.sf.json.JSONObject
rfc7523(OA2Asset asset, Map parameters)
ATResponse2
rfc8628Request(OA2Asset asset, String deviceCode, Map<String,String> additionalParameters)
protected void
updateExchangedAsset(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:
preGetCert
in classOA4MPService
-
getATParameters
protected Map<String,Object> getATParameters(Asset asset, AuthorizationGrant ag)
Description copied from class:AbstractOA4MPService
This creates the parameter map for the access token request. Send along anything specific to the protocol in this map.- Overrides:
getATParameters
in classAbstractOA4MPService
- Returns:
-
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:
preRequestCert
in classOA4MPService
-
getAccessToken
public ATResponse2 getAccessToken(OA2Asset asset, AuthorizationGrant ag, Map<String,Object> additionalParameters)
-
getAccessToken
public ATResponse2 getAccessToken(OA2Asset asset, AuthorizationGrant ag)
-
getCert
public AssetResponse getCert(OA2Asset a, ATResponse2 atResponse2)
-
getCert
protected AssetResponse getCert(Asset a, AuthorizationGrant ag)
Description copied from class:AbstractOA4MPService
Does the actual work getting the cert.- Overrides:
getCert
in classAbstractOA4MPService
- Returns:
-
refresh
public 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 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, 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 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)
-
-