8000 chore: adjust auth server endpoints to match server values by ercultimate · Pull Request #20304 · SAP/spartacus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

chore: adjust auth server endpoints to match server values #20304

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

Merged
merged 11 commits into from
May 29, 2025

Conversation

ercultimate
Copy link
Contributor
@ercultimate ercultimate commented May 13, 2025
  • update configured endpoints
  • fix reverted default configuration option
  • fix revoke endpoint error

@ercultimate ercultimate requested a review from a team as a code owner May 13, 2025 13:29
@github-actions github-actions bot marked this pull request as draft May 13, 2025 13:29
@ercultimate ercultimate marked this pull request as ready for review May 15, 2025 15:22
Copy link
cypress bot commented May 15, 2025

spartacus    Run #48532

Run Properties:  status check passed Passed #48532  •  git commit e817643c58 ℹ️: Merge 2f872a8eb223604af39c907441df5bad2f8b7a27 into dbc6ba962f65c13e32aff555d5b9...
Project spartacus
Branch Review feature/CXSPA-9984
Run status status check passed Passed #48532
Run duration 12m 28s
Commit git commit e817643c58 ℹ️: Merge 2f872a8eb223604af39c907441df5bad2f8b7a27 into dbc6ba962f65c13e32aff555d5b9...
Committer Eric Polesky
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 3
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 245
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

@github-actions github-actions bot marked this pull request as draft May 15, 2025 17:17
@ercultimate ercultimate marked this pull request as ready for review May 15, 2025 18:22
Copy link
Contributor

Merge Checks Failed

Please push a commit to re-trigger the build.
To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`

@github-actions github-actions bot marked this pull request as draft May 19, 2025 13:55
@ercultimate ercultimate marked this pull request as ready for review May 19, 2025 14:58
Copy link
Contributor

Merge Checks Failed

Please push a commit to re-trigger the build.
To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`

@ercultimate ercultimate force-pushed the feature/CXSPA-9984 branch from 01de987 to 43c8416 Compare May 23, 2025 16:04
@github-actions github-actions bot marked this pull request as draft May 23, 2025 16:05
@ercultimate ercultimate force-pushed the feature/CXSPA-9984 branch from 43c8416 to 366b841 Compare May 23, 2025 16:07
@ercultimate ercultimate force-pushed the feature/CXSPA-9984 branch from 366b841 to eb78987 Compare May 23, 2025 16:08
@ercultimate ercultimate marked this pull request as ready for review May 23, 2025 18:18
Copy link
Contributor

Merge Checks Failed

Please push a commit to re-trigger the build.
To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`

@github-actions github-actions bot marked this pull request as draft May 23, 2025 18:36
@ercultimate ercultimate marked this pull request as ready for review May 23, 2025 19:04
@@ -52,9 +51,10 @@ export const defaultAuthConfig: AuthConfig = {
customTokenParameters: ['token_type'],
strictDiscoveryDocumentValidation: false,
skipIssuerCheck: true,
disablePKCE: true,
disablePKCE: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think changes in default config values can lead to unexpected behaviour.
Seems to be a breaking change, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This default object is internal, so changes will not affect customers. It is not exported out of the module and is only used when applied in the UserAuthModule. Even this is not strictly true anymore now that we use a temporary provider factory to set the default configuration, but we will eventually return to using the object directly.

The changes to the default object are to reduce ambiguity when the JDK17 authorization server support is dropped.
The default object is set to the "future" JDK21 default, and the provider factory converts the object to match the "legacy" version.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If, in customer's application, customer provided authConfig with only this values (just a dummy example):

 provideConfig(<AuthConfig>{
      authentication: {
        clientId: 'spartacus-spa',
        OAuthLibConfig: {
          strictDiscoveryDocumentValidation: true,
        },
      },
    }),

Customer provided only these values, because the rest values from the default config are suitable for him,
in the result his config will looks like this:

const oAuthConfig = {
  OAuthLibConfig: {
    clearHashAfterLogin: false,
    customTokenParameters: ['token_type'],
    disablePKCE: true,
    oidc: false,
    scope: '',
    skipIssuerCheck: true,
    strictDiscoveryDocumentValidation: true, // From CUSTOM config
  },
  clientId: 'spartacus-spa', // From CUSTOM config
  client_id: 'mobile_android',
  client_secret: 'secret',
  loginUrl: '/oauth/authorize',
  revokeEndpoint: '/oauth/revoke',
  tokenEndpoint: '/oauth/token',
};

Are we sure that changes in the default config that we are doing for 100% cannot affect his application?
Can customer's app broke because of not expected resposeType: code for example?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The factory emits the default configuration exactly as it did before this change. This is proven by the spec test that was added for the factory. The normal merging rules applying, so the customer's property will be merged into the configuration with a higher priority.

The only thing that could break something is the new property sendAuthHeaderOnRevoke conflicting with the customer's custom properties.

Copy link
Contributor
@rmch91 rmch91 May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new property sendAuthHeaderOnRevoke and removal of responseType; - delete config.authentication.OAuthLibConfig.responseType, and changing value of disablePKCE, no?
I can miss the context here, talking more in general about configs, than about this exact case. So if you think that it is safe change - feel free to ignore me

@github-actions github-actions bot marked this pull request as draft May 27, 2025 19:25
/**
* Determine if the `Authorization` header should be sent with revocation requests.
*/
enableTokenRevocationInterceptor?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just nitpicks:

  1. the name of this config describes the implementation (e.g. mentions the concept of interceptor).
    Other config properties are related to the characteristics of the auth standard/process itself.

What do you think about renaming the config property, to rather describe the effect on the auth process?
e.g. shouldSendAuthHeaderOnRevoke

(If only you agree, then let's rename also analogical places, like the method in AuthConfigService)

  1. If this config property is needed only for JDK21, for clarity let's mention this fact also in this the JSDoc of this config property

Copy link
Contributor
@rmch91 rmch91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ercultimate ercultimate marked this pull request as ready for review May 29, 2025 16:05
@ercultimate ercultimate merged commit 516477c into develop May 29, 2025
34 checks passed
@ercultimate ercultimate deleted the feature/CXSPA-9984 branch May 29, 2025 20:27
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.

4 participants
0