Skip to content

Commit d95d7da

Browse files
committed
feat: update for angular 13
1 parent ac931de commit d95d7da

25 files changed

+10958
-13638
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
!.vscode/extensions.json
2626

2727
# misc
28+
/.angular/cache
2829
/.sass-cache
2930
/connect.lock
3031
/coverage

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ For using this library with **Azure Active Directory** (**Azure AD**), we recomm
2828

2929
Also, the Okta community created some guidelines on how to use this lib with Okta. See the links at the end of this page for more information.
3030

31+
**Angular 13**: Use 13.x versions of this library (**should also work with older Angular versions!**).
32+
3133
**Angular 12**: Use 12.x versions of this library (**should also work with older Angular versions!**).
3234

3335
**Angular 11**: Use 10.x versions of this library (**should also work with older Angular versions!**).

angular.json

-41
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,6 @@
2121
"tsConfig": "projects/lib/tsconfig.lib.prod.json"
2222
}
2323
}
24-
},
25-
"lint": {
26-
"builder": "@angular-devkit/build-angular:tslint",
27-
"options": {
28-
"tsConfig": [
29-
"projects/lib/tsconfig.lib.json",
30-
"projects/lib/tsconfig.spec.json"
31-
],
32-
"exclude": ["**/node_modules/**"]
33-
}
3424
}
3525
}
3626
},
@@ -125,16 +115,6 @@
125115
"projects/sample/src/assets"
126116
]
127117
}
128-
},
129-
"lint": {
130-
"builder": "@angular-devkit/build-angular:tslint",
131-
"options": {
132-
"tsConfig": [
133-
"projects/sample/tsconfig.app.json",
134-
"projects/sample/tsconfig.spec.json"
135-
],
136-
"exclude": ["**/node_modules/**"]
137-
}
138118
}
139119
}
140120
},
@@ -227,17 +207,6 @@
227207
"scripts": []
228208
}
229209
},
230-
"lint": {
231-
"builder": "@angular-devkit/build-angular:tslint",
232-
"options": {
233-
"tsConfig": [
234-
"projects/quickstart-demo/tsconfig.app.json",
235-
"projects/quickstart-demo/tsconfig.spec.json",
236-
"projects/quickstart-demo/e2e/tsconfig.json"
237-
],
238-
"exclude": ["**/node_modules/**"]
239-
}
240-
},
241210
"e2e": {
242211
"builder": "@angular-devkit/build-angular:protractor",
243212
"options": {
@@ -273,16 +242,6 @@
273242
"tsConfig": "projects/angular-oauth2-oidc-jwks/tsconfig.spec.json",
274243
"karmaConfig": "projects/angular-oauth2-oidc-jwks/karma.conf.js"
275244
}
276-
},
277-
"lint": {
278-
"builder": "@angular-devkit/build-angular:tslint",
279-
"options": {
280-
"tsConfig": [
281-
"projects/angular-oauth2-oidc-jwks/tsconfig.lib.json",
282-
"projects/angular-oauth2-oidc-jwks/tsconfig.spec.json"
283-
],
284-
"exclude": ["**/node_modules/**"]
285-
}
286245
}
287246
}
288247
}

docs/additional-documentation/popup-based-login.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ <h1 id="logging-in-with-a-popup">Logging in With a Popup</h1>
5353
<p>Thanks to a great community contribution, this library also supports logging the user in via a popup. For this, you need to do two things:</p>
5454
<ul>
5555
<li>Use <code>initLoginFlowInPopup</code> instead of <code>initLoginFlow</code>.</li>
56-
<li>Create and configure a <code>silent-refresh.html</code> as described <a href="./silent-refresh.html">here</a> *.</li>
56+
<li>Create and configure a <code>silent-refresh.html</code> as described <a href="./silent-refresh.md">here</a> *.</li>
5757
</ul>
5858
<p>* Please note this does not mean that you have to use silent refresh too.</p>
59-
<p>Also, for your <code>silent-regfesh.html</code>, make sure you are also targeting
59+
<p>Also, for your <code>silent-refresh.html</code>, make sure you are also targeting
6060
<code>window.opener</code> and fall back to <code>window.parent</code>:</p>
6161
<p><strong>Please note</strong>: IE sets opener to null under specific security settings. This prevents making this work.</p>
6262

