Skip to content

Latest commit

 

History

History
54 lines (45 loc) · 2.81 KB

File metadata and controls

54 lines (45 loc) · 2.81 KB

PingOne Identity Spring Authorization Client and Resource Owner Example.

Authorization Client

This front-end sample application to test the resource server sample application provided in this repository.

Installation Steps

  1. Add Ping14C spring-boot-sdk artifact to your pom:
    <dependency>
      <groupId>com.pingidentity.samples</groupId>
      <artifactId>spring-boot-sdk</artifactId>
      <version>${sdk.version}</version>
    </dependency>

You may want to add additional dependency to make your application development experience a little more pleasant, like <artifactId>spring-boot-devtools</artifactId> Since we are using Thymeleaf template engine, you can benefit from spring.thymeleaf.cache that controls compiled templates cache to avoid repeatedly parsing template files.

  1. Create a new Ping14C resource with a custom scope called message in Ping14C admin console (click: CONNECTIONS -> Resources).

  2. Create Native or Web application with:

    • Code response type
    • Authorization Code grant type
    • openid and message scopes
    • Client Secret Post token authentication method
    • http://localhost:8080/login/oauth2/code/pingidentity redirect URI
  3. Enable both applications in Ping14C admin console.

  4. Configure your spring application configuration application.yml by replacing all <...> placeholders with the following information:

    • <environment_id> with your environment ID
    • <authorization_code_client_id> with your client id in
    • <authorization_code_client_client_credentials_client_secret> with your client secret
    • (optional) to enable SSL change following properties server.ssl.enabled: true, server.port: 8433 and fill certificate related params:
      • <key store type> the format used for the keystore (i.e PKCS12, JKS file)
      • <path to key> the path to the keystore containing the certificate
      • <key store password> the password used to generate the certificate
      • <key alias> the alias mapped to self-signed certificate
        TIP: "how to create self-signed SSL certificate"
  5. Start the resource server (which location is defined in application.yml ping.resourceServerUrl path):

cd ../resource-server-sample
mvn spring-boot:run

NOTE: The above command starts the resource server on port 8000.

  1. Start your client application:
cd client-sample
mvn spring-boot:run

and browse to: http://localhost:8080/ to login with existing user. After successful login you should be able to get resources of resource server by clicking on "Get some messages?" link.