Class OAuthSecurityImpl

java.lang.Object
org.codice.ddf.cxf.oauth.OAuthSecurityImpl
All Implemented Interfaces:
OAuthSecurity

public class OAuthSecurityImpl extends Object implements OAuthSecurity
  • 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:
      setUserTokenOnClient in interface OAuthSecurity
      Parameters:
      client - Non-null client to set the access token on.
      subject - subject used to get the session ID
      sourceId - 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:
      setUserTokenOnClient in interface OAuthSecurity
      Parameters:
      client - Non-null client to set the access token on.
      sourceId - The ID of the source using OAuth needed to get the correct tokens
      clientId - The client ID registered with the OAuth provider
      clientSecret - The client secret registered with the OAuth provider
      username - The user's username
      password - The user's password
      discoveryUrl - The metadata URL of the OAuth provider
      additionalParameters - 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:
      setSystemTokenOnClient in interface OAuthSecurity
      Parameters:
      client - Non-null client to set the access token on.
      clientId - The client ID registered with the OAuth provider
      clientSecret - The client secret registered with the OAuth provider
      discoveryUrl - the metadata URL of the OAuth provider