Skip to content

Commit 9152719

Browse files
author
SESA469345
committed
Merge remote-tracking branch 'original/master'
2 parents 4e00ba6 + 3c70008 commit 9152719

File tree

169 files changed

+11682
-6208
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+11682
-6208
lines changed

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Add files here to ignore them from prettier formatting
2+
3+
/dist
4+
/coverage

.prettierrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

CHANGELOG.md

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,37 @@
1-
# Change Log
1+
# Changelog
22

3-
## Lates features
3+
## 9.1.0 (2020-03-23)
44

5-
See [Release Notes](https://github.com/manfredsteyer/angular-oauth2-oidc/releases) for details on each release.
65

7-
## Older versions
6+
### Features
87

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.
8+
* **automatic silent refresh:** stopAutomaticRefresh stops all timers. ([8ab853b](https://github.com/manfredsteyer/angular-oauth2-oidc/commit/8ab853bf38dd162060d7b6cbd18f7b4fd5a84f18))
9+
* **code-flow:** allow using silent refresh by setting useSilentRefresh to true ([93902a5](https://github.com/manfredsteyer/angular-oauth2-oidc/commit/93902a5808bb9b75a41d4bde44c6ab763bcfa9f6))
10+
* **sample:** Also use new Identity Server 4 for implicit flow demo to prevent issues with same site cookies ([58c6354](https://github.com/manfredsteyer/angular-oauth2-oidc/commit/58c63541bc7d83d72c30577da2b68ac2d1dc35b7))
11+
* **session checks:** Session checks work now for code flow too. Please see docs for details. ([4bf8901](https://github.com/manfredsteyer/angular-oauth2-oidc/commit/4bf89014d8cc5d50ed716500e3f3ad265b4ae2db))
1212

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).
13+
14+
### Bug Fixes
15+
16+
* **code flow:** Fixed code flow for IE 11 ([0f03d39](https://github.com/manfredsteyer/angular-oauth2-oidc/commit/0f03d393aac9fe4e26444a73884dd154318d530f))
17+
* **sample:** use hash-based routing ([3f44eca](https://github.com/manfredsteyer/angular-oauth2-oidc/commit/3f44ecae157305c56ae377fcd6d2df8dfde8adf5))
18+
* **session state:** save session_state also when using code flow ([8fa99ff](https://github.com/manfredsteyer/angular-oauth2-oidc/commit/8fa99ff721ea2b08f28bc5e9fa3e48a459e2a59a))
19+
* **state:** passing an url with a querystring as the state, e. g. url?x=1 ([71b705c](https://github.com/manfredsteyer/angular-oauth2-oidc/commit/71b705cb5105f6dfb49aabc55607745b881c5dc3))
20+
* [#687](https://github.com/manfredsteyer/angular-oauth2-oidc/issues/687) ([e2599e0](https://github.com/manfredsteyer/angular-oauth2-oidc/commit/e2599e071307ae1efe1592c83bb3b7a01642a61d))
21+
* missing HttpModule dependency ([7eac8ae](https://github.com/manfredsteyer/angular-oauth2-oidc/commit/7eac8ae5cd1fd549f3933c30790f4b802c2c09f0))
22+
* run tokensetup outside ngzone ([07bb62d](https://github.com/manfredsteyer/angular-oauth2-oidc/commit/07bb62d06abb84ef2da010977d07bfd2a3805b16))
23+
* typo ([3d331f2](https://github.com/manfredsteyer/angular-oauth2-oidc/commit/3d331f2166340db43f0aaca42ce8abc4913cd027))
24+
25+
### Pull Requests
26+
- Update sample app and silent-refresh.html script #755, linjie997
27+
- Add optional state parameter for logout, pmccloghrylaing
28+
- fix customHashFragment usage in tryLoginCodeFlow, roblabat
29+
- replace document with injectionToken #741, d-moos
30+
- Support predefined custom parameters extraction from the TokenResponse, vdveer
31+
- Fixed not working silent refresh when using 'code' #735, ErazerBrecht
32+
33+
### Thanks
34+
35+
Big Thanks to all contributers: Brecht Carlier, Daniel Moos, Jie Lin, Manfred Steyer, Phil McCloghry-Laing, robin labat, vdveer
36+
37+
Also, big thanks to jeroenheijmans for doing an awesome job with moderating and analyzing the issues!

README.md

Lines changed: 85 additions & 53 deletions
Large diffs are not rendered by default.

angular.json

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
"projects/lib/tsconfig.lib.json",
3030
"projects/lib/tsconfig.spec.json"
3131
],
32-
"exclude": [
33-
"**/node_modules/**"
34-
]
32+
"exclude": ["**/node_modules/**"]
3533
}
3634
}
3735
}
@@ -131,9 +129,7 @@
131129
"projects/sample/tsconfig.app.json",
132130
"projects/sample/tsconfig.spec.json"
133131
],
134-
"exclude": [
135-
"**/node_modules/**"
136-
]
132+
"exclude": ["**/node_modules/**"]
137133
}
138134
}
139135
}
@@ -159,9 +155,7 @@
159155
"projects/quickstart-demo/src/favicon.ico",
160156
"projects/quickstart-demo/src/assets"
161157
],
162-
"styles": [
163-
"projects/quickstart-demo/src/styles.css"
164-
],
158+
"styles": ["projects/quickstart-demo/src/styles.css"],
165159
"scripts": []
166160
},
167161
"configurations": {
@@ -219,9 +213,7 @@
219213
"projects/quickstart-demo/src/favicon.ico",
220214
"projects/quickstart-demo/src/assets"
221215
],
222-
"styles": [
223-
"projects/quickstart-demo/src/styles.css"
224-
],
216+
"styles": ["projects/quickstart-demo/src/styles.css"],
225217
"scripts": []
226218
}
227219
},
@@ -233,9 +225,7 @@
233225
"projects/quickstart-demo/tsconfig.spec.json",
234226
"projects/quickstart-demo/e2e/tsconfig.json"
235227
],
236-
"exclude": [
237-
"**/node_modules/**"
238-
]
228+
"exclude": ["**/node_modules/**"]
239229
}
240230
},
241231
"e2e": {
@@ -281,9 +271,7 @@
281271
"projects/angular-oauth2-oidc-jwks/tsconfig.lib.json",
282272
"projects/angular-oauth2-oidc-jwks/tsconfig.spec.json"
283273
],
284-
"exclude": [
285-
"**/node_modules/**"
286-
]
274+
"exclude": ["**/node_modules/**"]
287275
}
288276
}
289277
}
@@ -297,4 +285,4 @@
297285
"cli": {
298286
"analytics": false
299287
}
300-
}
288+
}

commitlint.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* To check all configuration options, please visit
3+
* https://commitlint.js.org/#/reference-rules
4+
*/
5+
module.exports = {
6+
extends: ['@commitlint/config-conventional'],
7+
};

contributors.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx github-contributors-list --repo angular-oauth2-oidc --owner manfredsteyer

contributors.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[<img alt="dirkbolte" src="https://avatars2.githubusercontent.com/u/1572945?v=4&s=117" width="117">](https://github.com/dirkbolte)[<img alt="wdunn001" src="https://avatars0.githubusercontent.com/u/4011100?v=4&s=117" width="117">](https://github.com/wdunn001)[<img alt="roblabat" src="https://avatars3.githubusercontent.com/u/9885738?v=4&s=117" width="117">](https://github.com/roblabat)[<img alt="drobert-bfm" src="https://avatars0.githubusercontent.com/u/28102639?v=4&s=117" width="117">](https://github.com/drobert-bfm)[<img alt="mike-rivera" src="https://avatars0.githubusercontent.com/u/57490323?v=4&s=117" width="117">](https://github.com/mike-rivera)
2+
3+
[<img alt="luciimon" src="https://avatars3.githubusercontent.com/u/9714755?v=4&s=117" width="117">](https://github.com/luciimon)[<img alt="killzoner" src="https://avatars2.githubusercontent.com/u/3322938?v=4&s=117" width="117">](https://github.com/killzoner)[<img alt="filipvh" src="https://avatars3.githubusercontent.com/u/6095002?v=4&s=117" width="117">](https://github.com/filipvh)[<img alt="darbio" src="https://avatars0.githubusercontent.com/u/517620?v=4&s=117" width="117">](https://github.com/darbio)[<img alt="akkaradej" src="https://avatars3.githubusercontent.com/u/2855965?v=4&s=117" width="117">](https://github.com/akkaradej)
4+
5+
[<img alt="Gimly" src="https://avatars0.githubusercontent.com/u/168669?v=4&s=117" width="117">](https://github.com/Gimly)[<img alt="vadjs" src="https://avatars1.githubusercontent.com/u/10026333?v=4&s=117" width="117">](https://github.com/vadjs)[<img alt="srenatus" src="https://avatars3.githubusercontent.com/u/870638?v=4&s=117" width="117">](https://github.com/srenatus)[<img alt="SpazzMarticus" src="https://avatars0.githubusercontent.com/u/5716457?v=4&s=117" width="117">](https://github.com/SpazzMarticus)[<img alt="scttcper" src="https://avatars3.githubusercontent.com/u/1400464?v=4&s=117" width="117">](https://github.com/scttcper)
6+
7+
[<img alt="ryanmwright" src="https://avatars2.githubusercontent.com/u/5000122?v=4&s=117" width="117">](https://github.com/ryanmwright)[<img alt="RubenVermeulen" src="https://avatars2.githubusercontent.com/u/10133445?v=4&s=117" width="117">](https://github.com/RubenVermeulen)[<img alt="MrJustreborn" src="https://avatars0.githubusercontent.com/u/11594586?v=4&s=117" width="117">](https://github.com/MrJustreborn)[<img alt="akehir" src="https://avatars2.githubusercontent.com/u/1078202?v=4&s=117" width="117">](https://github.com/akehir)[<img alt="pmccloghrylaing" src="https://avatars3.githubusercontent.com/u/2329335?v=4&s=117" width="117">](https://github.com/pmccloghrylaing)
8+
9+
[<img alt="peterneave" src="https://avatars0.githubusercontent.com/u/7982708?v=4&s=117" width="117">](https://github.com/peterneave)[<img alt="bechhansen" src="https://avatars2.githubusercontent.com/u/426810?v=4&s=117" width="117">](https://github.com/bechhansen)[<img alt="hellerbarde" src="https://avatars0.githubusercontent.com/u/37417?v=4&s=117" width="117">](https://github.com/hellerbarde)[<img alt="OskarsPakers" src="https://avatars1.githubusercontent.com/u/3343347?v=4&s=117" width="117">](https://github.com/OskarsPakers)[<img alt="oleersoy" src="https://avatars3.githubusercontent.com/u/1163873?v=4&s=117" width="117">](https://github.com/oleersoy)
10+
11+
[<img alt="l1b3r" src="https://avatars2.githubusercontent.com/u/6207227?v=4&s=117" width="117">](https://github.com/l1b3r)[<img alt="nhumblot" src="https://avatars1.githubusercontent.com/u/15015617?v=4&s=117" width="117">](https://github.com/nhumblot)[<img alt="mdaehnert" src="https://avatars0.githubusercontent.com/u/1017301?v=4&s=117" width="117">](https://github.com/mdaehnert)[<img alt="anbiniyar" src="https://avatars1.githubusercontent.com/u/407653?v=4&s=117" width="117">](https://github.com/anbiniyar)[<img alt="anoordende" src="https://avatars0.githubusercontent.com/u/11973801?v=4&s=117" width="117">](https://github.com/anoordende)
12+
13+
[<img alt="ArsProgramma" src="https://avatars1.githubusercontent.com/u/4572729?v=4&s=117" width="117">](https://github.com/ArsProgramma)[<img alt="bobvandevijver" src="https://avatars1.githubusercontent.com/u/1835343?v=4&s=117" width="117">](https://github.com/bobvandevijver)[<img alt="ErazerBrecht" src="https://avatars2.githubusercontent.com/u/6287467?v=4&s=117" width="117">](https://github.com/ErazerBrecht)[<img alt="Chris3773" src="https://avatars1.githubusercontent.com/u/22506071?v=4&s=117" width="117">](https://github.com/Chris3773)[<img alt="ChristianMurphy" src="https://avatars3.githubusercontent.com/u/3107513?v=4&s=117" width="117">](https://github.com/ChristianMurphy)
14+
15+
[<img alt="enterprisebug" src="https://avatars1.githubusercontent.com/u/1539741?v=4&s=117" width="117">](https://github.com/enterprisebug)[<img alt="mpbalmeida" src="https://avatars3.githubusercontent.com/u/516102?v=4&s=117" width="117">](https://github.com/mpbalmeida)[<img alt="dorianweidler" src="https://avatars1.githubusercontent.com/u/10262731?v=4&s=117" width="117">](https://github.com/dorianweidler)[<img alt="FabienDehopre" src="https://avatars3.githubusercontent.com/u/97023?v=4&s=117" width="117">](https://github.com/FabienDehopre)[<img alt="MisterJames" src="https://avatars3.githubusercontent.com/u/1197383?v=4&s=117" width="117">](https://github.com/MisterJames)
16+
17+
[<img alt="JessePreiner" src="https://avatars3.githubusercontent.com/u/3847360?v=4&s=117" width="117">](https://github.com/JessePreiner)[<img alt="jesusbotella" src="https://avatars2.githubusercontent.com/u/4319728?v=4&s=117" width="117">](https://github.com/jesusbotella)[<img alt="saxicek" src="https://avatars2.githubusercontent.com/u/1708442?v=4&s=117" width="117">](https://github.com/saxicek)[<img alt="lukasmatta" src="https://avatars3.githubusercontent.com/u/4323927?v=4&s=117" width="117">](https://github.com/lukasmatta)[<img alt="Maximaximum" src="https://avatars2.githubusercontent.com/u/5593500?v=4&s=117" width="117">](https://github.com/Maximaximum)
18+
19+
[<img alt="mraible" src="https://avatars3.githubusercontent.com/u/17892?v=4&s=117" width="117">](https://github.com/mraible)[<img alt="jeroenhinfi" src="https://avatars3.githubusercontent.com/u/38323074?v=4&s=117" width="117">](https://github.com/jeroenhinfi)[<img alt="dennisameling" src="https://avatars1.githubusercontent.com/u/17739158?v=4&s=117" width="117">](https://github.com/dennisameling)[<img alt="tpeter1985" src="https://avatars0.githubusercontent.com/u/16336536?v=4&s=117" width="117">](https://github.com/tpeter1985)[<img alt="StefanoChiodino" src="https://avatars1.githubusercontent.com/u/1428893?v=4&s=117" width="117">](https://github.com/StefanoChiodino)
20+
21+
[<img alt="gingters" src="https://avatars2.githubusercontent.com/u/755148?v=4&s=117" width="117">](https://github.com/gingters)[<img alt="remiburtin" src="https://avatars0.githubusercontent.com/u/4236675?v=4&s=117" width="117">](https://github.com/remiburtin)[<img alt="paulyoder" src="https://avatars3.githubusercontent.com/u/224111?v=4&s=117" width="117">](https://github.com/paulyoder)[<img alt="marvinosswald" src="https://avatars1.githubusercontent.com/u/1621844?v=4&s=117" width="117">](https://github.com/marvinosswald)[<img alt="martin1cerny" src="https://avatars1.githubusercontent.com/u/773078?v=4&s=117" width="117">](https://github.com/martin1cerny)
22+
23+
[<img alt="ManuelRauber" src="https://avatars0.githubusercontent.com/u/740791?v=4&s=117" width="117">](https://github.com/ManuelRauber)[<img alt="jfyne" src="https://avatars1.githubusercontent.com/u/400281?v=4&s=117" width="117">](https://github.com/jfyne)[<img alt="linjie997" src="https://avatars3.githubusercontent.com/u/23615368?v=4&s=117" width="117">](https://github.com/linjie997)[<img alt="jdgeier" src="https://avatars2.githubusercontent.com/u/949299?v=4&s=117" width="117">](https://github.com/jdgeier)[<img alt="enricodeleo" src="https://avatars1.githubusercontent.com/u/3534555?v=4&s=117" width="117">](https://github.com/enricodeleo)
24+
25+
[<img alt="adematte" src="https://avatars1.githubusercontent.com/u/5064637?v=4&s=117" width="117">](https://github.com/adematte)[<img alt="adrianbenjuya" src="https://avatars2.githubusercontent.com/u/17908930?v=4&s=117" width="117">](https://github.com/adrianbenjuya)[<img alt="ismcagdas" src="https://avatars1.githubusercontent.com/u/4133525?v=4&s=117" width="117">](https://github.com/ismcagdas)[<img alt="maxisam" src="https://avatars2.githubusercontent.com/u/456807?v=4&s=117" width="117">](https://github.com/maxisam)[<img alt="Razzeee" src="https://avatars2.githubusercontent.com/u/5943908?v=4&s=117" width="117">](https://github.com/Razzeee)
26+
27+
[<img alt="nhance" src="https://avatars3.githubusercontent.com/u/602226?v=4&s=117" width="117">](https://github.com/nhance)[<img alt="fmalcher" src="https://avatars1.githubusercontent.com/u/1683147?v=4&s=117" width="117">](https://github.com/fmalcher)[<img alt="artnim" src="https://avatars1.githubusercontent.com/u/414375?v=4&s=117" width="117">](https://github.com/artnim)[<img alt="ajpierson" src="https://avatars3.githubusercontent.com/u/56389?v=4&s=117" width="117">](https://github.com/ajpierson)[<img alt="Toxicable" src="https://avatars3.githubusercontent.com/u/13490925?v=4&s=117" width="117">](https://github.com/Toxicable)
28+
29+
[<img alt="vdveer" src="https://avatars2.githubusercontent.com/u/1217814?v=4&s=117" width="117">](https://github.com/vdveer)[<img alt="jeroenheijmans" src="https://avatars1.githubusercontent.com/u/1590536?v=4&s=117" width="117">](https://github.com/jeroenheijmans)[<img alt="manfredsteyer" src="https://avatars1.githubusercontent.com/u/1573728?v=4&s=117" width="117">](https://github.com/manfredsteyer)
30+
31+

docs-src/implicit-flow.md

Lines changed: 2 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
## Configuring for Implicit Flow
22

3-
This section shows how to implement login leveraging implicit flow. This is the OAuth2/OIDC flow best suitable for
4-
Single Page Application. It sends the user to the Identity Provider's login page. After logging in, the SPA gets tokens.
5-
This also allows for single sign on as well as single sign off.
3+
This section shows how to implement login leveraging implicit flow. This is the OAuth2/OIDC flow which was originally intended for Single Page Application.
64

7-
To configure the library, the following sample uses the new configuration API introduced with Version 2.1.
8-
Hence, the original API is still supported.
5+
Meanwhile using **Code Flow** instead is a **best practice** and with OAuth 2.1 implicit flow will be **deprecated***.
96

107
```TypeScript
118
import { AuthConfig } from 'angular-oauth2-oidc';
@@ -107,87 +104,3 @@ The following snippet contains the template for the login page:
107104
</div>
108105
```
109106

110-
## Refreshing when using Implicit Flow (not Code Flow!)
111-
112-
To refresh your tokens when using implicit flow you can use a silent refresh. This is a well-known solution that compensates the fact that implicit flow does not allow for issuing a refresh token. It uses a hidden iframe to get another token from the auth server. When the user is there still logged in (by using a cookie) it will respond without user interaction and provide new tokens.
113-
114-
To use this approach, setup a redirect uri for the silent refresh.
115-
116-
For this, you can set the property silentRefreshRedirectUri in the config object:
117-
118-
```TypeScript
119-
// This api will come in the next version
120-
121-
import { AuthConfig } from 'angular-oauth2-oidc';
122-
123-
export const authConfig: AuthConfig = {
124-
125-
// Url of the Identity Provider
126-
issuer: 'https://steyer-identity-server.azurewebsites.net/identity',
127-
128-
// URL of the SPA to redirect the user to after login
129-
redirectUri: window.location.origin + '/index.html',
130-
131-
// URL of the SPA to redirect the user after silent refresh
132-
silentRefreshRedirectUri: window.location.origin + '/silent-refresh.html',
133-
134-
// The SPA's id. The SPA is registerd with this id at the auth-server
135-
clientId: 'spa-demo',
136-
137-
// set the scope for the permissions the client should request
138-
// The first three are defined by OIDC. The 4th is a usecase-specific one
139-
scope: 'openid profile email voucher',
140-
}
141-
```
142-
143-
As an alternative, you can set the same property directly with the OAuthService:
144-
145-
```TypeScript
146-
this.oauthService.silentRefreshRedirectUri = window.location.origin + "/silent-refresh.html";
147-
```
148-
149-
Please keep in mind that this uri has to be configured at the auth-server too.
150-
151-
This file is loaded into the hidden iframe after getting new tokens. Its only task is to send the received tokens to the main application:
152-
153-
```HTML
154-
<html>
155-
<body>
156-
<script>
157-
window.parent.postMessage(location.hash || ('#' + location.search), location.origin);
158-
</script>
159-
</body>
160-
</html>
161-
```
162-
163-
Please make sure that this file is copied to your output directory by your build task. When using the CLI you can define it as an asset for this. For this, you have to add the following line to the file ``.angular-cli.json``:
164-
165-
```JSON
166-
"assets": [
167-
[...],
168-
"silent-refresh.html"
169-
],
170-
```
171-
172-
To perform a silent refresh, just call the following method:
173-
174-
```TypeScript
175-
this
176-
.oauthService
177-
.silentRefresh()
178-
.then(info => console.debug('refresh ok', info))
179-
.catch(err => console.error('refresh error', err));
180-
```
181-
182-
When there is an error in the iframe that prevents the communication with the main application, silentRefresh will give you a timeout. To configure the timespan for this, you can set the property ``silentRefreshTimeout`` (msec). The default value is 20.000 (20 seconds).
183-
184-
### Automatically refreshing a token when/ before it expires (Code Flow and Implicit Flow)
185-
186-
187-
To automatically refresh a token when/ some time before it expires, just call the following method after configuring the OAuthService:
188-
189-
```TypeScript
190-
this.oauthService.setupAutomaticSilentRefresh();
191-
```
192-
193-
By default, this event is fired after 75% of the token's life time is over. You can adjust this factor by setting the property ``timeoutFactor`` to a value between 0 and 1. For instance, 0.5 means, that the event is fired after half of the life time is over and 0.33 triggers the event after a third.

0 commit comments

Comments
 (0)