docs/additional-documentation/silent-refresh.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151

5252
<h2 id="refreshing-when-using-implicit-flow-implicit-flow-and-code-flow">Refreshing when using Implicit Flow (Implicit Flow and Code Flow)</h2>
53-
<p><strong>Notes for Code Flow</strong>: You can also use this strategy for refreshing tokens when using code flow. However, please note, the strategy described within <a href="./token-refresh.md">Token Refresh</a> is far easier in this case.</p>
53+
<p><strong>Notes for Code Flow</strong>: You can also use this strategy for refreshing tokens when using code flow. However, please note, the strategy described within <a href="./token-refresh.html">Token Refresh</a> is far easier in this case.</p>
5454
<p>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.</p>
5555
<p>To use this approach, setup a redirect uri for the silent refresh.</p>
5656
<p>For this, you can set the property silentRefreshRedirectUri in the config object:</p>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<!doctype html>
2+
<html class="no-js" lang="">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="x-ua-compatible" content="ie=edge">
6+
<title>angular-oauth2-oidc</title>
7+
<meta name="description" content="">
8+
<meta name="viewport" content="width=device-width, initial-scale=1">
9+
10+
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
11+
<link rel="stylesheet" href="../styles/style.css">
12+
<link rel="stylesheet" href="../styles/dark.css" media="(prefers-color-scheme: dark)">
13+
</head>
14+
<body>
15+
16+
<div class="navbar navbar-default navbar-fixed-top visible-xs">
17+
<a href="../" class="navbar-brand">angular-oauth2-oidc</a>
18+
<button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
19+
</div>
20+
21+
<div class="xs-menu menu" id="mobile-menu">
22+
<div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
23+
</div>
24+
25+
<div class="container-fluid main">
26+
<div class="row main">
27+
<div class="hidden-xs menu">
28+
<compodoc-menu mode="normal"></compodoc-menu>
29+
</div>
30+
<!-- START CONTENT -->
31+
<div class="content additional-page">
32+
<div class="content-data">
33+
34+
35+
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
46+
47+
48+
49+
50+
51+
52+
<h1 id="refreshing-a-token-using-code-flow-not-implicit-flow">Refreshing a Token using Code Flow (not Implicit Flow!)</h1>
53+
<p>When using code flow, you can get an <code>refresh_token</code>. While the original standard DOES NOT allow this for SPAs, the mentioned <a href="https://tools.ietf.org/html/draft-ietf-oauth-security-topics-13">OAuth 2.0 Security Best Current Practice</a> document proposes to ease this limitation. However, it specifies a list of requirements one should take care about before using <code>refresh_tokens</code>. Please make sure you respect those requirements.</p>
54+
<p>Please also note, that you have to request the <code>offline_access</code> scope to get a refresh token.</p>
55+
<p>To refresh your token, just call the <code>refreshToken</code> method:</p>
56+
<div><pre class="line-numbers"><code class="language-typescript">this.oauthService.refreshToken();</code></pre></div><h2 id="automatically-refreshing-a-token-when-before-it-expires-code-flow-and-implicit-flow">Automatically refreshing a token when/ before it expires (Code Flow and Implicit Flow)</h2>
57+
<p>To automatically refresh a token when/ some time before it expires, just call the following method after configuring the <code>OAuthService</code>:</p>
58+
<div><pre class="line-numbers"><code class="language-TypeScript">this.oauthService.setupAutomaticSilentRefresh();</code></pre></div><p>By default, this event is fired after 75% of the token&#39;s life time is over. You can adjust this factor by setting the property <code>timeoutFactor</code> 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.</p>
59+
60+
</div><div class="search-results">
61+
<div class="has-results">
62+
<h1 class="search-results-title"><span class='search-results-count'></span> result-matching "<span class='search-query'></span>"</h1>
63+
<ul class="search-results-list"></ul>
64+
</div>
65+
<div class="no-results">
66+
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
67+
</div>
68+
</div>
69+
</div>
70+
<!-- END CONTENT -->
71+
</div>
72+
</div>
73+
74+
<script>
75+
var COMPODOC_CURRENT_PAGE_DEPTH = 1;
76+
var COMPODOC_CURRENT_PAGE_CONTEXT = 'additional-page';
77+
var COMPODOC_CURRENT_PAGE_URL = 'token-refresh.html';
78+
var MAX_SEARCH_RESULTS = 15;
79+
</script>
80+
81+
<script src="../js/libs/custom-elements.min.js"></script>
82+
<script src="../js/libs/lit-html.js"></script>
83+
84+
<script type="module" src="../js/menu-wc.js" defer></script>
85+
<script nomodule src="../js/menu-wc_es5.js" defer></script>
86+
87+
<script src="../js/libs/bootstrap-native.js"></script>
88+
89+
<script src="../js/libs/es6-shim.min.js"></script>
90+
<script src="../js/libs/EventDispatcher.js"></script>
91+
<script src="../js/libs/promise.min.js"></script>
92+
<script src="../js/libs/zepto.min.js"></script>
93+
94+
<script src="../js/compodoc.js"></script>
95+
96+
<script src="../js/tabs.js"></script>
97+
<script src="../js/menu.js"></script>
98+
<script src="../js/libs/clipboard.min.js"></script>
99+
<script src="../js/libs/prism.js"></script>
100+
<script src="../js/sourceCode.js"></script>
101+
<script src="../js/search/search.js"></script>
102+
<script src="../js/search/lunr.min.js"></script>
103+
<script src="../js/search/search-lunr.js"></script>
104+
<script src="../js/search/search_index.js"></script>
105+
<script src="../js/lazy-load-graphs.js"></script>
106+
107+
108+
</body>
109+
</html>

