@thecla/auth0-angular 4.1.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/actions/auth.actions.mjs +8 -0
- package/{esm2015/lib/auth-config.js → esm2020/lib/auth-config.mjs} +0 -0
- package/esm2020/lib/auth.guard.mjs +29 -0
- package/{esm2015/lib/auth.module.js → esm2020/lib/auth.module.mjs} +4 -4
- package/esm2020/lib/auth.service.mjs +52 -0
- package/esm2020/lib/effects/auth.effects.mjs +53 -0
- package/{esm2015/lib/jwt.interceptor.js → esm2020/lib/jwt.interceptor.mjs} +3 -3
- package/esm2020/lib/reducers/auth.reducer.mjs +20 -0
- package/{esm2015/lib/state/auth.state.js → esm2020/lib/state/auth.state.mjs} +0 -0
- package/{esm2015/lib/store/index.js → esm2020/lib/store/index.mjs} +0 -0
- package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
- package/{esm2015/thecla-auth0-angular.js → esm2020/thecla-auth0-angular.mjs} +0 -0
- package/fesm2015/{thecla-auth0-angular.js → thecla-auth0-angular.mjs} +28 -31
- package/fesm2015/thecla-auth0-angular.mjs.map +1 -0
- package/fesm2020/thecla-auth0-angular.mjs +217 -0
- package/fesm2020/thecla-auth0-angular.mjs.map +1 -0
- package/lib/actions/auth.actions.d.ts +13 -9
- package/lib/auth.guard.d.ts +1 -1
- package/lib/effects/auth.effects.d.ts +10 -6
- package/package.json +24 -11
- package/bundles/thecla-auth0-angular.umd.js +0 -578
- package/bundles/thecla-auth0-angular.umd.js.map +0 -1
- package/esm2015/lib/actions/auth.actions.js +0 -8
- package/esm2015/lib/auth.guard.js +0 -29
- package/esm2015/lib/auth.service.js +0 -57
- package/esm2015/lib/effects/auth.effects.js +0 -53
- package/esm2015/lib/reducers/auth.reducer.js +0 -19
- package/fesm2015/thecla-auth0-angular.js.map +0 -1
|
@@ -1,578 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common/http'), require('@angular/core'), require('@ngrx/effects'), require('@ngrx/store'), require('rxjs'), require('rxjs/operators'), require('@auth0/auth0-spa-js'), require('@angular/router')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@thecla/auth0-angular', ['exports', '@angular/common/http', '@angular/core', '@ngrx/effects', '@ngrx/store', 'rxjs', 'rxjs/operators', '@auth0/auth0-spa-js', '@angular/router'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.thecla = global.thecla || {}, global.thecla['auth0-angular'] = {}), global.ng.common.http, global.ng.core, global.ngrx.effects, global.ngrx.store, global.rxjs, global.rxjs.operators, global.createAuth0Client, global.ng.router));
|
|
5
|
-
}(this, (function (exports, http, i0, i1$1, i1, rxjs, operators, auth0SpaJs, i3) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function _interopNamespace(e) {
|
|
8
|
-
if (e && e.__esModule) return e;
|
|
9
|
-
var n = Object.create(null);
|
|
10
|
-
if (e) {
|
|
11
|
-
Object.keys(e).forEach(function (k) {
|
|
12
|
-
if (k !== 'default') {
|
|
13
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () {
|
|
17
|
-
return e[k];
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
n['default'] = e;
|
|
24
|
-
return Object.freeze(n);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
28
|
-
var i1__namespace = /*#__PURE__*/_interopNamespace(i1$1);
|
|
29
|
-
var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1);
|
|
30
|
-
var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
|
|
31
|
-
|
|
32
|
-
var AuthConfig = /** @class */ (function () {
|
|
33
|
-
function AuthConfig() {
|
|
34
|
-
}
|
|
35
|
-
return AuthConfig;
|
|
36
|
-
}());
|
|
37
|
-
|
|
38
|
-
var signIn = i1.createAction('@thecla/auth0-angular/sign-in', i1.props());
|
|
39
|
-
var signInCompleted = i1.createAction('@thecla/auth0-angular/sign-in-completed', i1.props());
|
|
40
|
-
var signedIn = i1.createAction('@thecla/auth0-angular/signed-in', i1.props());
|
|
41
|
-
var signInFailed = i1.createAction('@thecla/auth0-angular/sign-in-failed', i1.props());
|
|
42
|
-
var signOut = i1.createAction('@thecla/auth0-angular/sign-out');
|
|
43
|
-
var signedOut = i1.createAction('@thecla/auth0-angular/signed-out');
|
|
44
|
-
|
|
45
|
-
/*! *****************************************************************************
|
|
46
|
-
Copyright (c) Microsoft Corporation.
|
|
47
|
-
|
|
48
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
49
|
-
purpose with or without fee is hereby granted.
|
|
50
|
-
|
|
51
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
52
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
53
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
54
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
55
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
56
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
57
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
58
|
-
***************************************************************************** */
|
|
59
|
-
/* global Reflect, Promise */
|
|
60
|
-
var extendStatics = function (d, b) {
|
|
61
|
-
extendStatics = Object.setPrototypeOf ||
|
|
62
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
63
|
-
function (d, b) { for (var p in b)
|
|
64
|
-
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
65
|
-
d[p] = b[p]; };
|
|
66
|
-
return extendStatics(d, b);
|
|
67
|
-
};
|
|
68
|
-
function __extends(d, b) {
|
|
69
|
-
if (typeof b !== "function" && b !== null)
|
|
70
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
71
|
-
extendStatics(d, b);
|
|
72
|
-
function __() { this.constructor = d; }
|
|
73
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
74
|
-
}
|
|
75
|
-
var __assign = function () {
|
|
76
|
-
__assign = Object.assign || function __assign(t) {
|
|
77
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
78
|
-
s = arguments[i];
|
|
79
|
-
for (var p in s)
|
|
80
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
81
|
-
t[p] = s[p];
|
|
82
|
-
}
|
|
83
|
-
return t;
|
|
84
|
-
};
|
|
85
|
-
return __assign.apply(this, arguments);
|
|
86
|
-
};
|
|
87
|
-
function __rest(s, e) {
|
|
88
|
-
var t = {};
|
|
89
|
-
for (var p in s)
|
|
90
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
91
|
-
t[p] = s[p];
|
|
92
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
93
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
94
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
95
|
-
t[p[i]] = s[p[i]];
|
|
96
|
-
}
|
|
97
|
-
return t;
|
|
98
|
-
}
|
|
99
|
-
function __decorate(decorators, target, key, desc) {
|
|
100
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
101
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
102
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
103
|
-
else
|
|
104
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
105
|
-
if (d = decorators[i])
|
|
106
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
107
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
108
|
-
}
|
|
109
|
-
function __param(paramIndex, decorator) {
|
|
110
|
-
return function (target, key) { decorator(target, key, paramIndex); };
|
|
111
|
-
}
|
|
112
|
-
function __metadata(metadataKey, metadataValue) {
|
|
113
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
114
|
-
return Reflect.metadata(metadataKey, metadataValue);
|
|
115
|
-
}
|
|
116
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
117
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
118
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
119
|
-
function fulfilled(value) { try {
|
|
120
|
-
step(generator.next(value));
|
|
121
|
-
}
|
|
122
|
-
catch (e) {
|
|
123
|
-
reject(e);
|
|
124
|
-
} }
|
|
125
|
-
function rejected(value) { try {
|
|
126
|
-
step(generator["throw"](value));
|
|
127
|
-
}
|
|
128
|
-
catch (e) {
|
|
129
|
-
reject(e);
|
|
130
|
-
} }
|
|
131
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
132
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
function __generator(thisArg, body) {
|
|
136
|
-
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
137
|
-
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
138
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
139
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
140
|
-
function step(op) {
|
|
141
|
-
if (f)
|
|
142
|
-
throw new TypeError("Generator is already executing.");
|
|
143
|
-
while (_)
|
|
144
|
-
try {
|
|
145
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
146
|
-
return t;
|
|
147
|
-
if (y = 0, t)
|
|
148
|
-
op = [op[0] & 2, t.value];
|
|
149
|
-
switch (op[0]) {
|
|
150
|
-
case 0:
|
|
151
|
-
case 1:
|
|
152
|
-
t = op;
|
|
153
|
-
break;
|
|
154
|
-
case 4:
|
|
155
|
-
_.label++;
|
|
156
|
-
return { value: op[1], done: false };
|
|
157
|
-
case 5:
|
|
158
|
-
_.label++;
|
|
159
|
-
y = op[1];
|
|
160
|
-
op = [0];
|
|
161
|
-
continue;
|
|
162
|
-
case 7:
|
|
163
|
-
op = _.ops.pop();
|
|
164
|
-
_.trys.pop();
|
|
165
|
-
continue;
|
|
166
|
-
default:
|
|
167
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
168
|
-
_ = 0;
|
|
169
|
-
continue;
|
|
170
|
-
}
|
|
171
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
172
|
-
_.label = op[1];
|
|
173
|
-
break;
|
|
174
|
-
}
|
|
175
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
176
|
-
_.label = t[1];
|
|
177
|
-
t = op;
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
if (t && _.label < t[2]) {
|
|
181
|
-
_.label = t[2];
|
|
182
|
-
_.ops.push(op);
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
if (t[2])
|
|
186
|
-
_.ops.pop();
|
|
187
|
-
_.trys.pop();
|
|
188
|
-
continue;
|
|
189
|
-
}
|
|
190
|
-
op = body.call(thisArg, _);
|
|
191
|
-
}
|
|
192
|
-
catch (e) {
|
|
193
|
-
op = [6, e];
|
|
194
|
-
y = 0;
|
|
195
|
-
}
|
|
196
|
-
finally {
|
|
197
|
-
f = t = 0;
|
|
198
|
-
}
|
|
199
|
-
if (op[0] & 5)
|
|
200
|
-
throw op[1];
|
|
201
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
205
|
-
if (k2 === undefined)
|
|
206
|
-
k2 = k;
|
|
207
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
208
|
-
}) : (function (o, m, k, k2) {
|
|
209
|
-
if (k2 === undefined)
|
|
210
|
-
k2 = k;
|
|
211
|
-
o[k2] = m[k];
|
|
212
|
-
});
|
|
213
|
-
function __exportStar(m, o) {
|
|
214
|
-
for (var p in m)
|
|
215
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
216
|
-
__createBinding(o, m, p);
|
|
217
|
-
}
|
|
218
|
-
function __values(o) {
|
|
219
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
220
|
-
if (m)
|
|
221
|
-
return m.call(o);
|
|
222
|
-
if (o && typeof o.length === "number")
|
|
223
|
-
return {
|
|
224
|
-
next: function () {
|
|
225
|
-
if (o && i >= o.length)
|
|
226
|
-
o = void 0;
|
|
227
|
-
return { value: o && o[i++], done: !o };
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
231
|
-
}
|
|
232
|
-
function __read(o, n) {
|
|
233
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
234
|
-
if (!m)
|
|
235
|
-
return o;
|
|
236
|
-
var i = m.call(o), r, ar = [], e;
|
|
237
|
-
try {
|
|
238
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
239
|
-
ar.push(r.value);
|
|
240
|
-
}
|
|
241
|
-
catch (error) {
|
|
242
|
-
e = { error: error };
|
|
243
|
-
}
|
|
244
|
-
finally {
|
|
245
|
-
try {
|
|
246
|
-
if (r && !r.done && (m = i["return"]))
|
|
247
|
-
m.call(i);
|
|
248
|
-
}
|
|
249
|
-
finally {
|
|
250
|
-
if (e)
|
|
251
|
-
throw e.error;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
return ar;
|
|
255
|
-
}
|
|
256
|
-
/** @deprecated */
|
|
257
|
-
function __spread() {
|
|
258
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
259
|
-
ar = ar.concat(__read(arguments[i]));
|
|
260
|
-
return ar;
|
|
261
|
-
}
|
|
262
|
-
/** @deprecated */
|
|
263
|
-
function __spreadArrays() {
|
|
264
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
265
|
-
s += arguments[i].length;
|
|
266
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
267
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
268
|
-
r[k] = a[j];
|
|
269
|
-
return r;
|
|
270
|
-
}
|
|
271
|
-
function __spreadArray(to, from) {
|
|
272
|
-
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
273
|
-
to[j] = from[i];
|
|
274
|
-
return to;
|
|
275
|
-
}
|
|
276
|
-
function __await(v) {
|
|
277
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
278
|
-
}
|
|
279
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
280
|
-
if (!Symbol.asyncIterator)
|
|
281
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
282
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
283
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
284
|
-
function verb(n) { if (g[n])
|
|
285
|
-
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
286
|
-
function resume(n, v) { try {
|
|
287
|
-
step(g[n](v));
|
|
288
|
-
}
|
|
289
|
-
catch (e) {
|
|
290
|
-
settle(q[0][3], e);
|
|
291
|
-
} }
|
|
292
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
293
|
-
function fulfill(value) { resume("next", value); }
|
|
294
|
-
function reject(value) { resume("throw", value); }
|
|
295
|
-
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
296
|
-
resume(q[0][0], q[0][1]); }
|
|
297
|
-
}
|
|
298
|
-
function __asyncDelegator(o) {
|
|
299
|
-
var i, p;
|
|
300
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
301
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
302
|
-
}
|
|
303
|
-
function __asyncValues(o) {
|
|
304
|
-
if (!Symbol.asyncIterator)
|
|
305
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
306
|
-
var m = o[Symbol.asyncIterator], i;
|
|
307
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
308
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
309
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
310
|
-
}
|
|
311
|
-
function __makeTemplateObject(cooked, raw) {
|
|
312
|
-
if (Object.defineProperty) {
|
|
313
|
-
Object.defineProperty(cooked, "raw", { value: raw });
|
|
314
|
-
}
|
|
315
|
-
else {
|
|
316
|
-
cooked.raw = raw;
|
|
317
|
-
}
|
|
318
|
-
return cooked;
|
|
319
|
-
}
|
|
320
|
-
;
|
|
321
|
-
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
322
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
323
|
-
}) : function (o, v) {
|
|
324
|
-
o["default"] = v;
|
|
325
|
-
};
|
|
326
|
-
function __importStar(mod) {
|
|
327
|
-
if (mod && mod.__esModule)
|
|
328
|
-
return mod;
|
|
329
|
-
var result = {};
|
|
330
|
-
if (mod != null)
|
|
331
|
-
for (var k in mod)
|
|
332
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
333
|
-
__createBinding(result, mod, k);
|
|
334
|
-
__setModuleDefault(result, mod);
|
|
335
|
-
return result;
|
|
336
|
-
}
|
|
337
|
-
function __importDefault(mod) {
|
|
338
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
339
|
-
}
|
|
340
|
-
function __classPrivateFieldGet(receiver, privateMap) {
|
|
341
|
-
if (!privateMap.has(receiver)) {
|
|
342
|
-
throw new TypeError("attempted to get private field on non-instance");
|
|
343
|
-
}
|
|
344
|
-
return privateMap.get(receiver);
|
|
345
|
-
}
|
|
346
|
-
function __classPrivateFieldSet(receiver, privateMap, value) {
|
|
347
|
-
if (!privateMap.has(receiver)) {
|
|
348
|
-
throw new TypeError("attempted to set private field on non-instance");
|
|
349
|
-
}
|
|
350
|
-
privateMap.set(receiver, value);
|
|
351
|
-
return value;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
var AuthService = /** @class */ (function () {
|
|
355
|
-
function AuthService(config) {
|
|
356
|
-
var _a;
|
|
357
|
-
this.config = config;
|
|
358
|
-
this.auth0 = new auth0SpaJs.Auth0Client({
|
|
359
|
-
audience: config.audience,
|
|
360
|
-
client_id: config.clientId,
|
|
361
|
-
domain: config.domain,
|
|
362
|
-
redirect_uri: (_a = config.redirectUri) !== null && _a !== void 0 ? _a : location.origin,
|
|
363
|
-
scope: config.scope,
|
|
364
|
-
useRefreshTokens: config.useRefreshTokens,
|
|
365
|
-
sessionCheckExpiryDays: config.sessionCheckExpiryDays,
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
AuthService.prototype.isAuthenticated = function () {
|
|
369
|
-
return rxjs.from(this.checkSession());
|
|
370
|
-
};
|
|
371
|
-
AuthService.prototype.loginWithRedirect = function (appState) {
|
|
372
|
-
return rxjs.from(this.auth0.loginWithRedirect({ appState: appState })).pipe(operators.switchMap(function () { return rxjs.EMPTY; }));
|
|
373
|
-
};
|
|
374
|
-
AuthService.prototype.handleRedirectCallback = function () {
|
|
375
|
-
return rxjs.from(this.auth0.handleRedirectCallback()).pipe(operators.map(function (result) { return result.appState; }));
|
|
376
|
-
};
|
|
377
|
-
AuthService.prototype.getUser = function () {
|
|
378
|
-
return rxjs.from(this.auth0.getUser()).pipe(operators.filter(function (u) { return u !== undefined; }));
|
|
379
|
-
};
|
|
380
|
-
AuthService.prototype.getAccessToken = function () {
|
|
381
|
-
return rxjs.from(this.auth0.getTokenSilently());
|
|
382
|
-
};
|
|
383
|
-
AuthService.prototype.logout = function () {
|
|
384
|
-
var _a;
|
|
385
|
-
this.auth0.logout({ returnTo: (_a = this.config.logoutUri) !== null && _a !== void 0 ? _a : location.origin });
|
|
386
|
-
};
|
|
387
|
-
AuthService.prototype.checkSession = function () {
|
|
388
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
389
|
-
return __generator(this, function (_b) {
|
|
390
|
-
switch (_b.label) {
|
|
391
|
-
case 0: return [4 /*yield*/, this.auth0.checkSession()];
|
|
392
|
-
case 1:
|
|
393
|
-
_b.sent();
|
|
394
|
-
return [4 /*yield*/, this.auth0.isAuthenticated()];
|
|
395
|
-
case 2: return [2 /*return*/, _b.sent()];
|
|
396
|
-
}
|
|
397
|
-
});
|
|
398
|
-
});
|
|
399
|
-
};
|
|
400
|
-
return AuthService;
|
|
401
|
-
}());
|
|
402
|
-
AuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: AuthService, deps: [{ token: AuthConfig }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
403
|
-
AuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: AuthService, providedIn: 'root' });
|
|
404
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: AuthService, decorators: [{
|
|
405
|
-
type: i0.Injectable,
|
|
406
|
-
args: [{
|
|
407
|
-
providedIn: 'root',
|
|
408
|
-
}]
|
|
409
|
-
}], ctorParameters: function () { return [{ type: AuthConfig }]; } });
|
|
410
|
-
|
|
411
|
-
var AuthEffects = /** @class */ (function () {
|
|
412
|
-
function AuthEffects(actions$, auth, router) {
|
|
413
|
-
var _this = this;
|
|
414
|
-
this.actions$ = actions$;
|
|
415
|
-
this.auth = auth;
|
|
416
|
-
this.router = router;
|
|
417
|
-
this.signIn$ = i1$1.createEffect(function () { return _this.actions$.pipe(i1$1.ofType(signIn), operators.switchMap(function (action) { return _this.auth.loginWithRedirect({ target: action.returnUrl }); })); }, { dispatch: false });
|
|
418
|
-
this.signInCompleted$ = i1$1.createEffect(function () { return _this.actions$.pipe(i1$1.ofType(signInCompleted), operators.switchMap(function () { return _this.auth.getUser().pipe(operators.map(function (user) { return signedIn(user); }), operators.catchError(function (error) { return rxjs.of(signInFailed({ error: error })); })); })); });
|
|
419
|
-
this.redirect$ = i1$1.createEffect(function () { return _this.actions$.pipe(i1$1.ofType(signInCompleted), operators.switchMap(function (action) { return _this.router.navigateByUrl(action.state.target, { replaceUrl: true }); })); }, { dispatch: false });
|
|
420
|
-
this.signOut$ = i1$1.createEffect(function () { return _this.actions$.pipe(i1$1.ofType(signOut), operators.tap(function () {
|
|
421
|
-
try {
|
|
422
|
-
_this.auth.logout();
|
|
423
|
-
}
|
|
424
|
-
catch (_a) { }
|
|
425
|
-
}), operators.map(function () { return signedOut(); })); });
|
|
426
|
-
this.init$ = i1$1.createEffect(function () { return function (_b) {
|
|
427
|
-
var _c = _b === void 0 ? {} : _b, _d = _c.scheduler, scheduler = _d === void 0 ? rxjs.asyncScheduler : _d;
|
|
428
|
-
var params = window.location.search;
|
|
429
|
-
if (params.includes('code=') && params.includes('state=')) {
|
|
430
|
-
return _this.completeSignIn(scheduler);
|
|
431
|
-
}
|
|
432
|
-
else {
|
|
433
|
-
return _this.auth.isAuthenticated().pipe(operators.switchMap(function (auth) { return _this.getAuthResult(auth); }), operators.catchError(function (error) { return rxjs.of(signInFailed({ error: error })); }), operators.observeOn(scheduler));
|
|
434
|
-
}
|
|
435
|
-
}; });
|
|
436
|
-
}
|
|
437
|
-
AuthEffects.prototype.getAuthResult = function (auth) {
|
|
438
|
-
if (auth) {
|
|
439
|
-
return this.auth.getUser().pipe(operators.map(function (user) { return signedIn(user); }));
|
|
440
|
-
}
|
|
441
|
-
else {
|
|
442
|
-
return rxjs.of(signedOut());
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
|
-
AuthEffects.prototype.completeSignIn = function (scheduler) {
|
|
446
|
-
return this.auth.handleRedirectCallback().pipe(operators.map(function (state) { return signInCompleted({ state: state }); }), operators.catchError(function (error) { return rxjs.of(signInFailed({ error: error })); }), operators.observeOn(scheduler));
|
|
447
|
-
};
|
|
448
|
-
return AuthEffects;
|
|
449
|
-
}());
|
|
450
|
-
AuthEffects.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: AuthEffects, deps: [{ token: i1__namespace.Actions }, { token: AuthService }, { token: i3__namespace.Router }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
451
|
-
AuthEffects.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: AuthEffects });
|
|
452
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: AuthEffects, decorators: [{
|
|
453
|
-
type: i0.Injectable
|
|
454
|
-
}], ctorParameters: function () { return [{ type: i1__namespace.Actions }, { type: AuthService }, { type: i3__namespace.Router }]; } });
|
|
455
|
-
|
|
456
|
-
var JwtInterceptor = /** @class */ (function () {
|
|
457
|
-
function JwtInterceptor(auth) {
|
|
458
|
-
this.auth = auth;
|
|
459
|
-
}
|
|
460
|
-
JwtInterceptor.prototype.intercept = function (request, next) {
|
|
461
|
-
if (this.isSameDomain(request)) {
|
|
462
|
-
return this.authorize(request).pipe(operators.mergeMap(function (authorizedRequest) { return next.handle(authorizedRequest); }));
|
|
463
|
-
}
|
|
464
|
-
else {
|
|
465
|
-
return next.handle(request);
|
|
466
|
-
}
|
|
467
|
-
};
|
|
468
|
-
JwtInterceptor.prototype.isSameDomain = function (request) {
|
|
469
|
-
var isAbsolute = /^https?:\/\//i.test(request.url);
|
|
470
|
-
return !isAbsolute;
|
|
471
|
-
};
|
|
472
|
-
JwtInterceptor.prototype.authorize = function (request) {
|
|
473
|
-
var token$ = this.auth.getAccessToken();
|
|
474
|
-
return token$.pipe(operators.map(function (token) { return request.clone({ setHeaders: { Authorization: "Bearer " + token } }); }));
|
|
475
|
-
};
|
|
476
|
-
return JwtInterceptor;
|
|
477
|
-
}());
|
|
478
|
-
JwtInterceptor.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: JwtInterceptor, deps: [{ token: AuthService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
479
|
-
JwtInterceptor.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: JwtInterceptor });
|
|
480
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: JwtInterceptor, decorators: [{
|
|
481
|
-
type: i0.Injectable
|
|
482
|
-
}], ctorParameters: function () { return [{ type: AuthService }]; } });
|
|
483
|
-
|
|
484
|
-
var noAuthentication = {
|
|
485
|
-
authenticating: false,
|
|
486
|
-
authenticated: false,
|
|
487
|
-
};
|
|
488
|
-
var startAuthentication = {
|
|
489
|
-
authenticating: true,
|
|
490
|
-
authenticated: false,
|
|
491
|
-
};
|
|
492
|
-
var authReducer = i1.createReducer(startAuthentication, i1.on(signedIn, function (state, _a) {
|
|
493
|
-
var type = _a.type, payload = __rest(_a, ["type"]);
|
|
494
|
-
return (Object.assign(Object.assign({}, state), { authenticating: false, authenticated: true, user: payload }));
|
|
495
|
-
}), i1.on(signedOut, function () { return noAuthentication; }), i1.on(signInFailed, function () { return noAuthentication; }));
|
|
496
|
-
function reducer(state, action) {
|
|
497
|
-
return authReducer(state, action);
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
var featureKey = 'auth';
|
|
501
|
-
var selectState = i1.createFeatureSelector(featureKey);
|
|
502
|
-
var isAuthenticated = rxjs.pipe(i1.select(selectState), operators.filter(function (state) { return !state.authenticating; }), operators.map(function (state) { return state.authenticated; }));
|
|
503
|
-
var getUser = rxjs.pipe(i1.select(selectState), operators.filter(function (state) { return !state.authenticating; }), operators.map(function (state) { return state.user; }));
|
|
504
|
-
|
|
505
|
-
var AuthModule = /** @class */ (function () {
|
|
506
|
-
function AuthModule() {
|
|
507
|
-
}
|
|
508
|
-
AuthModule.forRoot = function (config) {
|
|
509
|
-
return {
|
|
510
|
-
ngModule: AuthModule,
|
|
511
|
-
providers: [
|
|
512
|
-
{
|
|
513
|
-
provide: AuthConfig,
|
|
514
|
-
useValue: config,
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
provide: http.HTTP_INTERCEPTORS,
|
|
518
|
-
useClass: JwtInterceptor,
|
|
519
|
-
multi: true,
|
|
520
|
-
},
|
|
521
|
-
],
|
|
522
|
-
};
|
|
523
|
-
};
|
|
524
|
-
return AuthModule;
|
|
525
|
-
}());
|
|
526
|
-
AuthModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: AuthModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
527
|
-
AuthModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: AuthModule, imports: [i1__namespace$1.StoreFeatureModule, i1__namespace.EffectsFeatureModule] });
|
|
528
|
-
AuthModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: AuthModule, imports: [[i1.StoreModule.forFeature(featureKey, reducer), i1$1.EffectsModule.forFeature([AuthEffects])]] });
|
|
529
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: AuthModule, decorators: [{
|
|
530
|
-
type: i0.NgModule,
|
|
531
|
-
args: [{
|
|
532
|
-
declarations: [],
|
|
533
|
-
imports: [i1.StoreModule.forFeature(featureKey, reducer), i1$1.EffectsModule.forFeature([AuthEffects])],
|
|
534
|
-
exports: [],
|
|
535
|
-
}]
|
|
536
|
-
}] });
|
|
537
|
-
|
|
538
|
-
var AuthGuard = /** @class */ (function () {
|
|
539
|
-
function AuthGuard(store) {
|
|
540
|
-
this.store = store;
|
|
541
|
-
this.authenticated$ = this.store.pipe(isAuthenticated);
|
|
542
|
-
}
|
|
543
|
-
AuthGuard.prototype.canActivate = function (next, state) {
|
|
544
|
-
var _this = this;
|
|
545
|
-
return this.authenticated$.pipe(operators.tap(function (auth) {
|
|
546
|
-
if (!auth) {
|
|
547
|
-
_this.store.dispatch(signIn({ returnUrl: state.url }));
|
|
548
|
-
}
|
|
549
|
-
}), operators.first());
|
|
550
|
-
};
|
|
551
|
-
return AuthGuard;
|
|
552
|
-
}());
|
|
553
|
-
AuthGuard.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: AuthGuard, deps: [{ token: i1__namespace$1.Store }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
554
|
-
AuthGuard.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: AuthGuard, providedIn: 'root' });
|
|
555
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.0", ngImport: i0__namespace, type: AuthGuard, decorators: [{
|
|
556
|
-
type: i0.Injectable,
|
|
557
|
-
args: [{
|
|
558
|
-
providedIn: 'root',
|
|
559
|
-
}]
|
|
560
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$1.Store }]; } });
|
|
561
|
-
|
|
562
|
-
/**
|
|
563
|
-
* Generated bundle index. Do not edit.
|
|
564
|
-
*/
|
|
565
|
-
|
|
566
|
-
exports.AuthGuard = AuthGuard;
|
|
567
|
-
exports.AuthModule = AuthModule;
|
|
568
|
-
exports.getUser = getUser;
|
|
569
|
-
exports.isAuthenticated = isAuthenticated;
|
|
570
|
-
exports.signIn = signIn;
|
|
571
|
-
exports.signOut = signOut;
|
|
572
|
-
exports.signedIn = signedIn;
|
|
573
|
-
exports.signedOut = signedOut;
|
|
574
|
-
|
|
575
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
576
|
-
|
|
577
|
-
})));
|
|
578
|
-
//# sourceMappingURL=thecla-auth0-angular.umd.js.map
|