Closed
Description
Expected Behavior
I was trying to configure my app to use the pagerduty oauth2 provider, I was using the following configuration:
spring:
security:
oauth2:
client:
registration:
pagerduty:
provider: pagerduty
clientId: <redacted>
clientSecret: <redacted>
authorizationGrantType: authorization_code
redirectUri: "{baseUrl}/login/oauth2/code/{registrationId}"
clientAuthenticationMethod: client_secret_post
provider:
pagerduty:
authorizationUri: "https://identity.pagerduty.com/oauth/authorize"
tokenUri: "https://identity.pagerduty.com/oauth/token"
userInfoUri: "https://api.pagerduty.com/users/me"
userNameAttribute: user.email
The pagerduty /me
api returns users with all the interesting properties nested under the user
field, like so:
{
"user": {
"id": ...,
"email": "fancy@pants.com",
I tried setting userNameAttribute: user.email
expecting the name field to be extracted as the name
property on the user
object. But I get an error from DefaultOAuth2User: "Missing attribute 'user.email' in attributes
.
Current Behavior
Ideally a user would successfully be extracted, and login would be successful.
Context
I wound up exposing a custom OAuth2UserService class, but it's 90% of a copy paste of DefaultOAuth2UserService
, and this seems like something that another user info API might reasonably do.