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

[Feature Request]: Allow external codeVerifier to be set in angular-auth-oidc-client #1925

Open
riccardi94 opened this issue Apr 12, 2024 · 0 comments

Comments

@riccardi94
Copy link

Is your feature request related to a problem? Please describe.
The current implementation of the angular-auth-oidc-client library automatically generates a codeVerifier within a private method createCodeVerifier, which is not accessible for customization. In my use case, the codeVerifier is provided externally by a backend service. Currently, there is no way to integrate this external codeVerifier due to the method's inaccessibility and lack of extensibility in the library's design.

Describe the solution you'd like
I propose to introduce a way to inject a custom codeVerifier generation strategy into the library. This could be achieved by allowing an externally defined function to be passed as a configuration option, which the library would then use instead of the private createCodeVerifier method. This function should be able to access the necessary context from the OpenIdConfiguration to maintain compatibility with different setups.

Describe alternatives you've considered
Injecting a custom generation strategy would provide the most flexibility and maintain the encapsulation and integrity of the library's architecture.

Additional context
Below is a conceptual example of how this could be implemented:

// Modification to use the injected generator
private createCodeVerifier(configuration: OpenIdConfiguration): string {
  const codeVerifierGenerator = this.configService.getCodeVerifierGenerator();   //This is the injectable service
  const codeVerifier = codeVerifierGenerator ? codeVerifierGenerator(configuration) : this.randomService.createRandom(67, configuration);

  this.storagePersistenceService.write('codeVerifier', codeVerifier, configuration);

  return codeVerifier;
}
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

No branches or pull requests

1 participant