Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(OAuth2): Migrated OAuth2 configuration to align with Spring Security 5 Java DSL standards #2216

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

rahul-chekuri
Copy link

  • Replaced the legacy security.authn.oauth2 structure with the new spring.security.oauth2.client configuration.
  • Updated property mappings to conform to Spring Security 5's expectations.
  • Ensured compatibility with existing hal config security authn oauth2 edit commands.

Old Configuration that used get populated gate.yml:

security:
  authn:
    oauth2:
      enabled: true
      client:
        clientId: <client-id>
        clientSecret: <client-secret>
        accessTokenUri: https://www.googleapis.com/oauth2/v4/token
        userAuthorizationUri: https://accounts.google.com/o/oauth2/v2/auth
        scope: profile email
      userInfoRequirements:
        hd: <domain>
      resource:
        userInfoUri: https://www.googleapis.com/oauth2/v3/userinfo
      userInfoMapping:
        email: email
        firstName: given_name
        lastName: family_name
      provider: GOOGLE

New Configuration that gets populated in gate.yml (Aligned with Spring Security 5):

spring:
  security:
    oauth2:
      client:
        registration:
          google:
            client-id: <client-id>
            client-secret: <client-secret>
            scope: profile,email
        provider:
          google:
            authorization-uri: https://accounts.google.com/o/oauth2/auth
            token-uri: https://oauth2.googleapis.com/token
            user-info-uri: https://www.googleapis.com/oauth2/v3/userinfo

Commands remain unchanged:

hal config security authn oauth2 edit --provider google --client-id some_id --client-secret some_secret --user-info-requirements hd=company.io

…rity 5 Java DSL standards

- Replaced the legacy `security.authn.oauth2` structure with the new `spring.security.oauth2.client` configuration.
- Updated property mappings to conform to Spring Security 5's expectations.
- Ensured compatibility with existing `hal config security authn oauth2 edit` commands.

**Old Configuration that used get populated gate.yml:**

```
security:
  authn:
    oauth2:
      enabled: true
      client:
        clientId: <client-id>
        clientSecret: <client-secret>
        accessTokenUri: https://www.googleapis.com/oauth2/v4/token
        userAuthorizationUri: https://accounts.google.com/o/oauth2/v2/auth
        scope: profile email
      userInfoRequirements:
        hd: <domain>
      resource:
        userInfoUri: https://www.googleapis.com/oauth2/v3/userinfo
      userInfoMapping:
        email: email
        firstName: given_name
        lastName: family_name
      provider: GOOGLE
```

**New Configuration that gets populated in gate.yml (Aligned with Spring Security 5):**
```
spring:
  security:
    oauth2:
      client:
        registration:
          google:
            client-id: <client-id>
            client-secret: <client-secret>
            scope: profile,email
        provider:
          google:
            authorization-uri: https://accounts.google.com/o/oauth2/auth
            token-uri: https://oauth2.googleapis.com/token
            user-info-uri: https://www.googleapis.com/oauth2/v3/userinfo
```

Commands remain unchanged:

```
hal config security authn oauth2 edit --provider google --client-id some_id --client-secret some_secret --user-info-requirements hd=company.io
```
@spinnakerbot
Copy link
Contributor

The following commits need their title changed:

  • b62f2c2: Add new GateBoot667ProfileFactory that emits the new gate config.

Please format your commit title into the form:

<type>(<scope>): <subject>, e.g. fix(kubernetes): address NPE in status check

This allows us to easily generate changelogs & determine semantic version numbers when cutting releases. You can read more about commit conventions here.

@rahul-chekuri rahul-chekuri force-pushed the oauth2-spring-scrty-5-properties branch from b62f2c2 to 2063e0d Compare April 3, 2025 08:32
…rity 5 Java DSL standards

- Replaced the legacy `security.authn.oauth2` structure with the new `spring.security.oauth2.client` configuration.
- Updated property mappings to conform to Spring Security 5's expectations.
- Ensured compatibility with existing `hal config security authn oauth2 edit` commands.

**Old Configuration that used get populated gate.yml:**

```
security:
  authn:
    oauth2:
      enabled: true
      client:
        clientId: <client-id>
        clientSecret: <client-secret>
        accessTokenUri: https://www.googleapis.com/oauth2/v4/token
        userAuthorizationUri: https://accounts.google.com/o/oauth2/v2/auth
        scope: profile email
      userInfoRequirements:
        hd: <domain>
      resource:
        userInfoUri: https://www.googleapis.com/oauth2/v3/userinfo
      userInfoMapping:
        email: email
        firstName: given_name
        lastName: family_name
      provider: GOOGLE
```

**New Configuration that gets populated in gate.yml (Aligned with Spring Security 5):**
```
spring:
  security:
    oauth2:
      client:
        registration:
          google:
            client-id: <client-id>
            client-secret: <client-secret>
            scope: profile,email
        provider:
          google:
            authorization-uri: https://accounts.google.com/o/oauth2/auth
            token-uri: https://oauth2.googleapis.com/token
            user-info-uri: https://www.googleapis.com/oauth2/v3/userinfo
```

Commands remain unchanged:

```
hal config security authn oauth2 edit --provider google --client-id some_id --client-secret some_secret --user-info-requirements hd=company.io
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants