Package org.codice.ddf.cxf.oauth
Class OAuthSecurityImpl
java.lang.Object
org.codice.ddf.cxf.oauth.OAuthSecurityImpl
- All Implemented Interfaces:
OAuthSecurity
-
Field Summary
Fields inherited from interface org.codice.ddf.cxf.oauth.OAuthSecurity
OAUTH -
Constructor Summary
ConstructorsConstructorDescriptionOAuthSecurityImpl(org.codice.ddf.security.token.storage.api.TokenStorage tokenStorage) -
Method Summary
Modifier and TypeMethodDescriptionvoidsetSystemTokenOnClient(org.apache.cxf.jaxrs.client.Client client, String clientId, String clientSecret, String discoveryUrl) Gets the system's access token from the token storage to set it to the OAUTH header.voidsetUserTokenOnClient(org.apache.cxf.jaxrs.client.Client client, ddf.security.Subject subject, String sourceId) Gets the user's access token from the token storage to set it to the OAUTH header.voidsetUserTokenOnClient(org.apache.cxf.jaxrs.client.Client client, String sourceId, String clientId, String clientSecret, String username, String password, String discoveryUrl, Map<String, String> additionalParameters) Gets the user's access token from the token storage to set it to the OAUTH header.
-
Constructor Details
-
OAuthSecurityImpl
public OAuthSecurityImpl(org.codice.ddf.security.token.storage.api.TokenStorage tokenStorage)
-
-
Method Details
-
setUserTokenOnClient
public void setUserTokenOnClient(org.apache.cxf.jaxrs.client.Client client, ddf.security.Subject subject, String sourceId) Gets the user's access token from the token storage to set it to the OAUTH header. Used when a source is configured to use Authentication Code flow/grant.- Specified by:
setUserTokenOnClientin interfaceOAuthSecurity- Parameters:
client- Non-null client to set the access token on.subject- subject used to get the session IDsourceId- the id of the source using OAuth needed to get the correct tokens
-
setUserTokenOnClient
public void setUserTokenOnClient(org.apache.cxf.jaxrs.client.Client client, String sourceId, String clientId, String clientSecret, String username, String password, String discoveryUrl, Map<String, String> additionalParameters) Gets the user's access token from the token storage to set it to the OAUTH header. If one is not available, make a call to the OAuth provider to get tokens. Used when a source is configured to use Resource Owner Password Credentials flow/grant.- Specified by:
setUserTokenOnClientin interfaceOAuthSecurity- Parameters:
client- Non-null client to set the access token on.sourceId- The ID of the source using OAuth needed to get the correct tokensclientId- The client ID registered with the OAuth providerclientSecret- The client secret registered with the OAuth providerusername- The user's usernamepassword- The user's passworddiscoveryUrl- The metadata URL of the OAuth provideradditionalParameters- Additional queryParameters to send to the OAuth provider
-
setSystemTokenOnClient
public void setSystemTokenOnClient(org.apache.cxf.jaxrs.client.Client client, String clientId, String clientSecret, String discoveryUrl) Gets the system's access token from the token storage to set it to the OAUTH header. If one can not be found, retrieves the system's access token from the configured OAuth provider. Used when a source is configured to use Client Credentials flow/grant.- Specified by:
setSystemTokenOnClientin interfaceOAuthSecurity- Parameters:
client- Non-null client to set the access token on.clientId- The client ID registered with the OAuth providerclientSecret- The client secret registered with the OAuth providerdiscoveryUrl- the metadata URL of the OAuth provider
-