docs/classes/AuthConfig.html

+47-2
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ <h6><b>Properties</b></h6>
171171
<span class="modifier">Optional</span>
172172
<a href="#postLogoutRedirectUri" >postLogoutRedirectUri</a>
173173
</li>
174+
<li>
175+
<span class="modifier">Public</span>
176+
<span class="modifier">Optional</span>
177+
<a href="#preserveRequestedRoute" >preserveRequestedRoute</a>
178+
</li>
174179
<li>
175180
<span class="modifier">Public</span>
176181
<span class="modifier">Optional</span>
@@ -340,7 +345,7 @@ <h3 id="constructor">Constructor</h3>
340345
</tr>
341346
<tr>
342347
<td class="col-md-4">
343-
<div class="io-line">Defined in <a href="" data-line="258" class="link-to-prism">projects/lib/src/auth.config.ts:258</a></div>
348+
<div class="io-line">Defined in <a href="" data-line="264" class="link-to-prism">projects/lib/src/auth.config.ts:264</a></div>
344349
</td>
345350
</tr>
346351

@@ -981,7 +986,7 @@ <h3 id="inputs">
981986
</tr>
982987
<tr>
983988
<td class="col-md-4">
984-
<div class="io-line">Defined in <a href="" data-line="271" class="link-to-prism">projects/lib/src/auth.config.ts:271</a></div>
989+
<div class="io-line">Defined in <a href="" data-line="277" class="link-to-prism">projects/lib/src/auth.config.ts:277</a></div>
985990
</td>
986991
</tr>
987992

@@ -1063,6 +1068,40 @@ <h3 id="inputs">
10631068
<td class="col-md-4">
10641069
<div class="io-description"><p>An optional second redirectUri where the auth server
10651070
redirects the user to after logging out.</p>
1071+
</div>
1072+
</td>
1073+
</tr>
1074+
1075+
</tbody>
1076+
</table>
1077+
<table class="table table-sm table-bordered">
1078+
<tbody>
1079+
<tr>
1080+
<td class="col-md-4">
1081+
<a name="preserveRequestedRoute"></a>
1082+
<span class="name">
1083+
<span class="modifier">Public</span>
1084+
<span class="modifier">Optional</span>
1085+
<span ><b>preserveRequestedRoute</b></span>
1086+
<a href="#preserveRequestedRoute"><span class="icon ion-ios-link"></span></a>
1087+
</span>
1088+
</td>
1089+
</tr>
1090+
<tr>
1091+
<td class="col-md-4">
1092+
<i>Default value : </i><code>false</code>
1093+
</td>
1094+
</tr>
1095+
<tr>
1096+
<td class="col-md-4">
1097+
<div class="io-line">Defined in <a href="" data-line="264" class="link-to-prism">projects/lib/src/auth.config.ts:264</a></div>
1098+
</td>
1099+
</tr>
1100+
1101+
<tr>
1102+
<td class="col-md-4">
1103+
<div class="io-description"><p>Set this to true to preserve the requested route including query parameters after code flow login.
1104+
This setting enables deep linking for the code flow.</p>
10661105
</div>
10671106
</td>
10681107
</tr>
@@ -2378,6 +2417,12 @@ <h3 id="inputs">
23782417
*/
23792418
public disablePKCE? &#x3D; false;
23802419

