Spring integration
This quickstart guide covers the essential steps to start integrating Pangea AuthN with Spring .
Create an OAuth client
Create a new OAuth client as described in OAuth Server with the following parameters:
- Grant Types: Authorization Code
- Response Types: Code, Token
- Allowed Redirect URIs:
[origin]/login/oauth2/code/pangea
- Allowed Scopes: openid, profile, email
- Default scopes: openid, profile, email
Note down the client ID (starts with "psa_") and client secret (starts with "pck_") for later.
Set up environment variables
PANGEA_AUTHN_CLIENT_ID=psa_000000
PANGEA_AUTHN_CLIENT_SECRET=pck_111111
PANGEA_AUTHN_HOSTED_LOGIN=https://pdn-222222.login.aws.us.pangea.cloud
Add OAuth2 client dependency
Via Gradle:
implementation "org.springframework.boot:spring-boot-starter-oauth2-client"
Via Maven:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-client</artifactId>
</dependency>
Set up client
# application.yml
pangea:
base-url: ${PANGEA_AUTHN_HOSTED_LOGIN}
spring:
security:
oauth2:
client:
registration:
pangea:
provider: pangea
client-id: ${PANGEA_AUTHN_CLIENT_ID}
client-secret: ${PANGEA_AUTHN_CLIENT_SECRET}
scope:
- openid
- profile
- email
authorization-grant-type: authorization_code
redirect-uri: [origin]/login/oauth2/code/pangea
provider:
pangea:
authorization-uri: ${pangea.base-url}/v1beta/oauth/authorize
token-uri: ${pangea.base-url}/v1beta/oauth/token
user-info-uri: ${pangea.base-url}/v1beta/oauth/userinfo
Was this article helpful?