Orchestration SDKs

Step 2. Configure connection properties

PingOne Advanced Identity Cloud PingAM iOS


In this step, you configure the "swiftui-journey-module" sample app to connect to your PingOne Advanced Identity Cloud or PingAM instance, complete an authentication journey, and use the OAuth 2.0 client to obtain an Access Token.

  1. In Xcode, on the File menu, click Open…​.

  2. Navigate to the sdk-sample-apps folder you cloned in the previous step, navigate to iOS > swiftui-journey-module > JourneyModuleSample, select JourneyModuleSample.xcodeproj, and then click Open.

  3. In the Project Navigator pane, navigate to JourneyModuleSample > JourneyModuleSample > ViewModels, and open the JourneyViewModel file.

    The file contains a Journey module configuration section:

    public let journey = Journey.createJourney { config in
        config.serverUrl = "https://your-server.example.com/am"
        config.realm = "your-realm"
        config.cookie = "your-cookie-name"
        config.module(PingJourney.OidcModule.config) { oidcValue in
            oidcValue.clientId = "your-client-id"
            oidcValue.scopes = "[SCOPES]"
            oidcValue.redirectUri = "yourapp://callback"
            oidcValue.discoveryEndpoint = "https://your-server.example.com/am/oauth2/your-realm/.well-known/openid-configuration"
        }
    }
  4. Update the configuration block with the details of your server environment.

    serverUrl

    The URL of the server to connect to, including the deployment path of the Access Management component.

    Identity Cloud example:

    https://openam-forgerock-sdks.forgeblocks.com/am

    Self-hosted example:

    https://openam.example.com:8443/openam

    realm

    The realm in which the OAuth 2.0 client profile and authentication journeys are configured.

    Usually, root for AM and alpha or bravo for Advanced Identity Cloud.

    cookie

    The name of the cookie that contains the session token.

    For example, with a self-hosted PingAM server this value might be iPlanetDirectoryPro.

    PingOne Advanced Identity Cloud tenants use a random alpha-numeric string.

    To locate the cookie name in an PingOne Advanced Identity Cloud tenant, navigate to Tenant settings > Global Settings, and copy the value of the Cookie property.

    clientId

    The client ID of your OAuth 2.0 application in PingOne Advanced Identity Cloud or PingAM.

    For example, sdkPublicClient

    scopes

    The scopes you added to your OAuth 2.0 application in PingOne Advanced Identity Cloud.

    For example, "openid", "email", "address", "profile", "phone"

    redirectUri

    The redirect URI or sign-in URL as configured in the OAuth 2.0 client profile.

    This value must exactly match a value configured in your OAuth 2.0 client.

    For example, com.example.demo://oauth2redirect.

    discoveryEndpoint

    The .well-known endpoint from your server.

    How do I find my PingOne Advanced Identity Cloud .well-known URL?

    You can view the .well-known endpoint for an OAuth 2.0 client in the PingOne Advanced Identity Cloud admin console:

    1. Log in to your PingOne Advanced Identity Cloud administration console.

    2. Click Applications, and then select the OAuth 2.0 client you created earlier. For example, sdkPublicClient.

    3. On the Sign On tab, in the Client Credentials section, copy the Discovery URI value.

      For example, https://openam-forgerock-sdks.forgeblocks.com/am/oauth2/alpha/.well-known/openid-configuration

    If you are using a custom domain, your .well-known is formed as follows:

    https://<custom-domain-fqdn>/.well-known/openid-configuration

    How do I find my PingAM .well-known URL?

    To form the .well-known URL for an PingAM server, concatenate the following information into a single URL:

    1. The base URL of the PingAM component of your deployment, including the port number and deployment path.

      For example, https://openam.example.com:8443/openam

    2. The string /oauth2

    3. The hierarchy of the realm that contains the OAuth 2.0 client.

      You must specify the entire hierarchy of the realm, starting at the Top Level Realm. Prefix each realm in the hierarchy with the realms/ keyword.

      For example, /realms/root/realms/customers

      If you omit the realm hierarchy, the top level ROOT realm is used by default.

    4. The string /.well-known/openid-configuration

    For example, https://openam-forgerock-sdks.forgeblocks.com/am/oauth2/realms/alpha/.well-known/openid-configuration

    The result will resemble the following:

    public let journey = Journey.createJourney { config in
        config.serverUrl = "https://openam-forgerock-sdks.forgeblocks.com/am"
        config.realm = "alpha"
        config.cookie = "ch15fefc5407912"
        config.module(PingJourney.OidcModule.config) { oidcValue in
            oidcValue.clientId = "sdkPublicClient"
            oidcValue.scopes = ["openid", "email", "address", "profile", "phone"]
            oidcValue.redirectUri = "com.example.demo://oauth2redirect"
            oidcValue.discoveryEndpoint = "https://openam-forgerock-sdks.forgeblocks.com/am/oauth2/realms/alpha/.well-known/openid-configuration"
        }
    }
  5. Save your changes.

With the sample configured, you can proceed to Step 3. Test the app.