Configuring OpenID Connect (OIDC)

Objective

After completing this lesson, you will be able to configure OpenID Connect (OIDC) to verify the identity of an end-user based on the authentication performed by an authorization server.

OIDC

OpenID Connect is a simple identity layer on top of the OAuth 2.0 protocol that allows computing clients to obtain basic information about end users. It specifies a RESTful API using a JSON data format. SAP CDC is a certified openID Connect OP and RP provider.

OpenID Connect is an authentication protocol built on top of the OAuth 2.0 authorization framework. It provides a simple identity layer that allows applications to verify the identity of an end-user based on authentication performed by an authorization server. It also allows computing clients to obtain basic profile information about an end-user. OpenID Connect uses a RESTful HTTP API with a JSON data format.

While OAuth 2.0 handles authorization (what you can access), OIDC handles authentication (who you are). This is an important distinction.

One of OIDC’s core advantages over OAuth 2 is a JSON Web Token (JWT) named ID_Token, which can be returned by our OIDC implementation. SAP Customer Data Cloud supports the Auth Code, Implicit, and Hybrid flows using the response types id_token, token, and code.

Core Components and Terminology

OpenID Connect Provider (OP) – An identity provider that authenticates users and provides claims to Relying Parties. SAP Customer Data Cloud is a certified OP, which allows 3rd party sites (Relying Parties or RPs) to authenticate users against your existing user base.

For information on setting up your OP configuration, see OpenID Provider Setup.

Relying Party (RP) – An OAuth 2.0 client application that requires user authentication from an OP. SAP Customer Data Cloud is also a certified RP.

For information on setting up your RP configuration, see OpenID Connect RP Setup.

Flows – OpenID supports three authentication flows: Authorization Code, Implicit, and Hybrid.

For more information, learn more about OpenID Provider Setup and the OpenID specifications.

Claims – Information about a user, such as a first name or phone number.

Scopes – The type of data RPs can access (standard scopes include openid, email, and profile).

Tokens:

  • Code: Used in the code flow to issue an access token
  • ID Token: A JSON Web Token (JWT) signed by the OP containing user identity information and token metadata, for instance the time it was issued and its expiration time
  • Access Token: Used for authorization (rather than authentication) to grant/deny resource access
  • Refresh Token: Used to generate a new access token

For more information, refer to the OpenID Connect (OIDC) documentation in the SAP Help Portal.

A Complete Picture of OIDC in SAP Customer Data Cloud

The end user, on a phone, tablet, or laptop, accesses one of several Relying Party (RP) sites (CDC Site or others), all of which use OpenID Connect to link to an OpenID Provider (OP) for login and registration using a Gigya database.

SAP Customer Data Cloud provides end-to-end OIDC and OAuth 2.0 implementations, including support for Centralized Login Page (CLP), Single Sign-On (SSO), and Site Groups.

OIDC Flavors for SAP Customer Data Cloud

Diagram shows user accessing an RP (either Customer Data Cloud or other services like Amazon Echo or Alexa), which communicates with an OP (either Customer Data Cloud or another system serving as Identity Provider, such as Microsoft ADFS).

SAP Customer Data Cloud can be used in three different ways:

  • As an RP (for instance,providing screensets and Facebook authentication)
  • As an OP (for instance, Ticket Master might use SAP Customer Data cloud to identify its users)
  • As both (for instance, in the case of multiple data centers)

OIDC Endpoints

The Authorization endpoint is: ttps://fidm.SAP_CDC_Data_Center_ID/oidc/op/v1.0/OP_SITE-APIKey/authorize. Other endpoints use the same url, except that 'authorize' is replaced with 'userinfo', 'token', 'introspect', 'revoke', and 'register'.

Authorization Endpoint: Performs user authentication using request parameters defined by OAuth 2.0 and additional parameters and parameter values defined by OpenID Connect. Returns an authorization code used to request an id_token and access_token from the token endpoint.

Token Endpoint: Issues an access_token, id_token, and refresh_token to the RP. 

UserInfo Endpoint: Provides user profile information.

Introspection Endpoint: Determines the validity status of a current access_token (valid or invalid). If the token is valid, it also returns details, such as its type, the client_id of the entity it was issued to, expiration info, and so on. If the token is invalid, it returns false and no additional information. 

Token Introspection is used to determine the current status of a previously received access token. As an RP, it may be necessary to check whether your access token is still valid.

Claims returned from the Introspect endpoint for a valid access_token are:

  • active - boolean (if false, no other claims are returned)
  • scope
  • client_id
  • token_type
  • exp (expiration time)
  • iat (issued at)
  • sub (subject)
  • aud (audience)
  • iss (issuer)

Construct the request to the introspect endpoint the same as for the token endpoint, using a Basic Auth token.

For more information refer to the OpenID Connect OP Setup documentation in the SAP Help Portal.

Authentication Flow Overview

Diagram showing the flow from the RP to the Gigya OP Authorize Endpoint (Authorize call), then Request to the Partner Proxy page, which checks if user logged in. If not, the Partner Login Page handles login. Then a call is made from the Partner Proxy page to the partner endpoint to invoke server-side logic. The partner endpoint checks if the request is authorized or consented to, and sends a consent token back to the partner proxy page. That page checks if the token is valid. If it is, it notifies the Gygia OP Authorize Endpoint that the user is now logged in. That notification is then mirrored to the RP.

The flow in the above diagram covers the user authentication stage requiring login.

  1. The RP generates the request and sends it to the Authorization endpoint.
  2. The Authorize endpoint redirects to the OP's proxy page.
  3. The Proxy page checks if the user is logged-in.
  4. If not logged in, the user is asked to log in.
  5. It's now certain the user is logged in.
  6. The proxy page redirects to the consentURL (on the partner endpoint).
  7. If consent is required, the user provides consent. The endpoint then validates the authorization.
  8. The consentURL (on the partner endpoint) redirects to the proxy page with the requested information (token/code).
  9. The proxy page validates the token.
  10. If valid, the proxy page redirects to the Authorize endpoint.
  11. The Authorize endpoint redirects back to the RP.

The proxy page points to login, consent, and error pages, which need to be hosted outside of Customer Data Cloud.

Demonstration

The above video demonstrates how to set up OIDC, and explains the code supporting it.

Summary

In this lesson, you have learned that:

  • OpenID Connect is an authentication protocol (verifying "who you are") built on OAuth 2.0, which handles authorization ("what you can access"). OIDC's core advantage is the ID_Token, a JWT containing user identity information.
  • SAP Customer Data Cloud is a certified OpenID Connect Provider (OP) and Relying Party (RP), supporting Authorization Code, Implicit, and Hybrid flows with response types: id_token, token, and code.
  • The OP authenticates users and provides claims to RPs; the RP is the client application requiring authentication. Claims are user information (name, email), while scopes define accessible data types (openid, email, profile).
  • The Authorization endpoint performs user authentication, the Token endpoint issues tokens (access, ID, refresh), the UserInfo endpoint provides profile information, while the Introspection endpoint validates access token status.Set up SAP Customer Data Cloud as an OP by configuring settings that include proxy page URL, implementing login/consent/error pages hosted externally, and defining custom claims and scopes beyond standard ones. The OP must then be activated.
  • Configure SAP Customer Data Cloud as an RP by registering the OP with provider name, client credentials, endpoints (authorization, token, userinfo), scopes, issuer validation, and JSON Web Keys for RSA/RS256 signature verification.