2420+
/**
2421+
* Set this to true to preserve the requested route including query parameters after code flow login.
2422+
* This setting enables deep linking for the code flow.
2423+
*/
2424+
public preserveRequestedRoute? &#x3D; false;
2425+
23812426
constructor(json?: Partial&lt;AuthConfig&gt;) {
23822427
if (json) {
23832428
Object.assign(this, json);

docs/dependencies.html

+9-9
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,23 @@
4949
</ol>
5050
<ul class="dependencies-list">
5151
<li>
52-
<b>@angular/animations</b> : 12.1.2</li>
52+
<b>@angular/animations</b> : 13.0.1</li>
5353
<li>
54-
<b>@angular/common</b> : 12.1.2</li>
54+
<b>@angular/common</b> : 13.0.1</li>
5555
<li>
56-
<b>@angular/compiler</b> : 12.1.2</li>
56+
<b>@angular/compiler</b> : 13.0.1</li>
5757
<li>
58-
<b>@angular/core</b> : 12.1.2</li>
58+
<b>@angular/core</b> : 13.0.1</li>
5959
<li>
60-
<b>@angular/elements</b> : 12.1.2</li>
60+
<b>@angular/elements</b> : 13.0.1</li>
6161
<li>
62-
<b>@angular/forms</b> : 12.1.2</li>
62+
<b>@angular/forms</b> : 13.0.1</li>
6363
<li>
64-
<b>@angular/platform-browser</b> : 12.1.2</li>
64+
<b>@angular/platform-browser</b> : 13.0.1</li>
6565
<li>
66-
<b>@angular/platform-browser-dynamic</b> : 12.1.2</li>
66+
<b>@angular/platform-browser-dynamic</b> : 13.0.1</li>
6767
<li>
68-
<b>@angular/router</b> : 12.1.2</li>
68+
<b>@angular/router</b> : 13.0.1</li>
6969
<li>
7070
<b>@popperjs/core</b> : ^2.9.2</li>
7171
<li>

docs/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ <h2 id="tested-environment">Tested Environment</h2>
5252
<p>At server side we&#39;ve used <strong>IdentityServer</strong> (.NET / .NET Core), Redhat&#39;s <strong>Keycloak</strong> (Java), and <strong>Auth0</strong> (Auth0 is officially supported since version 10 of this lib). For Auth0, please have a look into the respective documentation page here.</p>
5353
<p>For using this library with <strong>Azure Active Directory</strong> (<strong>Azure AD</strong>), we recommend an additional look to this <a href="https://dev.to/yuriburger/azure-active-directory-b2c-with-pkce-for-your-angular-app-1dcg">blog post</a> and the example linked at the end of this blog post.</p>
5454
<p>Also, the Okta community created some guidelines on how to use this lib with Okta. See the links at the end of this page for more information.</p>
55+
<p><strong>Angular 13</strong>: Use 13.x versions of this library (<strong>should also work with older Angular versions!</strong>).</p>
5556
<p><strong>Angular 12</strong>: Use 12.x versions of this library (<strong>should also work with older Angular versions!</strong>).</p>
5657
<p><strong>Angular 11</strong>: Use 10.x versions of this library (<strong>should also work with older Angular versions!</strong>).</p>
5758
<p><strong>Angular 10</strong>: Use 10.x versions of this library (<strong>should also work with older Angular versions!</strong>).</p>

0 commit comments

Comments
 (0)