SAML v2.0 Profile for Authorization Grant
The SAML v2.0 Profile for Authorization Grant is designed for environments that want to leverage the REST-based services provided by AM's OAuth 2.0 support, while keeping their existing SAML v2.0 federation implementation.
The RFC 7522 describes the means to use SAML v2.0 bearer assertions to request access tokens and to authenticate OAuth 2.0 clients.
At present, AM implements the profile to request access tokens.
Consider the following requirements before implementing this flow:
The client (the application the resource owner uses to start the flow) must inform the resource owner that, by authenticating to the SAML v2.0 identity provider, the resource owner grants the client access to the protected resources. AM does not present the resource owner with consent pages.
This client must be able to consume the access token and handle errors as required.
The OAuth 2.0 authorization service and SAML v2.0 service provider must be configured in the same AM instance.
The service provider must require that assertions are signed.
The SAML v2.0 identity provider must issue signed assertions.
The assertion must contain the SAML v2.0 entity names, as follows:
The issuer must be set to the identity provider's name. For example,
The audience must be set to the service provider's name. For example,
The identity provider and the service provider must belong to the same circle of trust.
The OAuth 2.0 client is registered, at least, with the following configuration:
The OAuth 2.0 provider is configured. Ensure that:
tokenResponse Type Plugin is configured.
SAML2Supported Grant Type is configured.
The following diagram demonstrates the SAML v2.0 Profile for Authorization Grants:
The steps in the diagram are described below:
The client requests the SAML v2.0 identity provider the SAML v2.0 assertion related to the resource owner. Usually, this means the client redirects the resource owner to the identity provider for authentication.
The SAML v2.0 identity provider returns the signed assertion to the client.
The client includes the assertion and a special grant type in the call to the OAuth 2.0 token endpoint in the following parameters:
Note that the assertion must be first base64-encoded, and then URL encoded.
curl \ --request POST \ --data "client_id=myClient" \ --data "client_secret=forgerock" \ --data-urlencode "assertion=PHNhbWxwOl...ZT4" \ --data "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Asaml2-bearer" \ --data "redirect_uri=https://www.example.com:443/callback" \ --data "scope=write" \ "https://openam.example.com:8443/openam/oauth2/realms/root/access_token"
The AM authorization server validates the assertion. If the assertion is valid, the authorization server returns an access token to the client.
The client request access to the protected resources from the resource server.
The resource server contacts the authorization server to validate the access token.
The authorization server validates the token and responds to the resource server.
If the token is valid, the resource server allows the client to access the protected resources.