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: CHANGELOG.md
+7-20
Original file line number
Diff line number
Diff line change
@@ -2,26 +2,13 @@
2
2
3
3
## Lates features
4
4
5
-
See [Release Notes](https://github.com/manfredsteyer/angular-oauth2-oidc/releases)
5
+
See [Release Notes](https://github.com/manfredsteyer/angular-oauth2-oidc/releases) for details on each release.
6
6
7
-
## New Features in Version 2.1
8
-
- New Config API (the original one is still supported)
9
-
- New convenience methods in OAuthService to streamline default tasks:
10
-
-``setupAutomaticSilentRefresh()``
11
-
-``loadDiscoveryDocumentAndTryLogin()``
12
-
- Single Sign out through Session Status Change Notification according to the OpenID Connect Session Management specs. This means, you can be notified when the user logs out using at the login provider.
13
-
- Possibility to define the ValidationHandler, the Config as well as the OAuthStorage via DI
14
-
- Better structured documentation
7
+
## Older versions
15
8
16
-
## New Features in Version 2
17
-
- Token Refresh for Implicit Flow by implementing "silent refresh"
18
-
- Validating the signature of the received id_token
19
-
- Providing Events via the observable ``events``.
20
-
- The event ``token_expires`` can be used together with a silent refresh to automatically refresh a token when/ before it expires (see also property ``timeoutFactor``).
9
+
Since Angular 5, versions of this library matched up with the Angular version.
10
+
So versions 5.x were released while Angular 5 was out, the 6.x versions during Angular 6, etc.
11
+
If you need to support a specific old version of Angular, you can consider using a version of the library that lines up.
21
12
22
-
## Breaking Changes in Version 2
23
-
- The property ``oidc`` defaults to ``true``.
24
-
- If you are just using oauth2, you have to set ``oidc`` to ``false``. Otherwise, the validation of the user profile will fail!
25
-
- By default, ``sessionStorage`` is used. To use ``localStorage`` call method setStorage
26
-
- Demands using https as OIDC and OAuth2 relay on it. This rule can be relaxed using the property ``requireHttps``, e. g. for local testing.
27
-
- Demands that every url provided by the discovery document starts with the issuer's url. This can be relaxed by using the property ``strictDiscoveryDocumentValidation``.
13
+
For older release notes check the repository version history, or above-linked release notes.
14
+
For even older versions, check out [the old change log](https://github.com/manfredsteyer/angular-oauth2-oidc/blob/5d676101c6118d6fa01bfa05b17fb4a58490eaf7/CHANGELOG.md).
Copy file name to clipboardExpand all lines: README.md
+70-34
Original file line number
Diff line number
Diff line change
@@ -7,21 +7,23 @@ Support for OAuth 2 and OpenId Connect (OIDC) in Angular.
7
7
## Credits
8
8
9
9
-[generator-angular2-library](https://github.com/jvandemo/generator-angular2-library) for scaffolding an Angular library
10
-
-[jsrasign](https://kjur.github.io/jsrsasign/)until version 5: For validating token signature and for hashing; beginning with version 6, we are using browser APIs to minimize our bundle size
11
-
-[Identity Server](https://github.com/identityserver)(used for testing with an .NET/.NET Core Backend)
10
+
-[jsrasign](https://kjur.github.io/jsrsasign/)for validating token signature and for hashing
11
+
-[Identity Server](https://github.com/identityserver) for testing with an .NET/.NET Core Backend
12
12
-[Keycloak (Redhat)](http://www.keycloak.org/) for testing with Java
Successfully tested with **Angular 7** 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).
22
+
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).
23
+
24
+
**Angular 8**: Use 8.x versions of this library.
25
+
26
+
**Angular 7**: Use 7.x versions of this library.
25
27
26
28
**Angular 6**: Use Version 4.x of this library. Version 4.x was tested with Angular 6. You can also try the newer version 5.x of this library which has a much smaller bundle size.
27
29
@@ -30,21 +32,23 @@ Successfully tested with **Angular 7** and its Router, PathLocationStrategy as w
30
32
## Release Cycle
31
33
32
34
- We plan one major release for each Angular version
33
-
- Will contain new features
34
-
- Will contain bug fixes and PRs
35
+
- Will contain new features
36
+
- Will contain bug fixes and PRs
35
37
- Critical Bugfixes on demand
36
38
37
39
## Contributions
40
+
38
41
- Feel free to file pull requests
39
42
- The closed issues contain some ideas for PRs and enhancements (see labels)
40
43
- 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:
41
44
42
-
```
45
+
```sh
43
46
npm install -g @compodoc/compodoc
44
47
npm run docs
45
48
```
46
49
47
-
# Features
50
+
## Features
51
+
48
52
- Logging in via Implicit Flow (where a user is redirected to Identity Provider)
49
53
- Logging in via Code Flow + PKCE
50
54
- "Logging in" via Password Flow (where a user enters their password into the client)
@@ -58,22 +62,24 @@ Successfully tested with **Angular 7** and its Router, PathLocationStrategy as w
58
62
59
63
## Sample-Auth-Server
60
64
61
-
You can use the OIDC-Sample-Server mentioned in the samples for Testing. It assumes, that your Web-App runs on http://localhost:8080.
65
+
You can use the OIDC-Sample-Server mentioned in the samples for Testing. It assumes, that your Web-App runs on http://localhost:8080
@@ -215,9 +220,47 @@ The following snippet contains the template for the login page:
215
220
216
221
### Skipping the Login Form
217
222
218
-
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.
223
+
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.
224
+
225
+
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!
226
+
219
227
220
-
This directly redirects the user to the identity server if there are no valid tokens.
228
+
#### Manually skipping
229
+
230
+
This is sort of what ``this.oauthService.loadDiscoveryDocumentAndLogin();`` is doing under the hood. But this gives you a fair bit more control
231
+
232
+
```TypeScript
233
+
this.oauthService
234
+
.loadDiscoveryDocumentAndTryLogin(/* { your LoginOptions }*/) // checks to see if the current url contains id token and access token
235
+
.(hasReceivedTokens=> {
236
+
// this would have stored all the tokens needed
237
+
if (hasReceivedTokens) {
238
+
// carry on with your app
239
+
returnPromise.resolve();
240
+
241
+
/* if you wish to do something when the user receives tokens from the identity server,
242
+
* use the event stream or the `onTokenReceived` callback in LoginOptions.
// may want to check if you were previously authenticated
248
+
if (this.oauthService.hasValidAccessToken() &&this.oauthService.hasValidIdToken()) {
249
+
returnPromise.resolve();
250
+
} else {
251
+
// to safe guard this from progressing through the calling promise,
252
+
// resolve it when it directed to the sign up page
253
+
returnnewPromise(resolve=> {
254
+
this.oauthService.initLoginFlow();
255
+
// example if you are using explicit flow
256
+
this.window.addEventListener('unload', () => {
257
+
resolve(true);
258
+
});
259
+
});
260
+
}
261
+
}
262
+
})
263
+
```
221
264
222
265
223
266
### Calling a Web API with an Access Token
@@ -253,16 +296,9 @@ See the [documentation](https://manfredsteyer.github.io/angular-oauth2-oidc/docs
253
296
254
297
## Tutorials
255
298
256
-
*[Tutorial with Demo Servers available online](https://www.softwarearchitekt.at/post/2016/07/03/authentication-in-angular-2-with-oauth2-oidc-and-guards-for-the-newest-new-router-english-version.aspx)
257
-
*[Angular Authentication with OpenID Connect and Okta in 20 Minutes](https://developer.okta.com/blog/2017/04/17/angular-authentication-with-oidc)
258
-
*[Add Authentication to Your Angular PWA](https://developer.okta.com/blog/2017/06/13/add-authentication-angular-pwa)
259
-
*[Build an Ionic App with User Authentication](https://developer.okta.com/blog/2017/08/22/build-an-ionic-app-with-user-authentication)
-[Tutorial with Demo Servers available online](https://www.softwarearchitekt.at/post/2016/07/03/authentication-in-angular-2-with-oauth2-oidc-and-guards-for-the-newest-new-router-english-version.aspx)
300
+
-[Angular Authentication with OpenID Connect and Okta in 20 Minutes](https://developer.okta.com/blog/2017/04/17/angular-authentication-with-oidc)
301
+
-[Add Authentication to Your Angular PWA](https://developer.okta.com/blog/2017/06/13/add-authentication-angular-pwa)
302
+
-[Build an Ionic App with User Authentication](https://developer.okta.com/blog/2017/08/22/build-an-ionic-app-with-user-authentication)
0 commit comments