Open workcontrolgit opened 3 years ago
I wrote a blog to show how to use Ngx-Rocket to create an Angular app and then install/configure OIDC client to support Code Flow PKCE. I thought to share it here.
Secure Angular 11 App with Code Flow PKCE and IdentityServer4
It would be interesting to have such an integration as an option, if you're willing to work on it.
@sinedied - I will be happy to help. How can I contribute to your repo? I have evaluated and integrated two popular Angular OIDC libraries into your starter kit. IHMO, the angular-oauth2-oidc from manfredsteyer is more developer friendly. Below are links to the Angular OIDC libraries and the integration repo/blog I created.
You can have a look at the contribution guide here: https://github.com/ngx-rocket/generator-ngx-rocket/blob/main/CONTRIBUTING.md
If there's not too many changes involved in the existing templates, you could probably add an OIDC option in the new features prompt: https://github.com/ngx-rocket/generator-ngx-rocket/blob/main/generators/app/prompts.js#L116-L152
Or if you think there would be too many changes involved, I was thinking of maybe adding a "recipes" section to this repo, where we could either link to your blog post and example repo or make a quick resume of the main steps involved for OIDC integration.
@sinedied - I like the idea to start with "recipes". There are numerous identity and access management products (ex. identity server, Azure, AWS, Google, Auth0, Okta, etc.) supporting OIDC. Some support authentication only and some support both authentication and authorization. Developers can contribute recipes for platforms they have worked with. The proven recipes can be refactored into extension to your starter kit later on.
That's perfect then, I'll see to create a recipes folder and doc in the repo, so you can add it there.
I'm submitting a...
Current behavior
I have integrated OIDC client from damienbod/angular-auth-oidc-client to support the OpenID Connect Code Flow with PKCE. I need help to define the authentication interface within Ngx-Rocket to work with OIDC library so that it will minimize coding change when upgrading to a new version of ngx-rocket in the future.
Background
I forked the https://github.com/ngx-rocket/starter-kit to https://github.com/workcontrolgit/starter-kit. Then followed the integration instructions from damienbod/angular-auth-oidc-client to add the OIDC client library. At a high level, I made the following code changes
I left the existing auth\authentication.service. and auth\credentials.service. in the code base despite they are no longer in use.
Expected behavior
Please consider creating the interface and abstract classes for Authentication and Credentials. The default implementation can be form-based. Additional identity providers can be added and be configurable.
Examples techniques for define interface and abstract classes: http://dotnetpattern.com/typescript-abstract-class
New set of code to integrate OIDC libary into ngx-rocket
Instead of using the code in ngx-rocket auth\authentication. and auth\credentials., below is a new set of code in auth.service.ts (https://github.com/workcontrolgit/starter-kit/blob/main/src/app/auth/auth.service.ts) referencing the OIDC library
Minimal reproduction of the problem with instructions
Environment
Others: