Test an OIDC Application Connection
Number of APIs: 10
To test the execution of an OpenID Connect (OIDC) connection for an application configured in your PingOne environment, you must have a working OIDC identity provider (IdP) for your environment to communicate with.
The easiest way to do this is by using two PingOne environments. You can then execute an authentication flow for an application existing in one PingOne environment by using external authentication as a user in a second PingOne environment acting as the OIDC IdP.
Prerequisites
Get an access token from the worker application that you created in Getting Started with the PingOne APIs. To get a token from a different worker application in an alternate sandbox environment, run the token request endpoint using the client ID and client secret of your chosen worker app to authenticate the request. For more information, see GET a Worker Application Access Token.
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.
A PingOne access token for each environment.
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.
- Initiate an authorization request.
Workflow order of operations
To test the OIDC application connection, 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
POSTrequest to/environments/{{destinationEnvID}}/applications/{{appID}}/signOnPolicyAssignmentsto assign the sign-on policy to the destination OIDC application.Make a
GETrequest to/{{destinationEnvID}}/as/authorizeto retrieve an authorization grant.
Execute the authentication flow
Open a private browser window, and enter the
Locationheader URL that was returned from the/as/authorizecall.Click the button that matches your OIDC IdP connection.
Authenticate as a user in the source environment. Depending on your configuration, you may need to perform account linking or user verification.
You should be able to sign on as a source environment user, indicating that authentication from the source environment to the OIDC IdP in the destination environment is working. After authenticating, you are taken to the redirect_uri of the application in your destination environment.
-
Step 5: Create a sign-on policy for the OIDC IdP POST {{apiPath}}/environments/{{destinationEnvID}}/signOnPolicies
-
Step 1b: Create Destination Environment POST {{apiPath}}/environments
-
Step 3: Read the OIDC application secret GET {{apiPath}}/environments/{{sourceEnvID}}/applications/{{oidcAppSourceID}}/secret
-
Step 4: Create OIDC provider in destination environment POST {{apiPath}}/environments/{{destinationEnvID}}/identityProviders
-
Step 6: Create a sign-on policy action POST {{apiPath}}/environments/{{destinationEnvID}}/signOnPolicies/{{oidcSignonPolicyID}}/actions
-
Step 8: Create an OIDC application in the destination environment POST {{apiPath}}/environments/{{destinationEnvID}}/applications
-
Step 9: Assign the sign-on policy to the destination OIDC application POST {{apiPath}}/environments/{{destinationEnvID}}/applications/{{oidcAppDestinationID}}/signOnPolicyAssignments
-
Step 2: Create an OIDC application in the source environment POST {{apiPath}}/environments/{{sourceEnvID}}/applications
-
Step 7: Set the sign-on policy as the default PUT {{apiPath}}/environments/{{destinationEnvID}}/signOnPolicies/{{oidcSignonPolicyID}}
-
Step 10: Send an authorization request GET {{authPath}}/{{destinationEnvID}}/as/authorize?response_type=code&client_id={{oidcAppDestinationID}}&redirect_uri=https://example.com&scope=openid profile&nonce=123