Sign-on using an External Identity Provider
Number of APIs: 27
This activity shows you how to test the external authentication flow to sign-on using an external identity provider (IdP).
The easiest way to do this is by using two PingOne environments. One environment will act as the service provider (SP) for an OIDC application, while the other environment is used to configure an OIDC identity provider (IdP) connection.
This activity requires completing an internal authentication flow within the external authentication flow, so it's important to take note of which environment should be used to complete each step. On the first use of external authentication, you will need to link accounts. This takes place in step 25 of this activity. After the accounts are linked once, you will not need to link them again and can omit step 25 in the future.
Prerequisites
Get an access token from the worker application that you created in Getting Started with the PingOne APIs.
A destination PingOne environment to act as the service provider (SP) for the OIDC application. You'll use this environment to configure the OIDC IdP connection. Authentication flows in this environment can be configured to allow external authentication.
A source PingOne environment that will act as the OIDC IdP. Users here will be able to complete authentication flows in the destination environment.
Cross-environment admin permissions for the destination and source environments.
This scenario illustrates the following operations supported by the PingOne APIs:
- Create an OIDC application in the source environment.
- Create an OIDC IdP in the destination environment referencing the source application.
- Create a sign-on policy in the destination environment.
- Create a sign-on policy action to enable the sign-on policy for the OIDC IdP connection.
- Set the sign-on policy as the default for the destination environment.
- Create an OIDC application in the destination environment.
- Set the sign-on policy as the default for the destination environment.
- Create a population in the source and destination environments.
- Create users in the source and destination environments.
- Initiate an authorization request.
- Read an external authentication initialization.
- Send an external authentication request.
- Get the flow for an external identity provider.
- Pass in external identity provider credentials for verification.
- Retrieve an authorization code from the authorization server by calling the resume endpoint.
- Call the external authentication callback to get the response from an external identity provider.
- Get the flow and submit credentials for account linking.
- Retrieve an authorization code from the authorization server by calling the resume endpoint.
- Exchange an authorization code for an access token.
Workflow order of operations
To test the external authentication flow to sign-on using an external identity provider, the following tasks must be completed successfully:
Make
POSTrequests to/environmentsto create a source environment and a destination environment.Make a
POSTrequest to/environments/{{sourceEnvID}}/applicationsto create an OIDC application in the source environment.Make a
GETrequest to/environments/{{sourceEnvID}}/applications/{{appID}}/secretto read the OIDC application secret.Make a
POSTrequest to/environments/{{destinationEnvID}}/identityProvidersto create an OIDC IdP in the destination environment.Make a
POSTrequest to/environments/{{destinationEnvID}}/signOnPoliciesto create a sign-on policy for the IdP in the destination environment.Make a
POSTrequest to/environments/{{destinationEnvID}}/signOnPolicies/{{policyID}}/actionsto create a new IDENTIFIER_FIRST sign-on policy action associated with the new sign-on policy.Make a
PUTrequest to/environments/{{destinationEnvID}}/signOnPolicies/{{policyID}}to set the policy as default.Make a
POSTrequest to/environments/{{destinationEnvID}}/applicationsto create an OIDC application in the destination environment.Make a
GETrequest to/environments/{{destinationEnvID}}/applications/{{oidcAppDestinationID}}/secretto read the application secret in the destination.Make a
POSTrequest to/environments/{{destinationEnvID}}/applications/{{appID}}/signOnPolicyAssignmentsto assign the sign-on policy to the destination OIDC application.Make a
POSTrequest to/environments/{{sourceEnvID}}/populationsto create a population in the source environment.Make a
POSTrequest to/environments/{{destinationEnvID}}/populationsto create a population in the destination environment.Make a
POSTrequest to/environments/{{sourceEnvID}}/usersto create a user in the source environment.Make a
POSTrequest to/environments/{{destinationEnvID}}/usersto create a user in the destination environment.Make a
PUTrequest to/environments/{{sourceEnvID}}/users/{{SourceUserID}}/passwordto set the source user's password.Make a
PUTrequest to/environments/{{destinationEnvID}}/users/{{DestinationUserID}}/passwordto set the destination user's password.Make a
GETrequest to/{{destinationEnvID}}/as/authorizeto retrieve an authorization grant.Make a
GETrequest to/{{destinationEnvID}}/rp/authenticate?providerId={{oidcProviderID}}&flowId={{flowID}}to read the external authentication initialization.Make a
GETrequest to/{{sourceEnvID}}/as/authorize?response_type=code&redirect_uri=https://auth.pingone.com/{{destinationEnvID}}/rp/callback/openid_connect&scope=openid&client_id={{oidcAppSourceID}}&nonce={{nonce}}&state={{externalProviderState}}to send the external authorization request to the IdP.Make a
GETrequest to/{{sourceEnvID}}/flows/{{flowID}}to get the flow for the external IdP.Make a
POSTrequest to/{{sourceEnvID}}/flows/{{flowID}}to submit the credentials for the external IdP.Make a
GETrequest to/{{sourceEnvID}}/as/resume?flowId={{flowID}}to call the resume endpoint for the external IdP.Make a
GETrequest to/{{destinationEnvID}}/rp/callback/{{providerType}}?code={{authCode}}&state={{externalProviderState}}&nonce={{nonce}}to call the external authentication callback endpoint and get the response from the external identity provider.Make a
GETrequest to/{{destinationEnvID}}/flows/{{flowID}}to retrieve the flow needed for account linking.Make a
POSTrequest to/{{destinationEnvID}}/flows/{{flowID}}to submit the credentials for account linking.Make a
GETrequest to/{{destinationEnvID}}/as/resume?flowId={{flowID}}to call the resume endpoint.Make a
POSTrequest to/{{destinationEnvID}}/as/tokento retrieve the access token.
-
Step 7: Set the sign-on policy as the default PUT {{apiPath}}/environments/{{destinationEnvID}}/signOnPolicies/{{oidcSignonPolicyID}}
-
Step 1b: Create Destination Environment POST {{apiPath}}/environments
-
Step 2: Create an OIDC application in the source environment POST {{apiPath}}/environments/{{sourceEnvID}}/applications
-
Step 3: Read the OIDC application secret GET {{apiPath}}/environments/{{sourceEnvID}}/applications/{{oidcAppSourceID}}/secret
-
Step 14: Create a destination user POST {{apiPath}}/environments/{{destinationEnvID}}/users
-
Step 15: Set source user password PUT {{apiPath}}/environments/{{sourceEnvID}}/users/{{SourceUserID}}/password
-
Step 16: Set destination user password PUT {{apiPath}}/environments/{{destinationEnvID}}/users/{{DestinationUserID}}/password
-
Step 23: Call the external authentication callback endpoint GET {{authPath}}/{{destinationEnvID}}/rp/callback/{{providerType}}?code={{authCode}}&state={{externalProviderState}}&nonce={{nonce}}
-
Step 4: Create OIDC identity provider in destination environment POST {{apiPath}}/environments/{{destinationEnvID}}/identityProviders
-
Step 5: Create a sign-on policy for the OIDC IdP POST {{apiPath}}/environments/{{destinationEnvID}}/signOnPolicies