Refactor igx-ts side-nav-auth template to standalone components and angular-auth-oidc-client v21#1554
Refactor igx-ts side-nav-auth template to standalone components and angular-auth-oidc-client v21#1554
Conversation
…t v15 API Co-authored-by: Hristo313 <57346540+Hristo313@users.noreply.github.com>
|
@copilot Remove the -module.ts files and update the template to use standalone structure without breaking the logic |
…andalone structure Co-authored-by: Hristo313 <57346540+Hristo313@users.noreply.github.com>
Done in commit Removed all NgModule files:
|
@copilot The standalone: true is not needed anymore. In user.service you should handle the case when storedUser is "undefined" |
… string in UserService Co-authored-by: Hristo313 <57346540+Hristo313@users.noreply.github.com>
Done in commit
|
| AuthModule.forRoot({ config: [] }) | ||
| ), | ||
| provideAnimations(), | ||
| ExternalAuthService | ||
| provideHttpClient(withInterceptorsFromDi()), | ||
| { provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true }, | ||
| // TODO: DELETE THIS BEFORE PRODUCTION! | ||
| BackendProvider |
There was a problem hiding this comment.
@copilot Don't move all of the previous config of AuthenticationModule into the main app config - it's job was to keep the authentication self-contained. Since we're not working with modules anymore, the modern approach for that would be to wrap the necessary config in something like provideAuthetication() that can be added to the config
There was a problem hiding this comment.
Done in commit 4582360. Created authentication/provide-authentication.ts with a provideAuthentication() function that encapsulates all auth-related providers (OIDC AuthModule, HTTP client with interceptors, JWT interceptor, fake backend). app.config.ts now simply spreads ...provideAuthentication(), keeping the auth setup self-contained.
…ntained Co-authored-by: damyanpetev <3198469+damyanpetev@users.noreply.github.com>
You should also revert the ExternalAuthConfig full logic and use it for google and microsoft as well |
92110a6 to
7198fc6
Compare
6b61921 to
8355531
Compare
|
@copilot Refactor the authentication setup so that provideAuth can receive its configuration from an external source instead of being hardcoded. The idea is to store different provider settings (Google, Microsoft, etc.) in a separate file and pass them in as options when initializing authentication. This makes the setup flexible, reusable, and easier to maintain across environments. |
…accepts configs param Agent-Logs-Url: https://github.com/IgniteUI/igniteui-cli/sessions/cb3cf6b1-325c-4b2e-bbab-f45bec906dd6 Co-authored-by: Hristo313 <57346540+Hristo313@users.noreply.github.com>
Done in commit
To activate Google login, a developer simply edits |
|
@copilot Move the injected logic for adding the third-party providers from the app.ts to the new oidc-config and provide-authentication |
…ion() via ENVIRONMENT_INITIALIZER Agent-Logs-Url: https://github.com/IgniteUI/igniteui-cli/sessions/b9a5e15c-6a51-4921-95a9-c1b3619358b8 Co-authored-by: Hristo313 <57346540+Hristo313@users.noreply.github.com>
Done in commit
|
standalone: truefromProfileandRedirectstoredUser === "undefined"string inUserServiceconstructor; wrapJSON.parsein try/catch to guard against malformed localStorage valuesprovideAuthentication()BaseOidcProviderto acceptconfigId: stringonly;ExternalAuthConfigstripped of dead OIDC-specific fields — now only holdsclient_idandredirect_url(used byFacebookProvider)Redirectreadsdata['provider']directly;ngOnInithas try/catch error handlingOidcConfigLoader;provideAuthentication()usesconfig: [];addGoogle()/addMicrosoft()no longer accept unusedclientIDparameterauthentication/oidc-configs.ts;provideAuthentication()acceptsOpenIdConfiguration[]parameter so configs come from an external source rather than being hardcoded;app.config.tspassesoidcConfigsfrom the new fileaddGoogle(),addMicrosoft(),addFacebook()) fromAppconstructor into anENVIRONMENT_INITIALIZERinsideprovideAuthentication();Appno longer injectsExternalAuthproviders.spec.ts,services.spec.ts,redirect.spec.ts)angular-auth-oidc-clientfrom~15.0.4to~21.0.1(latest stable); replaceimportProvidersFrom(AuthModule.forRoot(...))withprovideAuth(...)inprovide-authentication.ts; subscribe to theObservable<unknown>returned bylogoff()inBaseOidcProviderOriginal prompt
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.