You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47-50
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Support for OAuth 2 and OpenId Connect (OIDC) in Angular. Already prepared for t
18
18
19
19
## Breaking Change in Version 9
20
20
21
-
With regards to tree shaking, beginning with version 9, the ``JwksValidationHandler`` has been moved to a library of its own. If you need it for implementing **implicit flow**, please install it using npm:
21
+
With regards to tree shaking, beginning with version 9, the `JwksValidationHandler` has been moved to a library of its own. If you need it for implementing **implicit flow**, please install it using npm:
22
22
23
23
```
24
24
npm i angular-oauth2-oidc-jwks --save
@@ -38,7 +38,6 @@ import { JwksValidationHandler } from 'angular-oauth2-oidc';
38
38
39
39
Please note, that this dependency is not needed for the **code flow**, which is nowadays the **recommended** flow for single page applications. This also results in smaller bundle sizes.
40
40
41
-
42
41
## Tested Environment
43
42
44
43
Successfully tested with **Angular 9** and its Router, PathLocationStrategy as well as HashLocationStrategy and CommonJS-Bundling via webpack. At server side we've used IdentityServer (.NET / .NET Core) and Redhat's Keycloak (Java).
@@ -66,14 +65,14 @@ Successfully tested with **Angular 9** and its Router, PathLocationStrategy as w
66
65
- The issues contain some ideas for PRs and enhancements (see labels)
67
66
- If you want to contribute to the docs, you can do so in the `docs-src` folder. Make sure you update `summary.json` as well. Then generate the docs with the following commands:
68
67
69
-
```sh
68
+
```sh
70
69
npm install -g @compodoc/compodoc
71
70
npm run docs
72
71
```
73
72
74
73
## Features
75
74
76
-
- Logging in via Code Flow + PKCE
75
+
- Logging in via Code Flow + PKCE
77
76
- Hence, you are safe for the upcoming OAuth 2.1
78
77
- Logging in via Implicit Flow (where a user is redirected to Identity Provider)
79
78
- "Logging in" via Password Flow (where a user enters their password into the client)
@@ -90,17 +89,18 @@ Successfully tested with **Angular 9** and its Router, PathLocationStrategy as w
90
89
91
90
You can use the OIDC-Sample-Server used in our examples. It assumes, that your Web-App runs on http://localhost:4200
92
91
93
-
Username/Password:
94
-
- max/geheim
95
-
- bob/bob
96
-
- alice/alice
92
+
Username/Password:
93
+
94
+
- max/geheim
95
+
- bob/bob
96
+
- alice/alice
97
97
98
-
*clientIds:*
98
+
_clientIds:_
99
99
100
100
- spa (Code Flow + PKCE)
101
101
- implicit (implicit flow)
102
102
103
-
*redirectUris:*
103
+
_redirectUris:_
104
104
105
105
- localhost:[4200-4202]
106
106
- localhost:[4200-4202]/index.html
@@ -138,59 +138,58 @@ export class AppModule {
138
138
}
139
139
```
140
140
141
-
# Logging in
141
+
# Logging in
142
142
143
143
Since Version 8, this library supports code flow and [PKCE](https://tools.ietf.org/html/rfc7636) to align with the current draft of the [OAuth 2.0 Security Best Current Practice](https://tools.ietf.org/html/draft-ietf-oauth-security-topics-13) document. This is also the foundation of the upcoming OAuth 2.1.
144
144
145
-
146
145
To configure your solution for code flow + PKCE you have to set the `responseType` to `code`:
147
146
148
-
```TypeScript
149
-
import { AuthConfig } from'angular-oauth2-oidc';
147
+
```TypeScript
148
+
import { AuthConfig } from'angular-oauth2-oidc';
150
149
151
-
exportconst authCodeFlowConfig:AuthConfig= {
152
-
// Url of the Identity Provider
153
-
issuer: 'https://demo.identityserver.io',
150
+
exportconst authCodeFlowConfig:AuthConfig= {
151
+
// Url of the Identity Provider
152
+
issuer: 'https://demo.identityserver.io',
154
153
155
-
// URL of the SPA to redirect the user to after login
If you don't want to display a login form that tells the user that they are redirected to the identity server, you can use the convenience function ``this.oauthService.loadDiscoveryDocumentAndLogin();`` instead of ``this.oauthService.loadDiscoveryDocumentAndTryLogin();`` when setting up the library.
203
+
If you don't want to display a login form that tells the user that they are redirected to the identity server, you can use the convenience function `this.oauthService.loadDiscoveryDocumentAndLogin();` instead of `this.oauthService.loadDiscoveryDocumentAndTryLogin();` when setting up the library.
206
204
207
205
This directly redirects the user to the identity server if there are no valid tokens. Ensure you have your `issuer` set to your discovery document endpoint!
208
206
209
-
210
207
### Calling a Web API with an Access Token
211
208
212
-
You can automate this task by switching ``sendAccessToken`` on and by setting ``allowedUrls`` to an array with prefixes for the respective URLs. Use lower case for the prefixes.
209
+
You can automate this task by switching `sendAccessToken` on and by setting `allowedUrls` to an array with prefixes for the respective URLs. Use lower case for the prefixes.
213
210
214
211
```TypeScript
215
212
OAuthModule.forRoot({
@@ -228,7 +225,7 @@ See docs: https://manfredsteyer.github.io/angular-oauth2-oidc/docs/additional-do
228
225
229
226
## Routing
230
227
231
-
If you use the ``PathLocationStrategy`` (which is on by default) and have a general catch-all-route (``path: '**'``) you should be fine. Otherwise look up the section ``Routing with the HashStrategy`` in the [documentation](https://manfredsteyer.github.io/angular-oauth2-oidc/docs/).
228
+
If you use the `PathLocationStrategy` (which is on by default) and have a general catch-all-route (`path: '**'`) you should be fine. Otherwise look up the section `Routing with the HashStrategy` in the [documentation](https://manfredsteyer.github.io/angular-oauth2-oidc/docs/).
0 commit comments