org.keycloak.broker.oidc

## Class AbstractOAuth2IdentityProvider<C extends OAuth2IdentityProviderConfig>

- java.lang.Object
- - org.keycloak.broker.provider.AbstractIdentityProvider<C>
  - - org.keycloak.broker.oidc.AbstractOAuth2IdentityProvider<C>

- All Implemented Interfaces:
    IdentityProvider<C>, Provider
  Direct Known Subclasses:
    FacebookIdentityProvider, GitHubIdentityProvider, LinkedInIdentityProvider, OIDCIdentityProvider, StackoverflowIdentityProvider

      public abstract class AbstractOAuth2IdentityProvider<C extends OAuth2IdentityProviderConfig>
      extends AbstractIdentityProvider<C>

  Author:
    Pedro Igor

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `AbstractOAuth2IdentityProvider.Endpoint`

    - ### Nested classes/interfaces inherited from interface org.keycloak.broker.provider.IdentityProvider

      `IdentityProvider.AuthenticationCallback`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `FEDERATED_ACCESS_TOKEN`
    `static String` | `FEDERATED_REFRESH_TOKEN`
    `static String` | `FEDERATED_TOKEN_EXPIRATION`
    `protected static org.jboss.logging.Logger` | `logger`
    `protected static org.codehaus.jackson.map.ObjectMapper` | `mapper`
    `static String` | `OAUTH2_GRANT_TYPE_AUTHORIZATION_CODE`
    `static String` | `OAUTH2_PARAMETER_ACCESS_TOKEN`
    `static String` | `OAUTH2_PARAMETER_CLIENT_ID`
    `static String` | `OAUTH2_PARAMETER_CLIENT_SECRET`
    `static String` | `OAUTH2_PARAMETER_CODE`
    `static String` | `OAUTH2_PARAMETER_GRANT_TYPE`
    `static String` | `OAUTH2_PARAMETER_REDIRECT_URI`
    `static String` | `OAUTH2_PARAMETER_RESPONSE_TYPE`
    `static String` | `OAUTH2_PARAMETER_SCOPE`
    `static String` | `OAUTH2_PARAMETER_STATE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractOAuth2IdentityProvider(C config)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected org.codehaus.jackson.JsonNode` | `asJsonNode(String json)`
    `Object` | `callback(RealmModel realm, IdentityProvider.AuthenticationCallback callback, EventBuilder event)` JAXRS callback endpoint for when the remote IDP wants to callback to keycloak.
    `protected javax.ws.rs.core.UriBuilder` | `createAuthorizationUrl(AuthenticationRequest request)`
    `protected FederatedIdentity` | `doGetFederatedIdentity(String accessToken)`
    `protected String` | `extractTokenFromResponse(String response, String tokenName)`
    `C` | `getConfig()`
    `protected abstract String` | `getDefaultScopes()`
    `protected FederatedIdentity` | `getFederatedIdentity(Map<String,String> notes, String response)`
    `protected String` | `getJsonProperty(org.codehaus.jackson.JsonNode jsonNode, String name)`
    `javax.ws.rs.core.Response` | `handleRequest(AuthenticationRequest request)` Initiates the authentication process by sending an authentication request to an identity provider.
    `javax.ws.rs.core.Response` | `retrieveToken(FederatedIdentityModel identity)` Returns a `Response` containing the token previously stored during the authentication process for a specific user.

    - ### Methods inherited from class org.keycloak.broker.provider.AbstractIdentityProvider

      `close, export, keycloakInitiatedBrowserLogout`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### logger

          protected static final org.jboss.logging.Logger logger

    - #### OAUTH2_GRANT_TYPE_AUTHORIZATION_CODE

          public static final String OAUTH2_GRANT_TYPE_AUTHORIZATION_CODE

      See Also:
        Constant Field Values

    - #### FEDERATED_ACCESS_TOKEN

          public static final String FEDERATED_ACCESS_TOKEN

      See Also:
        Constant Field Values

    - #### FEDERATED_REFRESH_TOKEN

          public static final String FEDERATED_REFRESH_TOKEN

      See Also:
        Constant Field Values

    - #### FEDERATED_TOKEN_EXPIRATION

          public static final String FEDERATED_TOKEN_EXPIRATION

      See Also:
        Constant Field Values

    - #### mapper

          protected static org.codehaus.jackson.map.ObjectMapper mapper

    - #### OAUTH2_PARAMETER_ACCESS_TOKEN

          public static final String OAUTH2_PARAMETER_ACCESS_TOKEN

      See Also:
        Constant Field Values

    - #### OAUTH2_PARAMETER_SCOPE

          public static final String OAUTH2_PARAMETER_SCOPE

      See Also:
        Constant Field Values

    - #### OAUTH2_PARAMETER_STATE

          public static final String OAUTH2_PARAMETER_STATE

      See Also:
        Constant Field Values

    - #### OAUTH2_PARAMETER_RESPONSE_TYPE

          public static final String OAUTH2_PARAMETER_RESPONSE_TYPE

      See Also:
        Constant Field Values

    - #### OAUTH2_PARAMETER_REDIRECT_URI

          public static final String OAUTH2_PARAMETER_REDIRECT_URI

      See Also:
        Constant Field Values

    - #### OAUTH2_PARAMETER_CODE

          public static final String OAUTH2_PARAMETER_CODE

      See Also:
        Constant Field Values

    - #### OAUTH2_PARAMETER_CLIENT_ID

          public static final String OAUTH2_PARAMETER_CLIENT_ID

      See Also:
        Constant Field Values

    - #### OAUTH2_PARAMETER_CLIENT_SECRET

          public static final String OAUTH2_PARAMETER_CLIENT_SECRET

      See Also:
        Constant Field Values

    - #### OAUTH2_PARAMETER_GRANT_TYPE

          public static final String OAUTH2_PARAMETER_GRANT_TYPE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AbstractOAuth2IdentityProvider

          public AbstractOAuth2IdentityProvider(C config)

  - ### Method Detail

    - #### callback

          public Object callback(RealmModel realm,
                        IdentityProvider.AuthenticationCallback callback,
                        EventBuilder event)

      Description copied from interface: `IdentityProvider`
      JAXRS callback endpoint for when the remote IDP wants to callback to keycloak.
      Specified by:
        `callback` in interface `IdentityProvider<C extends OAuth2IdentityProviderConfig>`
      Overrides:
        `callback` in class `AbstractIdentityProvider<C extends OAuth2IdentityProviderConfig>`
      Returns:

    - #### handleRequest

          public javax.ws.rs.core.Response handleRequest(AuthenticationRequest request)

      Description copied from interface: `IdentityProvider`

      Initiates the authentication process by sending an authentication request to an identity provider. This method is called only once during the authentication.

      Depending on how the authentication is performed, this method may redirect the user to the identity provider for authentication. In this case, the response would contain a `Response` that will be used to redirect the user.

      However, if the authentication flow does not require a redirect to the identity provider (eg.: simple challenge/response mechanism), this method may return a response containing a `FederatedIdentity` representing the identity information for an user. In this case, the authentication flow stops.

      Parameters:
        `request` - The initial authentication request. Contains all the contextual information in order to build an authentication request to the identity provider.
      Returns:

    - #### retrieveToken

          public javax.ws.rs.core.Response retrieveToken(FederatedIdentityModel identity)

      Description copied from interface: `IdentityProvider`

      Returns a `Response` containing the token previously stored during the authentication process for a specific user.

      Returns:

    - #### getConfig

          public C getConfig()

      Overrides:
        `getConfig` in class `AbstractIdentityProvider<C extends OAuth2IdentityProviderConfig>`

    - #### extractTokenFromResponse

          protected String extractTokenFromResponse(String response,
                                        String tokenName)

    - #### getFederatedIdentity

          protected FederatedIdentity getFederatedIdentity(Map<String,String> notes,
                                               String response)

    - #### doGetFederatedIdentity

          protected FederatedIdentity doGetFederatedIdentity(String accessToken)

    - #### createAuthorizationUrl

          protected javax.ws.rs.core.UriBuilder createAuthorizationUrl(AuthenticationRequest request)

    - #### getJsonProperty

          protected String getJsonProperty(org.codehaus.jackson.JsonNode jsonNode,
                               String name)

    - #### asJsonNode

          protected org.codehaus.jackson.JsonNode asJsonNode(String json)
                                                      throws IOException

      Throws:
        `IOException`

    - #### getDefaultScopes

          protected abstract String getDefaultScopes()

Copyright © 2015. All rights reserved.