Configuring OAuth Clients

Follow the steps to configure OAuth clients using the Backoffice Administration Cockpit or ImpEx.

Context

OAuth client is an application making protected resource requests on behalf of the resource owner and with its authorization. Each client application, such as mobile android client, mobile iOS client, which should have access to resources need to be registered in OAuth authorization server.

Adding OAuth Clients

Context

Follow the steps listed below to add a new OAuth client.

Procedure

  1. Navigate to the OAuth Clients node (Start of the navigation pathSystem Next navigation step OAuth Next navigation step OAuth ClientsEnd of the navigation path).

    On the left you see a list of already created OAuth Clients. Here you can easily manage the clients.

  2. In order to add a new OAuth client click the OAuth Client Details field.

    The editor appears.

  3. In the Essential section, provide< Client ID> and <Client Secret >(an encoded password).
  4. In the Basic section, provide the following values.
    • Authorities: Authorities - List of authorities (roles) that are granted to the OAuth client such as ROLE_CLIENT, ROLE_TRUSTED_CLIENT

    • Authorized Grant Types: Grant types available for client for example: refresh_token, password, authorization_code, client_credentials Grant types decide, which getting token flow can be used by this client. Grant types supported by the authorization server can be configured in <authorization-server> element.

    • Resource Ids : The resource identifiers to which this client can be granted access.

    • Redirect Uri : Redirect Uri allowed for the client in Authorization Code Flow and Implicit Flow

    To enter a particular value, use the plus sign and confirm with Add.

  5. In the Scope section, provide the following values:
    • Scopes: List of scopes to which the client is limited.

    • Auto Approve Scopes: Scopes the Client does not need the User approval for.

  6. In the Token Validity section, provide the following values:
    • Access Token Validity Seconds: The access token validity period in seconds.

    • Refresh Token Validity Seconds: The refresh token validity period in seconds.

  7. A new client is added to the list.

Editing OAuth Clients

Context

Follow the steps listed below to edit an already existing OAuth client.

Procedure

  1. Navigate to Start of the navigation pathSystem Next navigation step OAuth Next navigation step OAuth ClientsEnd of the navigation path.

    On the left you see a list of already created OAuth Clients. Here you can easily manage the clients.

  2. Select the client you want to edit.
  3. Click Save after selected values.

Removing OAuth Clients

Context

Follow the steps listed below to remove an already existing OAuth client.

Procedure

  1. Navigate to Start of the navigation pathSystem Next navigation step OAuth Next navigation step OAuth ClientsEnd of the navigation path.

    On the left you see a list of already created OAuth Clients. Here you can easily manage the clients.

  2. Select the client you want to remove.
  3. Click the bin icon to remove the row. A dialog is displayed for you to confirm the action.

Defining OAuth Clients in an ImpEx File

OAuth clients data are stored in the database using the OAuthClientDetailsModel, so it can be also created using an ImpEx file.

Procedure

  1. Define the OAuth client in the projectdata.impexfile.
    INSERT_UPDATE OAuthClientDetails;clientId[unique=true]    ;resourceIds       ;scope        ;authorizedGrantTypes                                            ;authorities             ;clientSecret    ;registeredRedirectUri
                                    ;client-side              ;hybris            ;basic        ;implicit,client_credentials                                     ;ROLE_CLIENT             ;secret          ;http://localhost:9001/authorizationserver/oauth2_implicit_callback;
                                    ;mobile_android           ;hybris            ;basic        ;authorization_code,refresh_token,password,client_credentials    ;ROLE_CLIENT             ;secret          ;http://localhost:9001/authorizationserver/oauth2_callback;
  2. If you want to add the ROLE_TRUSTED_CLIENT, you will also need to define it in the projectdata.impex file.
    INSERT_UPDATE OAuthClientDetails;clientId[unique=true]    ;resourceIds       ;scope        ;authorizedGrantTypes                                            ;authorities             ;clientSecret    ;registeredRedirectUri 
                                    ;trusted_client           ;hybris            ;extended     ;authorization_code,refresh_token,password,client_credentials    ;ROLE_TRUSTED_CLIENT     ;secret;         ;