OpenID Connect (OAuth 2) Overview
Overview
This page provides a broad overview of how OpenID Connect and OAuth 2 are implemented.
Terminology
IdP / OP: Identity Provider / OpenID Provider. Refers to this Cloud SSO product and, indirectly, iMIS – which is always the IdP.
RP: Relying Party. Refers to the third party that has an app registration and is using the SSO.
Redirect URI(s): One or more fully-qualified URLs that must be whitelisted in the client application settings, in order for the OpenID server to know which URL(s) are safe to redirect to. Multiple values, including dev/test/non-public servers, and
localhost
, are supported. This value is always provided by the third party system / library.code / auth code: A short alphanumeric code passed from the IdP to the RP, good for 60 seconds, that can be exchanged for an access token.
access token: An alphanumeric token that can be used to determine if a user is signed in, and retrieve their profile information.
id token: A JWT token (encoded JSON object) that represents information about the current sign in, including the username of the user, the website that made the request, the website that issued the token, when the token expires, and more.
refresh token: An alphanumeric token that can be passed to the
/openid/token
endpoint in order to renew an access token that is about to expire. A new access token is returned, and the expiration is extended. A token can be refreshed at any time. If a token is refreshed, the old access token will no longer work.
Discovery Document
Certain OpenID Connect clients, including CSI's Cloud SSO app, support a discovery document. This JSON document contains all supported URLs and operations by this Cloud SSO app / OpenID Connect implementation.
The discovery document URL is always: https://{sso.example.org}/.well-known/openid-configuration
Endpoint List
The following endpoints are available with the Cloud SSO app. These endpoints satisfy various OpenID and OAuth 2.0 protocol requirements.
All endpoints are prefixed with your base URL, that is typically https://sso.example.org/ or https://auth.exmaple.org/.
Endpoint | Relative Path | Description | Reference Document |
---|---|---|---|
Authorization | /openid/authenticate | Used as the SSO initiation / starting endpoint. Redirecting to this endpoint with the proper parameters will cause an Open ID authentication/authorization flow, and will eventually redirect back to the supplied | RFC 6749 (OAuth 2.0) |
Token | /openid/token | Used to exchange a temporary auth code or a refresh token for an access token. | RFC 6749 (OAuth 2.0) |
User Info | /openid/userinfo | Used to retrieve information about the current user, given an access token. | |
Introspection | /openid/token/introspection | Used to provide information about the token, including if it is active or not, given an access token or a refresh token. | RFC 7662 (OAuth 2.0) |
Revocation | /openid/token/revoke | Used to revoke an active access token or refresh token, causing it to become inactive. | RFC 7009 (OAuth 2.0) |
Sign Out | /openid/signout | Used to sign the user out, and revoke the access token. |
Primary Endpoint Details
Parameter types:
QS: A query string value in the request URL
Header: A value passed in via the specified HTTP header
Form: A value passed as the body of the POST request, with a
Content-Type
ofapplication/x-www-form-urlencoded
.
HTTP | Endpoint | Parameters | Returns |
---|---|---|---|
GET | /openid/authenticate | [QS] | 302 Redirect: 400 Bad Request: application/json error: Contains the error code. |
POST | /openid/token | [Header] | 200 OK: application/json access_token: A random string that can be used for subsequent requests, e.g. to the /userinfo endpoint. 400 Bad Request: application/json error: Contains the error code. |
GET | /openid/userinfo | [Header] | 200 OK: application/json JSON properties are represented by the user's profile data that was returned from the IQA. |
POST | /openid/token | [Form] | 200 OK: application/json access_token: A random string that can be used for subsequent requests, e.g. to the /userinfo endpoint. 400 Bad Request: application/json error: Contains the error code. |
GET | /openid/signout | [QS] | 302 Redirect: |
Secondary Endpoint Details
For information on the introspection and revocation endpoints, please refer to RFC 7662 and RFC 7009, respectively.
Code Flow Overview / Steps
User requests a secure page on the RP's website or app, and is not already signed in.
RP redirects to SSO authentication page.
IdP handles authentication (if the user is not already signed in) and authorization (if the user has not already granted consent and the grace period has not expired).
IdP redirects to the
redirect_uri
provided in the original request, providing acode
in the URL which is good for 60 seconds.RP makes a server-side request to the
/openid/token
endpoint, sending thecode
that was returned from the SSO redirect above.IdP repsonds with an auth token, and optionally, an id token.
Optionally, IdP requests profile information via the
/openid/userinfo
endpoint, passing in the auth token as a bearer token for authenticating this request.
Differences from Standard OAuth Implementations
In this implementation, the Cloud SSO can only be used to verify that a user is signed in, and retrieve their profile information. It cannot be used to grant access to query the iMIS database or access the iMIS REST API.
Access tokens that are returned via this Cloud SSO service can be used to retrieve the user's profile information for as long as token is valid. Tokens can be refreshed using the refresh_token
value. Tokens can be inspected using the introspection endpoint, and revoked using the revocation endpoint.
Because of this, the access token can be used and stored as the authentication mechanism at the third party (via cookies or session variables). Operations that are supported on access tokens include:
Extending the life of the access token by refreshing it (using the
refresh_token
value)Revoking an access token (signing a user out)
Checking if an access token is valid (not expired or revoked)
Viewing the username that is associated with an access or refresh token