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]: Option for authCheck during app initialization phase #1926

Closed
kyubisation opened this issue Apr 19, 2024 · 0 comments · Fixed by #2006
Closed

[Feature Request]: Option for authCheck during app initialization phase #1926

kyubisation opened this issue Apr 19, 2024 · 0 comments · Fixed by #2006

Comments

@kyubisation
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Currently the OidcSecurityService.checkAuth() is recommended to be called in the AppComponent, which is a sensible default.
However I would prefer to have an option to call it during app initialization (with a provider for APP_INITIALIZER).

Describe the solution you'd like
I would like to have an optional possibility to run the auth check during the app initialization phase.

e.g.

export function withAppInitializerAuthCheck() {
  return {
    provide: APP_INITIALIZER,
    useFactory: (oidcSecurityService: OidcSecurityService) => () =>
      oidcSecurityService.checkAuthMultiple(),
    multi: true,
    deps: [OidcSecurityService],
  };
}

...
provideAuth(authConfig, withAppInitializerAuthCheck()),
...

// or alternatively

export interface PassedInitialConfig {
    config?: OpenIdConfiguration | OpenIdConfiguration[];
    loader?: Provider;
    appInitializerAuthCheck?: boolean;
}

Describe alternatives you've considered
Just use the code above in my apps.

Additional context
I am aware that this is mostly a convenience functionality.
Due to this I am more that willing to contribute the necessary code, if this feature is an acceptable addition and there is agreement on the API.

@kyubisation kyubisation changed the title [Feature Request]: [Feature Request]: Option for authCheck during app initialization phase Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant