@rxap/oauth 12.0.10 → 12.0.11

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.
@@ -456,10 +456,15 @@
456
456
  default:
457
457
  throw new Error('Not supported grant type');
458
458
  }
459
- headers = new i1.HttpHeaders({
460
- 'Content-type': 'application/x-www-form-urlencoded; charset=utf-8',
461
- Authorization: "Basic " + parameters.secret,
462
- });
459
+ headers = new i1.HttpHeaders();
460
+ headers = headers.append('Content-type', 'application/x-www-form-urlencoded; charset=utf-8');
461
+ if (parameters.secret && parameters.clientId) {
462
+ params.append('client_id', parameters.clientId);
463
+ params.append('client_secret', parameters.secret);
464
+ }
465
+ else {
466
+ headers = headers.append('Authorization', "Basic " + parameters.secret);
467
+ }
463
468
  return [4 /*yield*/, this.http
464
469
  .post(parameters.authEndpoint, params.toString(), {
465
470
  headers: headers,
@@ -523,18 +528,20 @@
523
528
  var OAUTH_SECRET = new i0.InjectionToken('OAUTH_SECRET');
524
529
  var OAUTH_AUTH_ENDPOINT = new i0.InjectionToken('OAUTH_AUTH_ENDPOINT');
525
530
  var OAUTH_SSO_URL = new i0.InjectionToken('OAUTH_SSO_URL');
531
+ var OAUTH_CLIENT_ID = new i0.InjectionToken('OAUTH_CLIENT_ID');
526
532
  var ACCESS_TOKEN_LOCAL_STORAGE_KEY = 'access_token';
527
533
  var REFRESH_TOKEN_LOCAL_STORAGE_KEY = 'refresh_token';
528
534
  var EXPIRES_AT_LOCAL_STORAGE_KEY = 'expires_at';
529
535
  var REMEMBER_LOCAL_STORAGE_KEY = 'remember';
530
536
  var OAuthService = /** @class */ (function () {
531
- function OAuthService(oAuthMethod, getOAuthProfileMethod, router, profileEndpoint, authEndpoint, secret, ssoUrl, redirectSignOut, redirectUrl) {
537
+ function OAuthService(oAuthMethod, getOAuthProfileMethod, router, profileEndpoint, authEndpoint, secret, ssoUrl, redirectSignOut, redirectUrl, clientId) {
532
538
  if (profileEndpoint === void 0) { profileEndpoint = null; }
533
539
  if (authEndpoint === void 0) { authEndpoint = null; }
534
540
  if (secret === void 0) { secret = null; }
535
541
  if (ssoUrl === void 0) { ssoUrl = null; }
536
542
  if (redirectSignOut === void 0) { redirectSignOut = null; }
537
543
  if (redirectUrl === void 0) { redirectUrl = null; }
544
+ if (clientId === void 0) { clientId = null; }
538
545
  this.oAuthMethod = oAuthMethod;
539
546
  this.getOAuthProfileMethod = getOAuthProfileMethod;
540
547
  this.router = router;
@@ -544,6 +551,7 @@
544
551
  this.ssoUrl = ssoUrl;
545
552
  this.redirectSignOut = redirectSignOut;
546
553
  this.redirectUrl = redirectUrl;
554
+ this.clientId = clientId;
547
555
  this._isAuthenticated = null;
548
556
  }
549
557
  Object.defineProperty(OAuthService.prototype, "expiresAt", {
@@ -701,6 +709,7 @@
701
709
  });
702
710
  };
703
711
  OAuthService.prototype.signInWithEmailAndPassword = function (email, password, remember) {
712
+ var _a;
704
713
  return __awaiter(this, void 0, void 0, function () {
705
714
  var response;
706
715
  return __generator(this, function (_c) {
@@ -717,6 +726,7 @@
717
726
  password: password,
718
727
  authEndpoint: this.authEndpoint,
719
728
  secret: this.secret,
729
+ clientId: (_a = this.clientId) !== null && _a !== void 0 ? _a : undefined
720
730
  })];
721
731
  case 1:
722
732
  response = _c.sent();
@@ -834,6 +844,7 @@
834
844
  this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);
835
845
  };
836
846
  OAuthService.prototype.signInWithRefreshToken = function (refreshToken) {
847
+ var _a;
837
848
  return __awaiter(this, void 0, void 0, function () {
838
849
  var response;
839
850
  return __generator(this, function (_c) {
@@ -849,6 +860,7 @@
849
860
  refreshToken: refreshToken,
850
861
  authEndpoint: this.authEndpoint,
851
862
  secret: this.secret,
863
+ clientId: (_a = this.clientId) !== null && _a !== void 0 ? _a : undefined,
852
864
  })];
853
865
  case 1:
854
866
  response = _c.sent();
@@ -860,7 +872,7 @@
860
872
  };
861
873
  return OAuthService;
862
874
  }());
863
- OAuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: OAuthService, deps: [{ token: OAuthMethod }, { token: GetOAuthProfileMethod }, { token: i1$1.Router }, { token: PROFILE_AUTH_ENDPOINT, optional: true }, { token: OAUTH_AUTH_ENDPOINT, optional: true }, { token: OAUTH_SECRET, optional: true }, { token: OAUTH_SSO_URL, optional: true }, { token: RXAP_O_AUTH_REDIRECT_SIGN_OUT, optional: true }, { token: RXAP_O_AUTH_REDIRECT_URL, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
875
+ OAuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: OAuthService, deps: [{ token: OAuthMethod }, { token: GetOAuthProfileMethod }, { token: i1$1.Router }, { token: PROFILE_AUTH_ENDPOINT, optional: true }, { token: OAUTH_AUTH_ENDPOINT, optional: true }, { token: OAUTH_SECRET, optional: true }, { token: OAUTH_SSO_URL, optional: true }, { token: RXAP_O_AUTH_REDIRECT_SIGN_OUT, optional: true }, { token: RXAP_O_AUTH_REDIRECT_URL, optional: true }, { token: OAUTH_CLIENT_ID, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
864
876
  OAuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: OAuthService, providedIn: 'root' });
865
877
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: OAuthService, decorators: [{
866
878
  type: i0.Injectable,
@@ -905,6 +917,11 @@
905
917
  }, {
906
918
  type: i0.Inject,
907
919
  args: [RXAP_O_AUTH_REDIRECT_URL]
920
+ }] }, { type: undefined, decorators: [{
921
+ type: i0.Optional
922
+ }, {
923
+ type: i0.Inject,
924
+ args: [OAUTH_CLIENT_ID]
908
925
  }] }];
909
926
  } });
910
927
 
@@ -1322,6 +1339,7 @@
1322
1339
  exports.LoadingComponent = LoadingComponent;
1323
1340
  exports.LoadingComponentModule = LoadingComponentModule;
1324
1341
  exports.OAUTH_AUTH_ENDPOINT = OAUTH_AUTH_ENDPOINT;
1342
+ exports.OAUTH_CLIENT_ID = OAUTH_CLIENT_ID;
1325
1343
  exports.OAUTH_SECRET = OAUTH_SECRET;
1326
1344
  exports.OAUTH_SSO_URL = OAUTH_SSO_URL;
1327
1345
  exports.OAuthExtractGuard = OAuthExtractGuard;
@@ -1 +1 @@
1
- {"version":3,"file":"rxap-oauth.umd.js","sources":["../../../../libs/oauth/src/lib/get-o-auth-profile.method.ts","../../../../node_modules/tslib/tslib.es6.js","../../../../libs/oauth/src/lib/o-auth.method.ts","../../../../libs/oauth/src/lib/tokens.ts","../../../../libs/oauth/src/lib/o-auth.service.ts","../../../../libs/oauth/src/lib/o-auth-extract.guard.ts","../../../../libs/oauth/src/lib/o-auth-redirect.guard.ts","../../../../libs/oauth/src/lib/o-auth.module.ts","../../../../libs/oauth/src/lib/container/container.component.ts","../../../../libs/oauth/src/lib/container/container.component.html","../../../../libs/oauth/src/lib/loading/loading.component.ts","../../../../libs/oauth/src/lib/loading/loading.component.html","../../../../libs/oauth/src/lib/sign-in-with-redirect/sign-in-with-redirect.component.ts","../../../../libs/oauth/src/lib/sign-in-with-redirect/sign-in-with-redirect.component.html","../../../../libs/oauth/src/lib/routes.ts","../../../../libs/oauth/src/lib/profile.resolve.ts","../../../../libs/oauth/src/lib/container/container.component.module.ts","../../../../libs/oauth/src/lib/loading/loading.component.module.ts","../../../../libs/oauth/src/lib/sign-in-with-redirect/sign-in-with-redirect.component.module.ts","../../../../libs/oauth/src/lib/o-auth-routing.module.ts","../../../../libs/oauth/src/rxap-oauth.ts"],"sourcesContent":["import {\n Inject,\n Injectable,\n InjectionToken,\n Optional\n} from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { Method } from '@rxap/utilities/rxjs';\n\nexport const PROFILE_AUTH_ENDPOINT = new InjectionToken(\n 'PROFILE_AUTH_ENDPOINT'\n);\n\nexport interface GetOAuthProfileMethodParameters {\n accessToken: string;\n profileEndpoint?: string | null;\n withCredentials?: boolean;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class GetOAuthProfileMethod<T = any>\n implements Method<T, GetOAuthProfileMethodParameters>\n{\n constructor(\n @Inject(HttpClient)\n private readonly http: HttpClient,\n @Optional()\n @Inject(PROFILE_AUTH_ENDPOINT)\n public profileEndpoint: string | null = null\n ) {}\n\n public call(parameters: GetOAuthProfileMethodParameters): Promise<T> {\n const profileEndpoint = parameters.profileEndpoint ?? this.profileEndpoint;\n\n if (!profileEndpoint) {\n throw new Error('The profile endpoint is not defined');\n }\n\n return this.http\n .get<T>(profileEndpoint, {\n headers: {\n Authorization: `Bearer ${parameters.accessToken}`,\n },\n withCredentials: parameters.withCredentials ?? true,\n })\n .toPromise();\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n 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) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from) {\r\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\r\n to[j] = from[i];\r\n return to;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n 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; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n 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);\r\n 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); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","import {\n Injectable,\n Inject\n} from '@angular/core';\nimport {\n HttpClient,\n HttpHeaders\n} from '@angular/common/http';\nimport { Method } from '@rxap/utilities/rxjs';\n\nexport interface OAuthMethodWithUsernamePasswordParameters {\n grantType?: string;\n username: string;\n password: string;\n secret: string;\n authEndpoint: string;\n}\n\nexport interface OAuthMethodWithRefreshTokenParameters {\n grantType?: string;\n refreshToken: string;\n secret: string;\n authEndpoint: string;\n}\n\nexport type OAuthMethodParameters = (\n | OAuthMethodWithUsernamePasswordParameters\n | OAuthMethodWithRefreshTokenParameters\n) & { withCredentials?: boolean };\n\nexport function IsOAuthMethodWithRefreshTokenParameters(\n parameters: OAuthMethodParameters\n): parameters is OAuthMethodWithRefreshTokenParameters {\n // eslint-disable-next-line no-prototype-builtins\n return parameters.hasOwnProperty('refreshToken');\n}\n\nexport function IsOAuthMethodWithUsernamePasswordParameters(\n parameters: OAuthMethodParameters\n): parameters is OAuthMethodWithUsernamePasswordParameters {\n // eslint-disable-next-line no-prototype-builtins\n return (\n parameters.hasOwnProperty('username') &&\n parameters.hasOwnProperty('password')\n );\n}\n\nexport function AssertOAuthMethodWithUsernamePasswordParameters(\n parameters: OAuthMethodParameters\n): asserts parameters is OAuthMethodWithUsernamePasswordParameters {\n if (!IsOAuthMethodWithUsernamePasswordParameters(parameters)) {\n throw new Error(\n 'The grant type password requires the parameters username and password'\n );\n }\n}\n\nexport function AssertOAuthMethodWithRefreshTokenParameters(\n parameters: OAuthMethodParameters\n): asserts parameters is OAuthMethodWithRefreshTokenParameters {\n if (!IsOAuthMethodWithRefreshTokenParameters(parameters)) {\n throw new Error(\n 'The grant type refresh token requires the parameters refreshToken'\n );\n }\n}\n\nexport function AssertOAuthMethodParameters(\n parameters: any\n): asserts parameters is OAuthMethodParameters {\n if (!parameters.authEndpoint) {\n throw new Error('The authEndpoint parameter must be defined');\n }\n if (!parameters.secret) {\n throw new Error('The secret parameter must be defined');\n }\n if (parameters.grantType) {\n switch (parameters.grantType) {\n case 'password':\n AssertOAuthMethodWithUsernamePasswordParameters(parameters);\n break;\n\n case 'refresh_token':\n AssertOAuthMethodWithRefreshTokenParameters(parameters);\n break;\n\n default:\n throw new Error(\n `The grant type '${parameters.grantType}' is not supported`\n );\n }\n } else {\n if (\n !IsOAuthMethodWithRefreshTokenParameters(parameters) &&\n !IsOAuthMethodWithUsernamePasswordParameters(parameters)\n ) {\n throw new Error(\n 'Either the refresh token or the username and password must be defined'\n );\n }\n }\n}\n\nexport interface OAuthResponse {\n access_token: string;\n refresh_token: string;\n expires_in: number;\n}\n\nexport interface OAuthMethodResponse {\n accessToken: string;\n refreshToken: string;\n expiresIn: number;\n expiresAt: Date;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthMethod\n implements Method<OAuthMethodResponse, OAuthMethodParameters>\n{\n constructor(\n @Inject(HttpClient)\n private readonly http: HttpClient\n ) {}\n\n public async call(\n parameters: OAuthMethodParameters\n ): Promise<OAuthMethodResponse> {\n AssertOAuthMethodParameters(parameters);\n\n const params = new URLSearchParams();\n const grantType = this.getGrantType(parameters);\n params.append('grant_type', grantType);\n switch (grantType) {\n case 'password':\n AssertOAuthMethodWithUsernamePasswordParameters(parameters);\n params.append('username', parameters.username);\n params.append('password', parameters.password);\n break;\n\n case 'refresh_token':\n AssertOAuthMethodWithRefreshTokenParameters(parameters);\n params.append('refresh_token', parameters.refreshToken);\n break;\n\n default:\n throw new Error('Not supported grant type');\n }\n\n const headers = new HttpHeaders({\n 'Content-type': 'application/x-www-form-urlencoded; charset=utf-8',\n Authorization: `Basic ${parameters.secret}`,\n });\n\n const response = await this.http\n .post<OAuthResponse>(parameters.authEndpoint, params.toString(), {\n headers,\n withCredentials: parameters.withCredentials ?? true,\n })\n .toPromise();\n\n return {\n accessToken: response.access_token,\n refreshToken: response.refresh_token,\n expiresIn: response.expires_in,\n expiresAt: new Date(Date.now() + response.expires_in * 1000),\n };\n }\n\n private getGrantType(parameters: OAuthMethodParameters) {\n if (parameters.grantType) {\n return parameters.grantType;\n }\n\n if (IsOAuthMethodWithRefreshTokenParameters(parameters)) {\n return 'refresh_token';\n }\n\n if (IsOAuthMethodWithUsernamePasswordParameters(parameters)) {\n return 'password';\n }\n\n throw new Error('Could not guess the grant type');\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport function DefaultRedirectSignInFactory(): string[] {\n return [ '/', 'authentication', 'login' ];\n}\n\nexport const RXAP_O_AUTH_REDIRECT_SIGN_IN = new InjectionToken('rxap/o-auth/redirect-sign-in', {\n providedIn: 'root',\n factory: DefaultRedirectSignInFactory\n});\n\nexport const RXAP_O_AUTH_REDIRECT_SIGN_OUT = new InjectionToken('rxap/o-auth/redirect-sign-out');\n\nexport function DefaultRedirectUrl(): string {\n return location.origin + '/oauth';\n}\n\nexport const RXAP_O_AUTH_REDIRECT_URL = new InjectionToken('rxap/o-auth/redirect-url', {\n providedIn: 'root',\n factory: DefaultRedirectUrl\n});\n","import {\n Inject,\n Injectable,\n InjectionToken,\n Optional\n} from '@angular/core';\nimport {\n GetOAuthProfileMethod,\n PROFILE_AUTH_ENDPOINT\n} from './get-o-auth-profile.method';\nimport {\n OAuthMethod,\n OAuthMethodResponse\n} from './o-auth.method';\nimport {\n RXAP_O_AUTH_REDIRECT_SIGN_OUT,\n RXAP_O_AUTH_REDIRECT_URL\n} from './tokens';\nimport { Router } from '@angular/router';\n\nexport const OAUTH_SECRET = new InjectionToken('OAUTH_SECRET');\nexport const OAUTH_AUTH_ENDPOINT = new InjectionToken('OAUTH_AUTH_ENDPOINT');\nexport const OAUTH_SSO_URL = new InjectionToken('OAUTH_SSO_URL');\n\nexport const ACCESS_TOKEN_LOCAL_STORAGE_KEY = 'access_token';\nexport const REFRESH_TOKEN_LOCAL_STORAGE_KEY = 'refresh_token';\nexport const EXPIRES_AT_LOCAL_STORAGE_KEY = 'expires_at';\nexport const REMEMBER_LOCAL_STORAGE_KEY = 'remember';\n\nexport interface OAuthStatus {\n accessToken: string;\n refreshToken?: string | null;\n expiresIn: number;\n expiresAt: Date;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthService<Profile = any> {\n get expiresAt(): Date | null {\n const expiresAt = this.getItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n if (expiresAt) {\n return new Date(\n parseInt(this.getItem(EXPIRES_AT_LOCAL_STORAGE_KEY)!, 10)\n );\n }\n return null;\n }\n\n set expiresAt(value: Date | null) {\n if (value) {\n this.setItem(EXPIRES_AT_LOCAL_STORAGE_KEY, value.getTime().toFixed(0));\n } else {\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n }\n\n get refreshToken(): string | null {\n return this.getItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n }\n\n set refreshToken(value: string | null) {\n if (value) {\n this.setItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY, value);\n } else {\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n }\n }\n\n get accessToken(): string | null {\n return this.getItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n }\n\n set accessToken(value: string | null) {\n if (value) {\n this.setItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY, value);\n } else {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n }\n }\n\n /**\n * The time until the access token expires in seconds\n */\n public get expiresIn(): number | null {\n const expiresAt = this.expiresAt;\n if (expiresAt) {\n return Math.round(\n (expiresAt.getTime() - Date.now()) / 1000\n );\n }\n return null;\n }\n\n public get remember(): boolean {\n return !!this.getItem(REMEMBER_LOCAL_STORAGE_KEY);\n }\n\n public set remember(value: boolean) {\n if (value) {\n this.setItem(REMEMBER_LOCAL_STORAGE_KEY, 'true');\n } else {\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n }\n }\n\n private _profile?: Profile | null;\n\n protected _isAuthenticated: boolean | null = null;\n\n public get profile(): Profile | null | undefined {\n return this._profile;\n }\n\n constructor(\n @Inject(OAuthMethod)\n public readonly oAuthMethod: OAuthMethod,\n @Inject(GetOAuthProfileMethod)\n public readonly getOAuthProfileMethod: GetOAuthProfileMethod,\n @Inject(Router)\n private readonly router: Router,\n @Optional()\n @Inject(PROFILE_AUTH_ENDPOINT)\n public profileEndpoint: string | null = null,\n @Optional()\n @Inject(OAUTH_AUTH_ENDPOINT)\n public authEndpoint: string | null = null,\n @Optional()\n @Inject(OAUTH_SECRET)\n public secret: string | null = null,\n @Optional()\n @Inject(OAUTH_SSO_URL)\n private readonly ssoUrl: string | null = null,\n @Optional()\n @Inject(RXAP_O_AUTH_REDIRECT_SIGN_OUT)\n private readonly redirectSignOut: string[] | null = null,\n @Optional()\n @Inject(RXAP_O_AUTH_REDIRECT_URL)\n private readonly redirectUrl: string | null = null\n ) {}\n\n public signInWithRedirect(lastUrl?: string): void {\n if (!this.redirectUrl) {\n throw new Error('Redirect url is not defined');\n }\n location.replace(\n `${this.ssoUrl}?redirect=${btoa(this.redirectUrl)}&secret=${\n this.secret\n }&payload=${btoa(JSON.stringify({ lastUrl }))}`\n );\n }\n\n public async isAuthenticated(): Promise<boolean> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n if (this._isAuthenticated !== null) {\n return this._isAuthenticated;\n }\n\n if (this.accessToken) {\n console.debug('Access token is defined: ' + this.accessToken);\n if (this.expiresIn && this.expiresIn > 60) {\n const profile = await this.getProfile();\n\n if (!profile) {\n console.log('profile is not defined');\n return (this._isAuthenticated = false);\n }\n\n this.authenticated(\n {\n refreshToken: this.refreshToken,\n accessToken: this.accessToken,\n expiresAt: this.expiresAt ?? new Date(Date.now() + 60 * 1000),\n expiresIn: this.expiresIn,\n },\n this.remember\n );\n\n return (this._isAuthenticated = true);\n } else {\n this.accessToken = null;\n this.expiresAt = null;\n console.warn(\n 'The access token expires soon. Use refresh token instead.'\n );\n }\n }\n if (this.refreshToken) {\n console.debug('Refresh token is defined: ' + this.refreshToken);\n try {\n await this.signInWithRefreshToken(this.refreshToken);\n return (this._isAuthenticated = true);\n } catch (e) {\n if (![401, 403, 400].includes(e.status)) {\n console.error('Could not sign in with refresh token', e.message);\n throw e;\n }\n console.warn('Refresh token is expired');\n }\n }\n\n console.warn('Unauthenticated');\n\n return (this._isAuthenticated = false);\n }\n\n public async signInWithEmailAndPassword(\n email: string,\n password: string,\n remember: boolean\n ): Promise<OAuthMethodResponse> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n const response = await this.oAuthMethod.call({\n username: email,\n password: password,\n authEndpoint: this.authEndpoint,\n secret: this.secret,\n });\n\n this.authenticated(response, remember);\n\n return response;\n }\n\n public async getProfile<T extends Profile = Profile>(): Promise<T | null> {\n let profile: T | null = null;\n\n if (!this.accessToken) {\n throw new Error('The access token is not defined');\n }\n\n if (this.profileEndpoint) {\n try {\n profile = await this.getOAuthProfileMethod.call({\n accessToken: this.accessToken,\n profileEndpoint: this.profileEndpoint,\n });\n } catch (e) {\n console.error('Could not request the user profile', e.message);\n }\n } else {\n console.warn('The profile endpoint is not defined!');\n }\n\n return (this._profile = profile);\n }\n\n public async signOut() {\n this.clearStorage();\n this.accessToken = null;\n this.refreshToken = null;\n this.expiresAt = null;\n this._isAuthenticated = false;\n if (this.redirectSignOut) {\n await this.router.navigate(this.redirectSignOut);\n } else {\n if (!this.redirectUrl) {\n throw new Error('Redirect url is not defined');\n }\n location.replace(\n `${this.ssoUrl}?redirect=${btoa(this.redirectUrl)}&secret=${this.secret}&action=signOut`\n );\n }\n }\n\n public authenticated(\n response: OAuthStatus,\n remember: boolean = this.remember ?? false\n ): void {\n this.accessToken = response.accessToken;\n this.refreshToken = response.refreshToken ?? null;\n this.expiresAt = response.expiresAt;\n\n console.log(`Authenticated until ${this.expiresAt.toISOString()}`);\n\n this.remember = remember;\n\n if (remember) {\n this.setItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY, response.accessToken);\n if (response.refreshToken) {\n this.setItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY, response.refreshToken);\n }\n this.setItem(REMEMBER_LOCAL_STORAGE_KEY, 'true');\n if (response.expiresAt) {\n console.log(`Authenticated until ${response.expiresAt.toISOString()}`);\n this.setItem(\n EXPIRES_AT_LOCAL_STORAGE_KEY,\n response.expiresAt.getTime().toFixed(0)\n );\n }\n } else {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n\n this._isAuthenticated = true;\n }\n\n private getKey(key: string): string {\n return [this.secret, key].join('__');\n }\n\n private getItem(key: string): string | null {\n return localStorage.getItem(this.getKey(key));\n }\n\n private setItem(key: string, value: string): void {\n localStorage.setItem(this.getKey(key), value);\n }\n\n private removeItem(key: string): void {\n localStorage.removeItem(this.getKey(key));\n }\n\n protected clearStorage() {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n\n private async signInWithRefreshToken(\n refreshToken: string\n ): Promise<OAuthMethodResponse> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n const response = await this.oAuthMethod.call({\n refreshToken,\n authEndpoint: this.authEndpoint,\n secret: this.secret,\n });\n\n this.authenticated(response);\n\n return response;\n }\n}\n","import {\n ActivatedRouteSnapshot,\n CanActivate,\n UrlTree,\n Router\n} from '@angular/router';\nimport { Injectable } from '@angular/core';\nimport { OAuthService } from './o-auth.service';\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthExtractGuard implements CanActivate {\n\n constructor(\n private readonly router: Router,\n private readonly oAuthService: OAuthService\n ) {}\n\n public canActivate(route: ActivatedRouteSnapshot): UrlTree {\n\n if (route.queryParamMap.has('accessToken') && route.queryParamMap.has('refreshToken') && route.queryParamMap.has('expiresIn')) {\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const accessToken = route.queryParamMap.get('accessToken')!;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const refreshToken = route.queryParamMap.get('refreshToken')!;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const expiresIn = parseInt(route.queryParamMap.get('expiresIn')!, 10);\n const payloadBase64 = route.queryParamMap.get('payload');\n\n const expiresAt = new Date(Date.now() + expiresIn * 1000);\n\n this.oAuthService.authenticated({\n accessToken,\n refreshToken,\n expiresIn,\n expiresAt\n }, true);\n\n let redirectUrl = '/';\n\n if (payloadBase64) {\n try {\n const payload = JSON.parse(atob(payloadBase64));\n console.debug('sso redirect payload', payload);\n if (payload.lastUrl) {\n redirectUrl = payload.lastUrl;\n }\n } catch (e) {\n console.error('Could not parse redirect payload', e.message);\n }\n }\n\n return this.router.createUrlTree([ redirectUrl ]);\n\n } else {\n console.warn('Not every query parameter is defined!');\n }\n\n return this.router.createUrlTree([ ...route.url.map(url => url.path), 'redirect' ]);\n }\n\n\n}\n","import {\n ActivatedRouteSnapshot,\n CanActivate,\n CanActivateChild,\n RouterStateSnapshot,\n UrlTree\n} from '@angular/router';\nimport {\n Injectable,\n Inject,\n isDevMode\n} from '@angular/core';\nimport { OAuthService } from './o-auth.service';\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthRedirectGuard implements CanActivate, CanActivateChild {\n\n constructor(\n @Inject(OAuthService)\n private readonly oAuthService: OAuthService\n ) {\n }\n\n public async canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {\n\n const isAuthenticated = await this.oAuthService.isAuthenticated();\n\n console.log(`isAuthenticated: ${isAuthenticated}`);\n\n if (isAuthenticated) {\n return true;\n }\n\n this.oAuthService.signInWithRedirect(state.url);\n\n return false;\n\n }\n\n public canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {\n return this.canActivate(childRoute, state);\n }\n\n}\n","import {\n NgModule,\n ModuleWithProviders\n} from '@angular/core';\nimport {\n RXAP_O_AUTH_REDIRECT_SIGN_IN,\n RXAP_O_AUTH_REDIRECT_SIGN_OUT\n} from './tokens';\n\nexport interface OAuthModuleOptions {\n signInPath?: string[]\n signOutPath?: string[]\n}\n\n@NgModule()\nexport class OAuthModule {\n\n public static forRoot(options: OAuthModuleOptions = {}): ModuleWithProviders<OAuthModule> {\n return {\n ngModule: OAuthModule,\n providers: [\n {\n provide: RXAP_O_AUTH_REDIRECT_SIGN_IN,\n useValue: options.signInPath ?? [ '/', 'oauth', 'redirect' ]\n },\n {\n provide: RXAP_O_AUTH_REDIRECT_SIGN_OUT,\n useValue: options.signOutPath ?? null\n }\n ]\n };\n }\n\n}\n","import {\n Component,\n ChangeDetectionStrategy\n} from '@angular/core';\nimport { RouterOutlet } from '@angular/router';\nimport {\n trigger,\n transition,\n style,\n animate\n} from '@angular/animations';\n\n@Component({\n selector: 'rxap-container',\n templateUrl: './container.component.html',\n styleUrls: [ './container.component.scss' ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'rxap-container' },\n animations: [\n trigger('routeAnimations', [\n transition(\n ':enter',\n [\n style({ opacity: 0 }),\n animate('512ms', style({ opacity: 1 }))\n ]\n ),\n transition(\n ':leave',\n [\n style({ opacity: 1 }),\n animate('512ms', style({ opacity: 0 }))\n ]\n )\n ])\n ]\n})\nexport class ContainerComponent {\n\n public prepareRoute(outlet: RouterOutlet) {\n return outlet.isActivated ? outlet.activatedRoute : 'true';\n }\n\n}\n","<div [@routeAnimations]=\"prepareRoute(outlet)\" class=\"container\">\n\n <div class=\"split mat-elevation-z3\"></div>\n\n <router-outlet #outlet=\"outlet\"></router-outlet>\n\n</div>\n","import {\n ChangeDetectionStrategy,\n Component\n} from '@angular/core';\n\n@Component({\n selector: 'rxap-loading',\n templateUrl: './loading.component.html',\n styleUrls: [ './loading.component.scss' ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'rxap-loading' }\n})\nexport class LoadingComponent {\n}\n","<mat-progress-bar class=\"loading-bar\" mode=\"indeterminate\"></mat-progress-bar>\n","import {\n Component,\n ChangeDetectionStrategy\n} from '@angular/core';\nimport { OAuthService } from '../o-auth.service';\nimport {\n trigger,\n state,\n style,\n transition,\n animate\n} from '@angular/animations';\n\n@Component({\n selector: 'rxap-sign-in-with-redirect',\n templateUrl: './sign-in-with-redirect.component.html',\n styleUrls: [ './sign-in-with-redirect.component.scss' ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'rxap-sign-in-with-redirect' },\n animations: [\n trigger('fadeAnimation', [\n\n // the \"in\" style determines the \"resting\" state of the element when it is visible.\n state('in', style({ opacity: 1 })),\n\n // fade in when created. this could also be written as transition('void => *')\n transition(':enter', [\n style({ opacity: 0 }),\n animate(300)\n ]),\n\n // fade out when destroyed. this could also be written as transition('void => *')\n transition(\n ':leave',\n animate(300, style({ opacity: 0 }))\n )\n ])\n ]\n})\nexport class SignInWithRedirectComponent {\n\n constructor(\n private readonly authService: OAuthService\n ) {}\n\n public signIn() {\n this.authService.signInWithRedirect();\n }\n\n}\n","<div [@fadeAnimation]=\"'in'\" class=\"inner mat-elevation-z5\" fxLayout=\"column\" fxLayoutAlign=\"center center\" fxLayoutGap=\"32px\">\n\n <div class=\"header\" fxFlex=\"nogrow\" fxLayout=\"column\" fxLayoutAlign=\"center center\">\n\n <mat-icon class=\"avatar-icon\" color=\"primary\" fxFlex=\"nogrow\">account_circle</mat-icon>\n\n </div>\n\n <div fxFlex=\"nogrow\" fxLayout=\"row\" fxLayoutAlign=\"center center\">\n\n <div fxFlex=\"nogrow\">\n <button (click)=\"signIn()\" color=\"primary\" fxFlex=\"nogrow\" mat-raised-button>\n <span fxLayout=\"row\" fxLayoutAlign=\"start center\" fxLayoutGap=\"16px\">\n <mat-icon fxFlex=\"nogrow\">login</mat-icon>\n <span fxFlex=\"nogrow\">Sign In</span>\n </span>\n </button>\n </div>\n\n </div>\n\n</div>\n\n","import { Routes } from '@angular/router';\nimport {\n ContainerComponent\n} from './container/container.component';\nimport { LoadingComponent } from './loading/loading.component';\nimport { SignInWithRedirectComponent } from './sign-in-with-redirect/sign-in-with-redirect.component';\nimport { OAuthExtractGuard } from './o-auth-extract.guard';\n\nexport const RXAP_O_AUTH_ROUTES: Routes = [\n {\n path: 'oauth',\n component: ContainerComponent,\n children: [\n {\n path: 'redirect',\n component: SignInWithRedirectComponent\n },\n {\n canActivate: [ OAuthExtractGuard ],\n path: '',\n component: LoadingComponent\n },\n {\n path: '**',\n redirectTo: ''\n }\n ]\n }\n];\n","import {\n Resolve,\n Router\n} from '@angular/router';\nimport {\n Inject,\n Injectable\n} from '@angular/core';\nimport { OAuthService } from './o-auth.service';\nimport { RXAP_O_AUTH_REDIRECT_SIGN_IN } from './tokens';\n\n@Injectable({ providedIn: 'root' })\nexport class ProfileResolve<T = Record<string, any>> implements Resolve<T> {\n\n constructor(\n @Inject(OAuthService)\n private readonly oAuthService: OAuthService,\n @Inject(Router)\n private readonly router: Router,\n @Inject(RXAP_O_AUTH_REDIRECT_SIGN_IN)\n private readonly redirectLogin: string[]\n ) {\n }\n\n public async resolve(): Promise<T> {\n const profile = await this.oAuthService.getProfile();\n\n if (!profile) {\n await this.router.navigate(this.redirectLogin);\n }\n\n return profile;\n }\n\n}\n","import { NgModule } from '@angular/core';\nimport { ContainerComponent } from './container.component';\nimport { RouterModule } from '@angular/router';\n\n\n@NgModule({\n declarations: [ ContainerComponent ],\n imports: [\n RouterModule\n ],\n exports: [ ContainerComponent ]\n})\nexport class ContainerComponentModule {}\n","import { NgModule } from '@angular/core';\nimport { LoadingComponent } from './loading.component';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\n\n\n@NgModule({\n declarations: [\n LoadingComponent\n ],\n imports: [\n MatProgressBarModule\n ],\n exports: [\n LoadingComponent\n ]\n})\nexport class LoadingComponentModule {\n}\n","import { NgModule } from '@angular/core';\nimport { SignInWithRedirectComponent } from './sign-in-with-redirect.component';\nimport { MatIconModule } from '@angular/material/icon';\nimport { CommonModule } from '@angular/common';\nimport { MatCardModule } from '@angular/material/card';\nimport { FlexLayoutModule } from '@angular/flex-layout';\nimport { MatButtonModule } from '@angular/material/button';\n\n\n@NgModule({\n declarations: [ SignInWithRedirectComponent ],\n imports: [\n MatCardModule,\n MatButtonModule,\n FlexLayoutModule,\n MatIconModule,\n CommonModule\n ],\n exports: [ SignInWithRedirectComponent ]\n})\nexport class SignInWithRedirectComponentModule {}\n","import { NgModule } from '@angular/core';\nimport { ContainerComponentModule } from './container/container.component.module';\nimport { LoadingComponentModule } from './loading/loading.component.module';\nimport {\n SignInWithRedirectComponentModule\n} from './sign-in-with-redirect/sign-in-with-redirect.component.module';\n\n@NgModule({\n exports: [\n ContainerComponentModule,\n LoadingComponentModule,\n SignInWithRedirectComponentModule\n ]\n})\nexport class OAuthRoutingModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["InjectionToken","HttpClient","Injectable","Inject","Optional","HttpHeaders","Router","NgModule","trigger","transition","style","animate","Component","ChangeDetectionStrategy","state","RouterModule","MatProgressBarModule","MatCardModule","MatButtonModule","FlexLayoutModule","MatIconModule","CommonModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QASa,qBAAqB,GAAG,IAAIA,iBAAc,CACrD,uBAAuB,EACvB;;QAYA,+BAEmB,IAAgB,EAG1B,eAAqC;YAArC,gCAAA,EAAA,sBAAqC;YAH3B,SAAI,GAAJ,IAAI,CAAY;YAG1B,oBAAe,GAAf,eAAe,CAAsB;SAC1C;QAEG,oCAAI,GAAJ,UAAK,UAA2C;;YACrD,IAAM,eAAe,GAAG,MAAA,UAAU,CAAC,eAAe,mCAAI,IAAI,CAAC,eAAe,CAAC;YAE3E,IAAI,CAAC,eAAe,EAAE;gBACpB,MAAM,IAAI,KAAK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ACtB,iCAAiC;yBAClC;qBACF;;;ICbD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"rxap-oauth.umd.js","sources":["../../../../libs/oauth/src/lib/get-o-auth-profile.method.ts","../../../../node_modules/tslib/tslib.es6.js","../../../../libs/oauth/src/lib/o-auth.method.ts","../../../../libs/oauth/src/lib/tokens.ts","../../../../libs/oauth/src/lib/o-auth.service.ts","../../../../libs/oauth/src/lib/o-auth-extract.guard.ts","../../../../libs/oauth/src/lib/o-auth-redirect.guard.ts","../../../../libs/oauth/src/lib/o-auth.module.ts","../../../../libs/oauth/src/lib/container/container.component.ts","../../../../libs/oauth/src/lib/container/container.component.html","../../../../libs/oauth/src/lib/loading/loading.component.ts","../../../../libs/oauth/src/lib/loading/loading.component.html","../../../../libs/oauth/src/lib/sign-in-with-redirect/sign-in-with-redirect.component.ts","../../../../libs/oauth/src/lib/sign-in-with-redirect/sign-in-with-redirect.component.html","../../../../libs/oauth/src/lib/routes.ts","../../../../libs/oauth/src/lib/profile.resolve.ts","../../../../libs/oauth/src/lib/container/container.component.module.ts","../../../../libs/oauth/src/lib/loading/loading.component.module.ts","../../../../libs/oauth/src/lib/sign-in-with-redirect/sign-in-with-redirect.component.module.ts","../../../../libs/oauth/src/lib/o-auth-routing.module.ts","../../../../libs/oauth/src/rxap-oauth.ts"],"sourcesContent":["import {\n Inject,\n Injectable,\n InjectionToken,\n Optional\n} from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { Method } from '@rxap/utilities/rxjs';\n\nexport const PROFILE_AUTH_ENDPOINT = new InjectionToken(\n 'PROFILE_AUTH_ENDPOINT'\n);\n\nexport interface GetOAuthProfileMethodParameters {\n accessToken: string;\n profileEndpoint?: string | null;\n withCredentials?: boolean;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class GetOAuthProfileMethod<T = any>\n implements Method<T, GetOAuthProfileMethodParameters>\n{\n constructor(\n @Inject(HttpClient)\n private readonly http: HttpClient,\n @Optional()\n @Inject(PROFILE_AUTH_ENDPOINT)\n public profileEndpoint: string | null = null\n ) {}\n\n public call(parameters: GetOAuthProfileMethodParameters): Promise<T> {\n const profileEndpoint = parameters.profileEndpoint ?? this.profileEndpoint;\n\n if (!profileEndpoint) {\n throw new Error('The profile endpoint is not defined');\n }\n\n return this.http\n .get<T>(profileEndpoint, {\n headers: {\n Authorization: `Bearer ${parameters.accessToken}`,\n },\n withCredentials: parameters.withCredentials ?? true,\n })\n .toPromise();\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n 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) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from) {\r\n for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)\r\n to[j] = from[i];\r\n return to;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n 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; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n 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);\r\n 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); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","import {\n Injectable,\n Inject\n} from '@angular/core';\nimport {\n HttpClient,\n HttpHeaders\n} from '@angular/common/http';\nimport { Method } from '@rxap/utilities/rxjs';\n\nexport interface OAuthMethodWithUsernamePasswordParameters {\n grantType?: string;\n username: string;\n password: string;\n secret: string;\n clientId?: string;\n authEndpoint: string;\n}\n\nexport interface OAuthMethodWithRefreshTokenParameters {\n grantType?: string;\n refreshToken: string;\n secret: string;\n clientId?: string;\n authEndpoint: string;\n}\n\nexport type OAuthMethodParameters = (\n | OAuthMethodWithUsernamePasswordParameters\n | OAuthMethodWithRefreshTokenParameters\n) & { withCredentials?: boolean };\n\nexport function IsOAuthMethodWithRefreshTokenParameters(\n parameters: OAuthMethodParameters\n): parameters is OAuthMethodWithRefreshTokenParameters {\n // eslint-disable-next-line no-prototype-builtins\n return parameters.hasOwnProperty('refreshToken');\n}\n\nexport function IsOAuthMethodWithUsernamePasswordParameters(\n parameters: OAuthMethodParameters\n): parameters is OAuthMethodWithUsernamePasswordParameters {\n // eslint-disable-next-line no-prototype-builtins\n return (\n parameters.hasOwnProperty('username') &&\n parameters.hasOwnProperty('password')\n );\n}\n\nexport function AssertOAuthMethodWithUsernamePasswordParameters(\n parameters: OAuthMethodParameters\n): asserts parameters is OAuthMethodWithUsernamePasswordParameters {\n if (!IsOAuthMethodWithUsernamePasswordParameters(parameters)) {\n throw new Error(\n 'The grant type password requires the parameters username and password'\n );\n }\n}\n\nexport function AssertOAuthMethodWithRefreshTokenParameters(\n parameters: OAuthMethodParameters\n): asserts parameters is OAuthMethodWithRefreshTokenParameters {\n if (!IsOAuthMethodWithRefreshTokenParameters(parameters)) {\n throw new Error(\n 'The grant type refresh token requires the parameters refreshToken'\n );\n }\n}\n\nexport function AssertOAuthMethodParameters(\n parameters: any\n): asserts parameters is OAuthMethodParameters {\n if (!parameters.authEndpoint) {\n throw new Error('The authEndpoint parameter must be defined');\n }\n if (!parameters.secret) {\n throw new Error('The secret parameter must be defined');\n }\n if (parameters.grantType) {\n switch (parameters.grantType) {\n case 'password':\n AssertOAuthMethodWithUsernamePasswordParameters(parameters);\n break;\n\n case 'refresh_token':\n AssertOAuthMethodWithRefreshTokenParameters(parameters);\n break;\n\n default:\n throw new Error(\n `The grant type '${parameters.grantType}' is not supported`\n );\n }\n } else {\n if (\n !IsOAuthMethodWithRefreshTokenParameters(parameters) &&\n !IsOAuthMethodWithUsernamePasswordParameters(parameters)\n ) {\n throw new Error(\n 'Either the refresh token or the username and password must be defined'\n );\n }\n }\n}\n\nexport interface OAuthResponse {\n access_token: string;\n refresh_token: string;\n expires_in: number;\n}\n\nexport interface OAuthMethodResponse {\n accessToken: string;\n refreshToken: string;\n expiresIn: number;\n expiresAt: Date;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthMethod\n implements Method<OAuthMethodResponse, OAuthMethodParameters>\n{\n constructor(\n @Inject(HttpClient)\n private readonly http: HttpClient\n ) {}\n\n public async call(\n parameters: OAuthMethodParameters\n ): Promise<OAuthMethodResponse> {\n AssertOAuthMethodParameters(parameters);\n\n const params = new URLSearchParams();\n const grantType = this.getGrantType(parameters);\n params.append('grant_type', grantType);\n switch (grantType) {\n case 'password':\n AssertOAuthMethodWithUsernamePasswordParameters(parameters);\n params.append('username', parameters.username);\n params.append('password', parameters.password);\n break;\n\n case 'refresh_token':\n AssertOAuthMethodWithRefreshTokenParameters(parameters);\n params.append('refresh_token', parameters.refreshToken);\n break;\n\n default:\n throw new Error('Not supported grant type');\n }\n\n let headers = new HttpHeaders();\n\n headers = headers.append('Content-type', 'application/x-www-form-urlencoded; charset=utf-8');\n\n if (parameters.secret && parameters.clientId) {\n params.append('client_id', parameters.clientId);\n params.append('client_secret', parameters.secret);\n } else {\n headers = headers.append('Authorization', `Basic ${parameters.secret}`);\n }\n\n const response = await this.http\n .post<OAuthResponse>(parameters.authEndpoint, params.toString(), {\n headers,\n withCredentials: parameters.withCredentials ?? true,\n })\n .toPromise();\n\n return {\n accessToken: response.access_token,\n refreshToken: response.refresh_token,\n expiresIn: response.expires_in,\n expiresAt: new Date(Date.now() + response.expires_in * 1000),\n };\n }\n\n private getGrantType(parameters: OAuthMethodParameters) {\n if (parameters.grantType) {\n return parameters.grantType;\n }\n\n if (IsOAuthMethodWithRefreshTokenParameters(parameters)) {\n return 'refresh_token';\n }\n\n if (IsOAuthMethodWithUsernamePasswordParameters(parameters)) {\n return 'password';\n }\n\n throw new Error('Could not guess the grant type');\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport function DefaultRedirectSignInFactory(): string[] {\n return [ '/', 'authentication', 'login' ];\n}\n\nexport const RXAP_O_AUTH_REDIRECT_SIGN_IN = new InjectionToken('rxap/o-auth/redirect-sign-in', {\n providedIn: 'root',\n factory: DefaultRedirectSignInFactory\n});\n\nexport const RXAP_O_AUTH_REDIRECT_SIGN_OUT = new InjectionToken('rxap/o-auth/redirect-sign-out');\n\nexport function DefaultRedirectUrl(): string {\n return location.origin + '/oauth';\n}\n\nexport const RXAP_O_AUTH_REDIRECT_URL = new InjectionToken('rxap/o-auth/redirect-url', {\n providedIn: 'root',\n factory: DefaultRedirectUrl\n});\n","import {\n Inject,\n Injectable,\n InjectionToken,\n Optional\n} from '@angular/core';\nimport {\n GetOAuthProfileMethod,\n PROFILE_AUTH_ENDPOINT\n} from './get-o-auth-profile.method';\nimport {\n OAuthMethod,\n OAuthMethodResponse\n} from './o-auth.method';\nimport {\n RXAP_O_AUTH_REDIRECT_SIGN_OUT,\n RXAP_O_AUTH_REDIRECT_URL\n} from './tokens';\nimport { Router } from '@angular/router';\n\nexport const OAUTH_SECRET = new InjectionToken('OAUTH_SECRET');\nexport const OAUTH_AUTH_ENDPOINT = new InjectionToken('OAUTH_AUTH_ENDPOINT');\nexport const OAUTH_SSO_URL = new InjectionToken('OAUTH_SSO_URL');\nexport const OAUTH_CLIENT_ID = new InjectionToken('OAUTH_CLIENT_ID');\n\nexport const ACCESS_TOKEN_LOCAL_STORAGE_KEY = 'access_token';\nexport const REFRESH_TOKEN_LOCAL_STORAGE_KEY = 'refresh_token';\nexport const EXPIRES_AT_LOCAL_STORAGE_KEY = 'expires_at';\nexport const REMEMBER_LOCAL_STORAGE_KEY = 'remember';\n\nexport interface OAuthStatus {\n accessToken: string;\n refreshToken?: string | null;\n expiresIn: number;\n expiresAt: Date;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthService<Profile = any> {\n get expiresAt(): Date | null {\n const expiresAt = this.getItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n if (expiresAt) {\n return new Date(\n parseInt(this.getItem(EXPIRES_AT_LOCAL_STORAGE_KEY)!, 10)\n );\n }\n return null;\n }\n\n set expiresAt(value: Date | null) {\n if (value) {\n this.setItem(EXPIRES_AT_LOCAL_STORAGE_KEY, value.getTime().toFixed(0));\n } else {\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n }\n\n get refreshToken(): string | null {\n return this.getItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n }\n\n set refreshToken(value: string | null) {\n if (value) {\n this.setItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY, value);\n } else {\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n }\n }\n\n get accessToken(): string | null {\n return this.getItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n }\n\n set accessToken(value: string | null) {\n if (value) {\n this.setItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY, value);\n } else {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n }\n }\n\n /**\n * The time until the access token expires in seconds\n */\n public get expiresIn(): number | null {\n const expiresAt = this.expiresAt;\n if (expiresAt) {\n return Math.round(\n (expiresAt.getTime() - Date.now()) / 1000\n );\n }\n return null;\n }\n\n public get remember(): boolean {\n return !!this.getItem(REMEMBER_LOCAL_STORAGE_KEY);\n }\n\n public set remember(value: boolean) {\n if (value) {\n this.setItem(REMEMBER_LOCAL_STORAGE_KEY, 'true');\n } else {\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n }\n }\n\n private _profile?: Profile | null;\n\n protected _isAuthenticated: boolean | null = null;\n\n public get profile(): Profile | null | undefined {\n return this._profile;\n }\n\n constructor(\n @Inject(OAuthMethod)\n public readonly oAuthMethod: OAuthMethod,\n @Inject(GetOAuthProfileMethod)\n public readonly getOAuthProfileMethod: GetOAuthProfileMethod,\n @Inject(Router)\n private readonly router: Router,\n @Optional()\n @Inject(PROFILE_AUTH_ENDPOINT)\n public profileEndpoint: string | null = null,\n @Optional()\n @Inject(OAUTH_AUTH_ENDPOINT)\n public authEndpoint: string | null = null,\n @Optional()\n @Inject(OAUTH_SECRET)\n public secret: string | null = null,\n @Optional()\n @Inject(OAUTH_SSO_URL)\n private readonly ssoUrl: string | null = null,\n @Optional()\n @Inject(RXAP_O_AUTH_REDIRECT_SIGN_OUT)\n private readonly redirectSignOut: string[] | null = null,\n @Optional()\n @Inject(RXAP_O_AUTH_REDIRECT_URL)\n private readonly redirectUrl: string | null = null,\n @Optional()\n @Inject(OAUTH_CLIENT_ID)\n public clientId: string | null = null,\n ) {}\n\n public signInWithRedirect(lastUrl?: string): void {\n if (!this.redirectUrl) {\n throw new Error('Redirect url is not defined');\n }\n location.replace(\n `${this.ssoUrl}?redirect=${btoa(this.redirectUrl)}&secret=${\n this.secret\n }&payload=${btoa(JSON.stringify({ lastUrl }))}`\n );\n }\n\n public async isAuthenticated(): Promise<boolean> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n if (this._isAuthenticated !== null) {\n return this._isAuthenticated;\n }\n\n if (this.accessToken) {\n console.debug('Access token is defined: ' + this.accessToken);\n if (this.expiresIn && this.expiresIn > 60) {\n const profile = await this.getProfile();\n\n if (!profile) {\n console.log('profile is not defined');\n return (this._isAuthenticated = false);\n }\n\n this.authenticated(\n {\n refreshToken: this.refreshToken,\n accessToken: this.accessToken,\n expiresAt: this.expiresAt ?? new Date(Date.now() + 60 * 1000),\n expiresIn: this.expiresIn,\n },\n this.remember\n );\n\n return (this._isAuthenticated = true);\n } else {\n this.accessToken = null;\n this.expiresAt = null;\n console.warn(\n 'The access token expires soon. Use refresh token instead.'\n );\n }\n }\n if (this.refreshToken) {\n console.debug('Refresh token is defined: ' + this.refreshToken);\n try {\n await this.signInWithRefreshToken(this.refreshToken);\n return (this._isAuthenticated = true);\n } catch (e) {\n if (![401, 403, 400].includes(e.status)) {\n console.error('Could not sign in with refresh token', e.message);\n throw e;\n }\n console.warn('Refresh token is expired');\n }\n }\n\n console.warn('Unauthenticated');\n\n return (this._isAuthenticated = false);\n }\n\n public async signInWithEmailAndPassword(\n email: string,\n password: string,\n remember: boolean\n ): Promise<OAuthMethodResponse> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n const response = await this.oAuthMethod.call({\n username: email,\n password: password,\n authEndpoint: this.authEndpoint,\n secret: this.secret,\n clientId: this.clientId ?? undefined\n });\n\n this.authenticated(response, remember);\n\n return response;\n }\n\n public async getProfile<T extends Profile = Profile>(): Promise<T | null> {\n let profile: T | null = null;\n\n if (!this.accessToken) {\n throw new Error('The access token is not defined');\n }\n\n if (this.profileEndpoint) {\n try {\n profile = await this.getOAuthProfileMethod.call({\n accessToken: this.accessToken,\n profileEndpoint: this.profileEndpoint,\n });\n } catch (e) {\n console.error('Could not request the user profile', e.message);\n }\n } else {\n console.warn('The profile endpoint is not defined!');\n }\n\n return (this._profile = profile);\n }\n\n public async signOut() {\n this.clearStorage();\n this.accessToken = null;\n this.refreshToken = null;\n this.expiresAt = null;\n this._isAuthenticated = false;\n if (this.redirectSignOut) {\n await this.router.navigate(this.redirectSignOut);\n } else {\n if (!this.redirectUrl) {\n throw new Error('Redirect url is not defined');\n }\n location.replace(\n `${this.ssoUrl}?redirect=${btoa(this.redirectUrl)}&secret=${this.secret}&action=signOut`\n );\n }\n }\n\n public authenticated(\n response: OAuthStatus,\n remember: boolean = this.remember ?? false\n ): void {\n this.accessToken = response.accessToken;\n this.refreshToken = response.refreshToken ?? null;\n this.expiresAt = response.expiresAt;\n\n console.log(`Authenticated until ${this.expiresAt.toISOString()}`);\n\n this.remember = remember;\n\n if (remember) {\n this.setItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY, response.accessToken);\n if (response.refreshToken) {\n this.setItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY, response.refreshToken);\n }\n this.setItem(REMEMBER_LOCAL_STORAGE_KEY, 'true');\n if (response.expiresAt) {\n console.log(`Authenticated until ${response.expiresAt.toISOString()}`);\n this.setItem(\n EXPIRES_AT_LOCAL_STORAGE_KEY,\n response.expiresAt.getTime().toFixed(0)\n );\n }\n } else {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n\n this._isAuthenticated = true;\n }\n\n private getKey(key: string): string {\n return [this.secret, key].join('__');\n }\n\n private getItem(key: string): string | null {\n return localStorage.getItem(this.getKey(key));\n }\n\n private setItem(key: string, value: string): void {\n localStorage.setItem(this.getKey(key), value);\n }\n\n private removeItem(key: string): void {\n localStorage.removeItem(this.getKey(key));\n }\n\n protected clearStorage() {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n\n private async signInWithRefreshToken(\n refreshToken: string\n ): Promise<OAuthMethodResponse> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n const response = await this.oAuthMethod.call({\n refreshToken,\n authEndpoint: this.authEndpoint,\n secret: this.secret,\n clientId: this.clientId ?? undefined,\n });\n\n this.authenticated(response);\n\n return response;\n }\n}\n","import {\n ActivatedRouteSnapshot,\n CanActivate,\n UrlTree,\n Router\n} from '@angular/router';\nimport { Injectable } from '@angular/core';\nimport { OAuthService } from './o-auth.service';\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthExtractGuard implements CanActivate {\n\n constructor(\n private readonly router: Router,\n private readonly oAuthService: OAuthService\n ) {}\n\n public canActivate(route: ActivatedRouteSnapshot): UrlTree {\n\n if (route.queryParamMap.has('accessToken') && route.queryParamMap.has('refreshToken') && route.queryParamMap.has('expiresIn')) {\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const accessToken = route.queryParamMap.get('accessToken')!;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const refreshToken = route.queryParamMap.get('refreshToken')!;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const expiresIn = parseInt(route.queryParamMap.get('expiresIn')!, 10);\n const payloadBase64 = route.queryParamMap.get('payload');\n\n const expiresAt = new Date(Date.now() + expiresIn * 1000);\n\n this.oAuthService.authenticated({\n accessToken,\n refreshToken,\n expiresIn,\n expiresAt\n }, true);\n\n let redirectUrl = '/';\n\n if (payloadBase64) {\n try {\n const payload = JSON.parse(atob(payloadBase64));\n console.debug('sso redirect payload', payload);\n if (payload.lastUrl) {\n redirectUrl = payload.lastUrl;\n }\n } catch (e) {\n console.error('Could not parse redirect payload', e.message);\n }\n }\n\n return this.router.createUrlTree([ redirectUrl ]);\n\n } else {\n console.warn('Not every query parameter is defined!');\n }\n\n return this.router.createUrlTree([ ...route.url.map(url => url.path), 'redirect' ]);\n }\n\n\n}\n","import {\n ActivatedRouteSnapshot,\n CanActivate,\n CanActivateChild,\n RouterStateSnapshot,\n UrlTree\n} from '@angular/router';\nimport {\n Injectable,\n Inject,\n isDevMode\n} from '@angular/core';\nimport { OAuthService } from './o-auth.service';\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthRedirectGuard implements CanActivate, CanActivateChild {\n\n constructor(\n @Inject(OAuthService)\n private readonly oAuthService: OAuthService\n ) {\n }\n\n public async canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {\n\n const isAuthenticated = await this.oAuthService.isAuthenticated();\n\n console.log(`isAuthenticated: ${isAuthenticated}`);\n\n if (isAuthenticated) {\n return true;\n }\n\n this.oAuthService.signInWithRedirect(state.url);\n\n return false;\n\n }\n\n public canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {\n return this.canActivate(childRoute, state);\n }\n\n}\n","import {\n NgModule,\n ModuleWithProviders\n} from '@angular/core';\nimport {\n RXAP_O_AUTH_REDIRECT_SIGN_IN,\n RXAP_O_AUTH_REDIRECT_SIGN_OUT\n} from './tokens';\n\nexport interface OAuthModuleOptions {\n signInPath?: string[]\n signOutPath?: string[]\n}\n\n@NgModule()\nexport class OAuthModule {\n\n public static forRoot(options: OAuthModuleOptions = {}): ModuleWithProviders<OAuthModule> {\n return {\n ngModule: OAuthModule,\n providers: [\n {\n provide: RXAP_O_AUTH_REDIRECT_SIGN_IN,\n useValue: options.signInPath ?? [ '/', 'oauth', 'redirect' ]\n },\n {\n provide: RXAP_O_AUTH_REDIRECT_SIGN_OUT,\n useValue: options.signOutPath ?? null\n }\n ]\n };\n }\n\n}\n","import {\n Component,\n ChangeDetectionStrategy\n} from '@angular/core';\nimport { RouterOutlet } from '@angular/router';\nimport {\n trigger,\n transition,\n style,\n animate\n} from '@angular/animations';\n\n@Component({\n selector: 'rxap-container',\n templateUrl: './container.component.html',\n styleUrls: [ './container.component.scss' ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'rxap-container' },\n animations: [\n trigger('routeAnimations', [\n transition(\n ':enter',\n [\n style({ opacity: 0 }),\n animate('512ms', style({ opacity: 1 }))\n ]\n ),\n transition(\n ':leave',\n [\n style({ opacity: 1 }),\n animate('512ms', style({ opacity: 0 }))\n ]\n )\n ])\n ]\n})\nexport class ContainerComponent {\n\n public prepareRoute(outlet: RouterOutlet) {\n return outlet.isActivated ? outlet.activatedRoute : 'true';\n }\n\n}\n","<div [@routeAnimations]=\"prepareRoute(outlet)\" class=\"container\">\n\n <div class=\"split mat-elevation-z3\"></div>\n\n <router-outlet #outlet=\"outlet\"></router-outlet>\n\n</div>\n","import {\n ChangeDetectionStrategy,\n Component\n} from '@angular/core';\n\n@Component({\n selector: 'rxap-loading',\n templateUrl: './loading.component.html',\n styleUrls: [ './loading.component.scss' ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'rxap-loading' }\n})\nexport class LoadingComponent {\n}\n","<mat-progress-bar class=\"loading-bar\" mode=\"indeterminate\"></mat-progress-bar>\n","import {\n Component,\n ChangeDetectionStrategy\n} from '@angular/core';\nimport { OAuthService } from '../o-auth.service';\nimport {\n trigger,\n state,\n style,\n transition,\n animate\n} from '@angular/animations';\n\n@Component({\n selector: 'rxap-sign-in-with-redirect',\n templateUrl: './sign-in-with-redirect.component.html',\n styleUrls: [ './sign-in-with-redirect.component.scss' ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'rxap-sign-in-with-redirect' },\n animations: [\n trigger('fadeAnimation', [\n\n // the \"in\" style determines the \"resting\" state of the element when it is visible.\n state('in', style({ opacity: 1 })),\n\n // fade in when created. this could also be written as transition('void => *')\n transition(':enter', [\n style({ opacity: 0 }),\n animate(300)\n ]),\n\n // fade out when destroyed. this could also be written as transition('void => *')\n transition(\n ':leave',\n animate(300, style({ opacity: 0 }))\n )\n ])\n ]\n})\nexport class SignInWithRedirectComponent {\n\n constructor(\n private readonly authService: OAuthService\n ) {}\n\n public signIn() {\n this.authService.signInWithRedirect();\n }\n\n}\n","<div [@fadeAnimation]=\"'in'\" class=\"inner mat-elevation-z5\" fxLayout=\"column\" fxLayoutAlign=\"center center\" fxLayoutGap=\"32px\">\n\n <div class=\"header\" fxFlex=\"nogrow\" fxLayout=\"column\" fxLayoutAlign=\"center center\">\n\n <mat-icon class=\"avatar-icon\" color=\"primary\" fxFlex=\"nogrow\">account_circle</mat-icon>\n\n </div>\n\n <div fxFlex=\"nogrow\" fxLayout=\"row\" fxLayoutAlign=\"center center\">\n\n <div fxFlex=\"nogrow\">\n <button (click)=\"signIn()\" color=\"primary\" fxFlex=\"nogrow\" mat-raised-button>\n <span fxLayout=\"row\" fxLayoutAlign=\"start center\" fxLayoutGap=\"16px\">\n <mat-icon fxFlex=\"nogrow\">login</mat-icon>\n <span fxFlex=\"nogrow\">Sign In</span>\n </span>\n </button>\n </div>\n\n </div>\n\n</div>\n\n","import { Routes } from '@angular/router';\nimport {\n ContainerComponent\n} from './container/container.component';\nimport { LoadingComponent } from './loading/loading.component';\nimport { SignInWithRedirectComponent } from './sign-in-with-redirect/sign-in-with-redirect.component';\nimport { OAuthExtractGuard } from './o-auth-extract.guard';\n\nexport const RXAP_O_AUTH_ROUTES: Routes = [\n {\n path: 'oauth',\n component: ContainerComponent,\n children: [\n {\n path: 'redirect',\n component: SignInWithRedirectComponent\n },\n {\n canActivate: [ OAuthExtractGuard ],\n path: '',\n component: LoadingComponent\n },\n {\n path: '**',\n redirectTo: ''\n }\n ]\n }\n];\n","import {\n Resolve,\n Router\n} from '@angular/router';\nimport {\n Inject,\n Injectable\n} from '@angular/core';\nimport { OAuthService } from './o-auth.service';\nimport { RXAP_O_AUTH_REDIRECT_SIGN_IN } from './tokens';\n\n@Injectable({ providedIn: 'root' })\nexport class ProfileResolve<T = Record<string, any>> implements Resolve<T> {\n\n constructor(\n @Inject(OAuthService)\n private readonly oAuthService: OAuthService,\n @Inject(Router)\n private readonly router: Router,\n @Inject(RXAP_O_AUTH_REDIRECT_SIGN_IN)\n private readonly redirectLogin: string[]\n ) {\n }\n\n public async resolve(): Promise<T> {\n const profile = await this.oAuthService.getProfile();\n\n if (!profile) {\n await this.router.navigate(this.redirectLogin);\n }\n\n return profile;\n }\n\n}\n","import { NgModule } from '@angular/core';\nimport { ContainerComponent } from './container.component';\nimport { RouterModule } from '@angular/router';\n\n\n@NgModule({\n declarations: [ ContainerComponent ],\n imports: [\n RouterModule\n ],\n exports: [ ContainerComponent ]\n})\nexport class ContainerComponentModule {}\n","import { NgModule } from '@angular/core';\nimport { LoadingComponent } from './loading.component';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\n\n\n@NgModule({\n declarations: [\n LoadingComponent\n ],\n imports: [\n MatProgressBarModule\n ],\n exports: [\n LoadingComponent\n ]\n})\nexport class LoadingComponentModule {\n}\n","import { NgModule } from '@angular/core';\nimport { SignInWithRedirectComponent } from './sign-in-with-redirect.component';\nimport { MatIconModule } from '@angular/material/icon';\nimport { CommonModule } from '@angular/common';\nimport { MatCardModule } from '@angular/material/card';\nimport { FlexLayoutModule } from '@angular/flex-layout';\nimport { MatButtonModule } from '@angular/material/button';\n\n\n@NgModule({\n declarations: [ SignInWithRedirectComponent ],\n imports: [\n MatCardModule,\n MatButtonModule,\n FlexLayoutModule,\n MatIconModule,\n CommonModule\n ],\n exports: [ SignInWithRedirectComponent ]\n})\nexport class SignInWithRedirectComponentModule {}\n","import { NgModule } from '@angular/core';\nimport { ContainerComponentModule } from './container/container.component.module';\nimport { LoadingComponentModule } from './loading/loading.component.module';\nimport {\n SignInWithRedirectComponentModule\n} from './sign-in-with-redirect/sign-in-with-redirect.component.module';\n\n@NgModule({\n exports: [\n ContainerComponentModule,\n LoadingComponentModule,\n SignInWithRedirectComponentModule\n ]\n})\nexport class OAuthRoutingModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["InjectionToken","HttpClient","Injectable","Inject","Optional","HttpHeaders","Router","NgModule","trigger","transition","style","animate","Component","ChangeDetectionStrategy","state","RouterModule","MatProgressBarModule","MatCardModule","MatButtonModule","FlexLayoutModule","MatIconModule","CommonModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QASa,qBAAqB,GAAG,IAAIA,iBAAc,CACrD,uBAAuB,EACvB;;QAYA,+BAEmB,IAAgB,EAG1B,eAAqC;YAArC,gCAAA,EAAA,sBAAqC;YAH3B,SAAI,GAAJ,IAAI,CAAY;YAG1B,oBAAe,GAAf,eAAe,CAAsB;SAC1C;QAEG,oCAAI,GAAJ,UAAK,UAA2C;;YACrD,IAAM,eAAe,GAAG,MAAA,UAAU,CAAC,eAAe,mCAAI,IAAI,CAAC,eAAe,CAAC;YAE3E,IAAI,CAAC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AAa;YACbC,kBAAe;YACfC,2BAAgB;YAChBC,gBAAa;YACbC,mBAAY,aAEE,2BAA2B;0JAEhC,iCAAiC,YAT9B;gBACZJ,kBAAa;gBACbC,kBAAe;gBACfC,2BAAgB;gBAChBC,gBAAa;gBACbC,mBAAY;aACb;sHAGU,iCAAiC;sBAX7Cd,WAAQ;uBAAC;wBACR,YAAY,EAAE,CAAE,2BAA2B,CAAE;wBAC7C,OAAO,EAAO;4BACZU,kBAAa;4BACbC,kBAAe;4BACfC,2BAAgB;4BAChBC,gBAAa;4BACbC,mBAAY;yBACb;wBACD,OAAO,EAAO,CAAE,2BAA2B,CAAE;qBAC9C;;;;QCLD;;;;0IAAa,kBAAkB;2IAAlB,kBAAkB,YAL3B,wBAAwB;YACxB,sBAAsB;YACtB,iCAAiC;2IAGxB,kBAAkB,YAL3B,wBAAwB;YACxB,sBAAsB;YACtB,iCAAiC;sHAGxB,kBAAkB;sBAP9Bd,WAAQ;uBAAC;wBACR,OAAO,EAAE;4BACP,wBAAwB;4BACxB,sBAAsB;4BACtB,iCAAiC;yBAClC;qBACF;;;ICbD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -72,10 +72,15 @@ export class OAuthMethod {
72
72
  default:
73
73
  throw new Error('Not supported grant type');
74
74
  }
75
- const headers = new HttpHeaders({
76
- 'Content-type': 'application/x-www-form-urlencoded; charset=utf-8',
77
- Authorization: `Basic ${parameters.secret}`,
78
- });
75
+ let headers = new HttpHeaders();
76
+ headers = headers.append('Content-type', 'application/x-www-form-urlencoded; charset=utf-8');
77
+ if (parameters.secret && parameters.clientId) {
78
+ params.append('client_id', parameters.clientId);
79
+ params.append('client_secret', parameters.secret);
80
+ }
81
+ else {
82
+ headers = headers.append('Authorization', `Basic ${parameters.secret}`);
83
+ }
79
84
  const response = yield this.http
80
85
  .post(parameters.authEndpoint, params.toString(), {
81
86
  headers,
@@ -1 +1 @@
1
- {"version":3,"file":"o-auth.method.js","source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I;iBAC7B,IAAI,CAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE;gBAC/D,OAAO;gBACP,eAAe,EAAE,MAAA,UAAU,CAAC,eAAe,mCAAI,IAAI;aACpD,CAAC;iBACD,SAAS,EAAE,CAAC;YAEf,OAAO;gBACL,WAAW,EAAE,QAAQ,CAAC,YAAY;gBAClC,YAAY,EAAE,QAAQ,CAAC,aAAa;gBACpC,SAAS,EAAE,QAAQ,CAAC,UAAU;gBAC9B,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC;aAC7D,CAAC;;KACH;IAEO,YAAY,CAAC,UAAiC;QACpD,IAAI,UAAU,CAAC,SAAS,EAAE;YACxB,OAAO,UAAU,CAAC,SAAS,CAAC;SAC7B;QAED,IAAI,uCAAuC,CAAC,UAAU,CAAC,EAAE;YACvD,OAAO,eAAe,CAAC;SACxB;QAED,IAAI,2CAA2C,CAAC,UAAU,CAAC,EAAE;YAC3D,OAAO,UAAU,CAAC;SACnB;QAED,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;;yGAlEU,WAAW,kBAIZ,UAAU;6GAJT,WAAW,cADE,MAAM;4FACnB,WAAW;kBADvB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;0BAK7B,MAAM;2BAAC,UAAU","sourcesContent":["import {\n Injectable,\n Inject\n} from '@angular/core';\nimport {\n HttpClient,\n HttpHeaders\n} from '@angular/common/http';\nimport { Method } from '@rxap/utilities/rxjs';\n\nexport interface OAuthMethodWithUsernamePasswordParameters {\n grantType?: string;\n username: string;\n password: string;\n secret: string;\n authEndpoint: string;\n}\n\nexport interface OAuthMethodWithRefreshTokenParameters {\n grantType?: string;\n refreshToken: string;\n secret: string;\n authEndpoint: string;\n}\n\nexport type OAuthMethodParameters = (\n | OAuthMethodWithUsernamePasswordParameters\n | OAuthMethodWithRefreshTokenParameters\n) & { withCredentials?: boolean };\n\nexport function IsOAuthMethodWithRefreshTokenParameters(\n parameters: OAuthMethodParameters\n): parameters is OAuthMethodWithRefreshTokenParameters {\n // eslint-disable-next-line no-prototype-builtins\n return parameters.hasOwnProperty('refreshToken');\n}\n\nexport function IsOAuthMethodWithUsernamePasswordParameters(\n parameters: OAuthMethodParameters\n): parameters is OAuthMethodWithUsernamePasswordParameters {\n // eslint-disable-next-line no-prototype-builtins\n return (\n parameters.hasOwnProperty('username') &&\n parameters.hasOwnProperty('password')\n );\n}\n\nexport function AssertOAuthMethodWithUsernamePasswordParameters(\n parameters: OAuthMethodParameters\n): asserts parameters is OAuthMethodWithUsernamePasswordParameters {\n if (!IsOAuthMethodWithUsernamePasswordParameters(parameters)) {\n throw new Error(\n 'The grant type password requires the parameters username and password'\n );\n }\n}\n\nexport function AssertOAuthMethodWithRefreshTokenParameters(\n parameters: OAuthMethodParameters\n): asserts parameters is OAuthMethodWithRefreshTokenParameters {\n if (!IsOAuthMethodWithRefreshTokenParameters(parameters)) {\n throw new Error(\n 'The grant type refresh token requires the parameters refreshToken'\n );\n }\n}\n\nexport function AssertOAuthMethodParameters(\n parameters: any\n): asserts parameters is OAuthMethodParameters {\n if (!parameters.authEndpoint) {\n throw new Error('The authEndpoint parameter must be defined');\n }\n if (!parameters.secret) {\n throw new Error('The secret parameter must be defined');\n }\n if (parameters.grantType) {\n switch (parameters.grantType) {\n case 'password':\n AssertOAuthMethodWithUsernamePasswordParameters(parameters);\n break;\n\n case 'refresh_token':\n AssertOAuthMethodWithRefreshTokenParameters(parameters);\n break;\n\n default:\n throw new Error(\n `The grant type '${parameters.grantType}' is not supported`\n );\n }\n } else {\n if (\n !IsOAuthMethodWithRefreshTokenParameters(parameters) &&\n !IsOAuthMethodWithUsernamePasswordParameters(parameters)\n ) {\n throw new Error(\n 'Either the refresh token or the username and password must be defined'\n );\n }\n }\n}\n\nexport interface OAuthResponse {\n access_token: string;\n refresh_token: string;\n expires_in: number;\n}\n\nexport interface OAuthMethodResponse {\n accessToken: string;\n refreshToken: string;\n expiresIn: number;\n expiresAt: Date;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthMethod\n implements Method<OAuthMethodResponse, OAuthMethodParameters>\n{\n constructor(\n @Inject(HttpClient)\n private readonly http: HttpClient\n ) {}\n\n public async call(\n parameters: OAuthMethodParameters\n ): Promise<OAuthMethodResponse> {\n AssertOAuthMethodParameters(parameters);\n\n const params = new URLSearchParams();\n const grantType = this.getGrantType(parameters);\n params.append('grant_type', grantType);\n switch (grantType) {\n case 'password':\n AssertOAuthMethodWithUsernamePasswordParameters(parameters);\n params.append('username', parameters.username);\n params.append('password', parameters.password);\n break;\n\n case 'refresh_token':\n AssertOAuthMethodWithRefreshTokenParameters(parameters);\n params.append('refresh_token', parameters.refreshToken);\n break;\n\n default:\n throw new Error('Not supported grant type');\n }\n\n const headers = new HttpHeaders({\n 'Content-type': 'application/x-www-form-urlencoded; charset=utf-8',\n Authorization: `Basic ${parameters.secret}`,\n });\n\n const response = await this.http\n .post<OAuthResponse>(parameters.authEndpoint, params.toString(), {\n headers,\n withCredentials: parameters.withCredentials ?? true,\n })\n .toPromise();\n\n return {\n accessToken: response.access_token,\n refreshToken: response.refresh_token,\n expiresIn: response.expires_in,\n expiresAt: new Date(Date.now() + response.expires_in * 1000),\n };\n }\n\n private getGrantType(parameters: OAuthMethodParameters) {\n if (parameters.grantType) {\n return parameters.grantType;\n }\n\n if (IsOAuthMethodWithRefreshTokenParameters(parameters)) {\n return 'refresh_token';\n }\n\n if (IsOAuthMethodWithUsernamePasswordParameters(parameters)) {\n return 'password';\n }\n\n throw new Error('Could not guess the grant type');\n }\n}\n"]}
1
+ {"version":3,"file":"o-auth.method.js","sourceRoot":"","sources":["../../../../../libs/oauth/src/lib/o-auth.method.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,MAAM,EACP,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,UAA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,CAAC,CAAC;aACnD;iBAAM;gBACL,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,SAAS,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;aACzE;YAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI;iBAC7B,IAAI,CAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE;gBAC/D,OAAO;gBACP,eAAe,EAAE,MAAA,UAAU,CAAC,eAAe,mCAAI,IAAI;aACpD,CAAC;iBACD,SAAS,EAAE,CAAC;YAEf,OAAO;gBACL,WAAW,EAAE,QAAQ,CAAC,YAAY;gBAClC,YAAY,EAAE,QAAQ,CAAC,aAAa;gBACpC,SAAS,EAAE,QAAQ,CAAC,UAAU;gBAC9B,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC;aAC7D,CAAC;;KACH;IAEO,YAAY,CAAC,UAAiC;QACpD,IAAI,UAAU,CAAC,SAAS,EAAE;YACxB,OAAO,UAAU,CAAC,SAAS,CAAC;SAC7B;QAED,IAAI,uCAAuC,CAAC,UAAU,CAAC,EAAE;YACvD,OAAO,eAAe,CAAC;SACxB;QAED,IAAI,2CAA2C,CAAC,UAAU,CAAC,EAAE;YAC3D,OAAO,UAAU,CAAC;SACnB;QAED,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;;yGAxEU,WAAW,kBAIZ,UAAU;6GAJT,WAAW,cADE,MAAM;4FACnB,WAAW;kBADvB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;0BAK7B,MAAM;2BAAC,UAAU","sourcesContent":["import {\n Injectable,\n Inject\n} from '@angular/core';\nimport {\n HttpClient,\n HttpHeaders\n} from '@angular/common/http';\nimport { Method } from '@rxap/utilities/rxjs';\n\nexport interface OAuthMethodWithUsernamePasswordParameters {\n grantType?: string;\n username: string;\n password: string;\n secret: string;\n clientId?: string;\n authEndpoint: string;\n}\n\nexport interface OAuthMethodWithRefreshTokenParameters {\n grantType?: string;\n refreshToken: string;\n secret: string;\n clientId?: string;\n authEndpoint: string;\n}\n\nexport type OAuthMethodParameters = (\n | OAuthMethodWithUsernamePasswordParameters\n | OAuthMethodWithRefreshTokenParameters\n) & { withCredentials?: boolean };\n\nexport function IsOAuthMethodWithRefreshTokenParameters(\n parameters: OAuthMethodParameters\n): parameters is OAuthMethodWithRefreshTokenParameters {\n // eslint-disable-next-line no-prototype-builtins\n return parameters.hasOwnProperty('refreshToken');\n}\n\nexport function IsOAuthMethodWithUsernamePasswordParameters(\n parameters: OAuthMethodParameters\n): parameters is OAuthMethodWithUsernamePasswordParameters {\n // eslint-disable-next-line no-prototype-builtins\n return (\n parameters.hasOwnProperty('username') &&\n parameters.hasOwnProperty('password')\n );\n}\n\nexport function AssertOAuthMethodWithUsernamePasswordParameters(\n parameters: OAuthMethodParameters\n): asserts parameters is OAuthMethodWithUsernamePasswordParameters {\n if (!IsOAuthMethodWithUsernamePasswordParameters(parameters)) {\n throw new Error(\n 'The grant type password requires the parameters username and password'\n );\n }\n}\n\nexport function AssertOAuthMethodWithRefreshTokenParameters(\n parameters: OAuthMethodParameters\n): asserts parameters is OAuthMethodWithRefreshTokenParameters {\n if (!IsOAuthMethodWithRefreshTokenParameters(parameters)) {\n throw new Error(\n 'The grant type refresh token requires the parameters refreshToken'\n );\n }\n}\n\nexport function AssertOAuthMethodParameters(\n parameters: any\n): asserts parameters is OAuthMethodParameters {\n if (!parameters.authEndpoint) {\n throw new Error('The authEndpoint parameter must be defined');\n }\n if (!parameters.secret) {\n throw new Error('The secret parameter must be defined');\n }\n if (parameters.grantType) {\n switch (parameters.grantType) {\n case 'password':\n AssertOAuthMethodWithUsernamePasswordParameters(parameters);\n break;\n\n case 'refresh_token':\n AssertOAuthMethodWithRefreshTokenParameters(parameters);\n break;\n\n default:\n throw new Error(\n `The grant type '${parameters.grantType}' is not supported`\n );\n }\n } else {\n if (\n !IsOAuthMethodWithRefreshTokenParameters(parameters) &&\n !IsOAuthMethodWithUsernamePasswordParameters(parameters)\n ) {\n throw new Error(\n 'Either the refresh token or the username and password must be defined'\n );\n }\n }\n}\n\nexport interface OAuthResponse {\n access_token: string;\n refresh_token: string;\n expires_in: number;\n}\n\nexport interface OAuthMethodResponse {\n accessToken: string;\n refreshToken: string;\n expiresIn: number;\n expiresAt: Date;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthMethod\n implements Method<OAuthMethodResponse, OAuthMethodParameters>\n{\n constructor(\n @Inject(HttpClient)\n private readonly http: HttpClient\n ) {}\n\n public async call(\n parameters: OAuthMethodParameters\n ): Promise<OAuthMethodResponse> {\n AssertOAuthMethodParameters(parameters);\n\n const params = new URLSearchParams();\n const grantType = this.getGrantType(parameters);\n params.append('grant_type', grantType);\n switch (grantType) {\n case 'password':\n AssertOAuthMethodWithUsernamePasswordParameters(parameters);\n params.append('username', parameters.username);\n params.append('password', parameters.password);\n break;\n\n case 'refresh_token':\n AssertOAuthMethodWithRefreshTokenParameters(parameters);\n params.append('refresh_token', parameters.refreshToken);\n break;\n\n default:\n throw new Error('Not supported grant type');\n }\n\n let headers = new HttpHeaders();\n\n headers = headers.append('Content-type', 'application/x-www-form-urlencoded; charset=utf-8');\n\n if (parameters.secret && parameters.clientId) {\n params.append('client_id', parameters.clientId);\n params.append('client_secret', parameters.secret);\n } else {\n headers = headers.append('Authorization', `Basic ${parameters.secret}`);\n }\n\n const response = await this.http\n .post<OAuthResponse>(parameters.authEndpoint, params.toString(), {\n headers,\n withCredentials: parameters.withCredentials ?? true,\n })\n .toPromise();\n\n return {\n accessToken: response.access_token,\n refreshToken: response.refresh_token,\n expiresIn: response.expires_in,\n expiresAt: new Date(Date.now() + response.expires_in * 1000),\n };\n }\n\n private getGrantType(parameters: OAuthMethodParameters) {\n if (parameters.grantType) {\n return parameters.grantType;\n }\n\n if (IsOAuthMethodWithRefreshTokenParameters(parameters)) {\n return 'refresh_token';\n }\n\n if (IsOAuthMethodWithUsernamePasswordParameters(parameters)) {\n return 'password';\n }\n\n throw new Error('Could not guess the grant type');\n }\n}\n"]}
@@ -11,12 +11,13 @@ import * as i3 from "@angular/router";
11
11
  export const OAUTH_SECRET = new InjectionToken('OAUTH_SECRET');
12
12
  export const OAUTH_AUTH_ENDPOINT = new InjectionToken('OAUTH_AUTH_ENDPOINT');
13
13
  export const OAUTH_SSO_URL = new InjectionToken('OAUTH_SSO_URL');
14
+ export const OAUTH_CLIENT_ID = new InjectionToken('OAUTH_CLIENT_ID');
14
15
  export const ACCESS_TOKEN_LOCAL_STORAGE_KEY = 'access_token';
15
16
  export const REFRESH_TOKEN_LOCAL_STORAGE_KEY = 'refresh_token';
16
17
  export const EXPIRES_AT_LOCAL_STORAGE_KEY = 'expires_at';
17
18
  export const REMEMBER_LOCAL_STORAGE_KEY = 'remember';
18
19
  export class OAuthService {
19
- constructor(oAuthMethod, getOAuthProfileMethod, router, profileEndpoint = null, authEndpoint = null, secret = null, ssoUrl = null, redirectSignOut = null, redirectUrl = null) {
20
+ constructor(oAuthMethod, getOAuthProfileMethod, router, profileEndpoint = null, authEndpoint = null, secret = null, ssoUrl = null, redirectSignOut = null, redirectUrl = null, clientId = null) {
20
21
  this.oAuthMethod = oAuthMethod;
21
22
  this.getOAuthProfileMethod = getOAuthProfileMethod;
22
23
  this.router = router;
@@ -26,6 +27,7 @@ export class OAuthService {
26
27
  this.ssoUrl = ssoUrl;
27
28
  this.redirectSignOut = redirectSignOut;
28
29
  this.redirectUrl = redirectUrl;
30
+ this.clientId = clientId;
29
31
  this._isAuthenticated = null;
30
32
  }
31
33
  get expiresAt() {
@@ -148,6 +150,7 @@ export class OAuthService {
148
150
  });
149
151
  }
150
152
  signInWithEmailAndPassword(email, password, remember) {
153
+ var _a;
151
154
  return __awaiter(this, void 0, void 0, function* () {
152
155
  if (!this.secret) {
153
156
  throw new Error('The oauth secret is not defined');
@@ -160,6 +163,7 @@ export class OAuthService {
160
163
  password: password,
161
164
  authEndpoint: this.authEndpoint,
162
165
  secret: this.secret,
166
+ clientId: (_a = this.clientId) !== null && _a !== void 0 ? _a : undefined
163
167
  });
164
168
  this.authenticated(response, remember);
165
169
  return response;
@@ -252,6 +256,7 @@ export class OAuthService {
252
256
  this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);
253
257
  }
254
258
  signInWithRefreshToken(refreshToken) {
259
+ var _a;
255
260
  return __awaiter(this, void 0, void 0, function* () {
256
261
  if (!this.secret) {
257
262
  throw new Error('The oauth secret is not defined');
@@ -263,13 +268,14 @@ export class OAuthService {
263
268
  refreshToken,
264
269
  authEndpoint: this.authEndpoint,
265
270
  secret: this.secret,
271
+ clientId: (_a = this.clientId) !== null && _a !== void 0 ? _a : undefined,
266
272
  });
267
273
  this.authenticated(response);
268
274
  return response;
269
275
  });
270
276
  }
271
277
  }
272
- OAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OAuthService, deps: [{ token: OAuthMethod }, { token: GetOAuthProfileMethod }, { token: Router }, { token: PROFILE_AUTH_ENDPOINT, optional: true }, { token: OAUTH_AUTH_ENDPOINT, optional: true }, { token: OAUTH_SECRET, optional: true }, { token: OAUTH_SSO_URL, optional: true }, { token: RXAP_O_AUTH_REDIRECT_SIGN_OUT, optional: true }, { token: RXAP_O_AUTH_REDIRECT_URL, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
278
+ OAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OAuthService, deps: [{ token: OAuthMethod }, { token: GetOAuthProfileMethod }, { token: Router }, { token: PROFILE_AUTH_ENDPOINT, optional: true }, { token: OAUTH_AUTH_ENDPOINT, optional: true }, { token: OAUTH_SECRET, optional: true }, { token: OAUTH_SSO_URL, optional: true }, { token: RXAP_O_AUTH_REDIRECT_SIGN_OUT, optional: true }, { token: RXAP_O_AUTH_REDIRECT_URL, optional: true }, { token: OAUTH_CLIENT_ID, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
273
279
  OAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OAuthService, providedIn: 'root' });
274
280
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OAuthService, decorators: [{
275
281
  type: Injectable,
@@ -313,5 +319,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
313
319
  }, {
314
320
  type: Inject,
315
321
  args: [RXAP_O_AUTH_REDIRECT_URL]
322
+ }] }, { type: undefined, decorators: [{
323
+ type: Optional
324
+ }, {
325
+ type: Inject,
326
+ args: [OAUTH_CLIENT_ID]
316
327
  }] }]; } });
317
328
  //# sourceMappingURL=o-auth.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"o-auth.service.js","sourceRoot":"","sources":["../../../../../libs/oauth/src/lib/o-auth.service.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,MAAM,EACN,UAAU,EACV,cAAc,EACd,QAAQ,EACT,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,WAAW,EAEZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;;;;;AAEzC,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,cAAc,CAAC,cAAc,CAAC,CAAC;AAC/D,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,cAAc,CAAC,qBAAqB,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,cAAc,CAAC,eAAe,CAAC,CAAC;AAEjE,MAAM,CAAC,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aACpD;YAED,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;gBACtB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;aAC3D;YAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;gBAC3C,YAAY;gBACZ,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB,CAAC,CAAC;YAEH,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YAE7B,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;;0GA/TU,YAAY,kBA6Eb,WAAW,aAEX,qBAAqB,aAErB,MAAM,aAGN,qBAAqB,6BAGrB,mBAAmB,6BAGnB,YAAY,6BAGZ,aAAa,6BAGb,6BAA6B,6BAG7B,wBAAwB;8GAnGvB,YAAY,cADC,MAAM;4FACnB,YAAY;kBADxB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;0BA8E7B,MAAM;2BAAC,WAAW;;0BAElB,MAAM;2BAAC,qBAAqB;;0BAE5B,MAAM;2BAAC,MAAM;;0BAEb,QAAQ;;0BACR,MAAM;2BAAC,qBAAqB;;0BAE5B,QAAQ;;0BACR,MAAM;2BAAC,mBAAmB;;0BAE1B,QAAQ;;0BACR,MAAM;2BAAC,YAAY;;0BAEnB,QAAQ;;0BACR,MAAM;2BAAC,aAAa;;0BAEpB,QAAQ;;0BACR,MAAM;2BAAC,6BAA6B;;0BAEpC,QAAQ;;0BACR,MAAM;2BAAC,wBAAwB","sourcesContent":["import {\n Inject,\n Injectable,\n InjectionToken,\n Optional\n} from '@angular/core';\nimport {\n GetOAuthProfileMethod,\n PROFILE_AUTH_ENDPOINT\n} from './get-o-auth-profile.method';\nimport {\n OAuthMethod,\n OAuthMethodResponse\n} from './o-auth.method';\nimport {\n RXAP_O_AUTH_REDIRECT_SIGN_OUT,\n RXAP_O_AUTH_REDIRECT_URL\n} from './tokens';\nimport { Router } from '@angular/router';\n\nexport const OAUTH_SECRET = new InjectionToken('OAUTH_SECRET');\nexport const OAUTH_AUTH_ENDPOINT = new InjectionToken('OAUTH_AUTH_ENDPOINT');\nexport const OAUTH_SSO_URL = new InjectionToken('OAUTH_SSO_URL');\n\nexport const ACCESS_TOKEN_LOCAL_STORAGE_KEY = 'access_token';\nexport const REFRESH_TOKEN_LOCAL_STORAGE_KEY = 'refresh_token';\nexport const EXPIRES_AT_LOCAL_STORAGE_KEY = 'expires_at';\nexport const REMEMBER_LOCAL_STORAGE_KEY = 'remember';\n\nexport interface OAuthStatus {\n accessToken: string;\n refreshToken?: string | null;\n expiresIn: number;\n expiresAt: Date;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthService<Profile = any> {\n get expiresAt(): Date | null {\n const expiresAt = this.getItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n if (expiresAt) {\n return new Date(\n parseInt(this.getItem(EXPIRES_AT_LOCAL_STORAGE_KEY)!, 10)\n );\n }\n return null;\n }\n\n set expiresAt(value: Date | null) {\n if (value) {\n this.setItem(EXPIRES_AT_LOCAL_STORAGE_KEY, value.getTime().toFixed(0));\n } else {\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n }\n\n get refreshToken(): string | null {\n return this.getItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n }\n\n set refreshToken(value: string | null) {\n if (value) {\n this.setItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY, value);\n } else {\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n }\n }\n\n get accessToken(): string | null {\n return this.getItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n }\n\n set accessToken(value: string | null) {\n if (value) {\n this.setItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY, value);\n } else {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n }\n }\n\n /**\n * The time until the access token expires in seconds\n */\n public get expiresIn(): number | null {\n const expiresAt = this.expiresAt;\n if (expiresAt) {\n return Math.round(\n (expiresAt.getTime() - Date.now()) / 1000\n );\n }\n return null;\n }\n\n public get remember(): boolean {\n return !!this.getItem(REMEMBER_LOCAL_STORAGE_KEY);\n }\n\n public set remember(value: boolean) {\n if (value) {\n this.setItem(REMEMBER_LOCAL_STORAGE_KEY, 'true');\n } else {\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n }\n }\n\n private _profile?: Profile | null;\n\n protected _isAuthenticated: boolean | null = null;\n\n public get profile(): Profile | null | undefined {\n return this._profile;\n }\n\n constructor(\n @Inject(OAuthMethod)\n public readonly oAuthMethod: OAuthMethod,\n @Inject(GetOAuthProfileMethod)\n public readonly getOAuthProfileMethod: GetOAuthProfileMethod,\n @Inject(Router)\n private readonly router: Router,\n @Optional()\n @Inject(PROFILE_AUTH_ENDPOINT)\n public profileEndpoint: string | null = null,\n @Optional()\n @Inject(OAUTH_AUTH_ENDPOINT)\n public authEndpoint: string | null = null,\n @Optional()\n @Inject(OAUTH_SECRET)\n public secret: string | null = null,\n @Optional()\n @Inject(OAUTH_SSO_URL)\n private readonly ssoUrl: string | null = null,\n @Optional()\n @Inject(RXAP_O_AUTH_REDIRECT_SIGN_OUT)\n private readonly redirectSignOut: string[] | null = null,\n @Optional()\n @Inject(RXAP_O_AUTH_REDIRECT_URL)\n private readonly redirectUrl: string | null = null\n ) {}\n\n public signInWithRedirect(lastUrl?: string): void {\n if (!this.redirectUrl) {\n throw new Error('Redirect url is not defined');\n }\n location.replace(\n `${this.ssoUrl}?redirect=${btoa(this.redirectUrl)}&secret=${\n this.secret\n }&payload=${btoa(JSON.stringify({ lastUrl }))}`\n );\n }\n\n public async isAuthenticated(): Promise<boolean> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n if (this._isAuthenticated !== null) {\n return this._isAuthenticated;\n }\n\n if (this.accessToken) {\n console.debug('Access token is defined: ' + this.accessToken);\n if (this.expiresIn && this.expiresIn > 60) {\n const profile = await this.getProfile();\n\n if (!profile) {\n console.log('profile is not defined');\n return (this._isAuthenticated = false);\n }\n\n this.authenticated(\n {\n refreshToken: this.refreshToken,\n accessToken: this.accessToken,\n expiresAt: this.expiresAt ?? new Date(Date.now() + 60 * 1000),\n expiresIn: this.expiresIn,\n },\n this.remember\n );\n\n return (this._isAuthenticated = true);\n } else {\n this.accessToken = null;\n this.expiresAt = null;\n console.warn(\n 'The access token expires soon. Use refresh token instead.'\n );\n }\n }\n if (this.refreshToken) {\n console.debug('Refresh token is defined: ' + this.refreshToken);\n try {\n await this.signInWithRefreshToken(this.refreshToken);\n return (this._isAuthenticated = true);\n } catch (e) {\n if (![401, 403, 400].includes(e.status)) {\n console.error('Could not sign in with refresh token', e.message);\n throw e;\n }\n console.warn('Refresh token is expired');\n }\n }\n\n console.warn('Unauthenticated');\n\n return (this._isAuthenticated = false);\n }\n\n public async signInWithEmailAndPassword(\n email: string,\n password: string,\n remember: boolean\n ): Promise<OAuthMethodResponse> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n const response = await this.oAuthMethod.call({\n username: email,\n password: password,\n authEndpoint: this.authEndpoint,\n secret: this.secret,\n });\n\n this.authenticated(response, remember);\n\n return response;\n }\n\n public async getProfile<T extends Profile = Profile>(): Promise<T | null> {\n let profile: T | null = null;\n\n if (!this.accessToken) {\n throw new Error('The access token is not defined');\n }\n\n if (this.profileEndpoint) {\n try {\n profile = await this.getOAuthProfileMethod.call({\n accessToken: this.accessToken,\n profileEndpoint: this.profileEndpoint,\n });\n } catch (e) {\n console.error('Could not request the user profile', e.message);\n }\n } else {\n console.warn('The profile endpoint is not defined!');\n }\n\n return (this._profile = profile);\n }\n\n public async signOut() {\n this.clearStorage();\n this.accessToken = null;\n this.refreshToken = null;\n this.expiresAt = null;\n this._isAuthenticated = false;\n if (this.redirectSignOut) {\n await this.router.navigate(this.redirectSignOut);\n } else {\n if (!this.redirectUrl) {\n throw new Error('Redirect url is not defined');\n }\n location.replace(\n `${this.ssoUrl}?redirect=${btoa(this.redirectUrl)}&secret=${this.secret}&action=signOut`\n );\n }\n }\n\n public authenticated(\n response: OAuthStatus,\n remember: boolean = this.remember ?? false\n ): void {\n this.accessToken = response.accessToken;\n this.refreshToken = response.refreshToken ?? null;\n this.expiresAt = response.expiresAt;\n\n console.log(`Authenticated until ${this.expiresAt.toISOString()}`);\n\n this.remember = remember;\n\n if (remember) {\n this.setItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY, response.accessToken);\n if (response.refreshToken) {\n this.setItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY, response.refreshToken);\n }\n this.setItem(REMEMBER_LOCAL_STORAGE_KEY, 'true');\n if (response.expiresAt) {\n console.log(`Authenticated until ${response.expiresAt.toISOString()}`);\n this.setItem(\n EXPIRES_AT_LOCAL_STORAGE_KEY,\n response.expiresAt.getTime().toFixed(0)\n );\n }\n } else {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n\n this._isAuthenticated = true;\n }\n\n private getKey(key: string): string {\n return [this.secret, key].join('__');\n }\n\n private getItem(key: string): string | null {\n return localStorage.getItem(this.getKey(key));\n }\n\n private setItem(key: string, value: string): void {\n localStorage.setItem(this.getKey(key), value);\n }\n\n private removeItem(key: string): void {\n localStorage.removeItem(this.getKey(key));\n }\n\n protected clearStorage() {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n\n private async signInWithRefreshToken(\n refreshToken: string\n ): Promise<OAuthMethodResponse> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n const response = await this.oAuthMethod.call({\n refreshToken,\n authEndpoint: this.authEndpoint,\n secret: this.secret,\n });\n\n this.authenticated(response);\n\n return response;\n }\n}\n"]}
1
+ {"version":3,"file":"o-auth.service.js","sourceRoot":"","sources":["../../../../../libs/oauth/src/lib/o-auth.service.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,MAAM,EACN,UAAU,EACV,cAAc,EACd,QAAQ,EACT,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,WAAW,EAEZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;;;;;AAEzC,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,cAAc,CAAC,cAAc,CAAC,CAAC;AAC/D,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,cAAc,CAAC,qBAAqB,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,cAAc,CAAC,eAAe,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,cAAc,CAAC,iBAAiB,CAAC,CAAC;AAErE,MAAM,CAAC,MAAM,8BAA8B,GAAG,cAAc,CAAC;AAC7D,MAAM,CAAC,MAAM,+BAA+B,GAAG,eAAe,CAAC;AAC/D,MAAM,CAAC,MAAM,4BAA4B,GAAG,YAAY,CAAC;AACzD,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC;AAUrD,MAAM,OAAO,YAAY;IA4EvB,YAEkB,WAAwB,EAExB,qBAA4C,EAE3C,MAAc,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AAC,IAAI,CAAC;gBAC3C,YAAY;gBACZ,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,QAAQ,EAAE,MAAA,IAAI,CAAC,QAAQ,mCAAI,SAAS;aACrC,CAAC,CAAC;YAEH,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YAE7B,OAAO,QAAQ,CAAC;;KACjB;;0GApUU,YAAY,kBA6Eb,WAAW,aAEX,qBAAqB,aAErB,MAAM,aAGN,qBAAqB,6BAGrB,mBAAmB,6BAGnB,YAAY,6BAGZ,aAAa,6BAGb,6BAA6B,6BAG7B,wBAAwB,6BAGxB,eAAe;8GAtGd,YAAY,cADC,MAAM;4FACnB,YAAY;kBADxB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;0BA8E7B,MAAM;2BAAC,WAAW;;0BAElB,MAAM;2BAAC,qBAAqB;;0BAE5B,MAAM;2BAAC,MAAM;;0BAEb,QAAQ;;0BACR,MAAM;2BAAC,qBAAqB;;0BAE5B,QAAQ;;0BACR,MAAM;2BAAC,mBAAmB;;0BAE1B,QAAQ;;0BACR,MAAM;2BAAC,YAAY;;0BAEnB,QAAQ;;0BACR,MAAM;2BAAC,aAAa;;0BAEpB,QAAQ;;0BACR,MAAM;2BAAC,6BAA6B;;0BAEpC,QAAQ;;0BACR,MAAM;2BAAC,wBAAwB;;0BAE/B,QAAQ;;0BACR,MAAM;2BAAC,eAAe","sourcesContent":["import {\n Inject,\n Injectable,\n InjectionToken,\n Optional\n} from '@angular/core';\nimport {\n GetOAuthProfileMethod,\n PROFILE_AUTH_ENDPOINT\n} from './get-o-auth-profile.method';\nimport {\n OAuthMethod,\n OAuthMethodResponse\n} from './o-auth.method';\nimport {\n RXAP_O_AUTH_REDIRECT_SIGN_OUT,\n RXAP_O_AUTH_REDIRECT_URL\n} from './tokens';\nimport { Router } from '@angular/router';\n\nexport const OAUTH_SECRET = new InjectionToken('OAUTH_SECRET');\nexport const OAUTH_AUTH_ENDPOINT = new InjectionToken('OAUTH_AUTH_ENDPOINT');\nexport const OAUTH_SSO_URL = new InjectionToken('OAUTH_SSO_URL');\nexport const OAUTH_CLIENT_ID = new InjectionToken('OAUTH_CLIENT_ID');\n\nexport const ACCESS_TOKEN_LOCAL_STORAGE_KEY = 'access_token';\nexport const REFRESH_TOKEN_LOCAL_STORAGE_KEY = 'refresh_token';\nexport const EXPIRES_AT_LOCAL_STORAGE_KEY = 'expires_at';\nexport const REMEMBER_LOCAL_STORAGE_KEY = 'remember';\n\nexport interface OAuthStatus {\n accessToken: string;\n refreshToken?: string | null;\n expiresIn: number;\n expiresAt: Date;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthService<Profile = any> {\n get expiresAt(): Date | null {\n const expiresAt = this.getItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n if (expiresAt) {\n return new Date(\n parseInt(this.getItem(EXPIRES_AT_LOCAL_STORAGE_KEY)!, 10)\n );\n }\n return null;\n }\n\n set expiresAt(value: Date | null) {\n if (value) {\n this.setItem(EXPIRES_AT_LOCAL_STORAGE_KEY, value.getTime().toFixed(0));\n } else {\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n }\n\n get refreshToken(): string | null {\n return this.getItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n }\n\n set refreshToken(value: string | null) {\n if (value) {\n this.setItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY, value);\n } else {\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n }\n }\n\n get accessToken(): string | null {\n return this.getItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n }\n\n set accessToken(value: string | null) {\n if (value) {\n this.setItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY, value);\n } else {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n }\n }\n\n /**\n * The time until the access token expires in seconds\n */\n public get expiresIn(): number | null {\n const expiresAt = this.expiresAt;\n if (expiresAt) {\n return Math.round(\n (expiresAt.getTime() - Date.now()) / 1000\n );\n }\n return null;\n }\n\n public get remember(): boolean {\n return !!this.getItem(REMEMBER_LOCAL_STORAGE_KEY);\n }\n\n public set remember(value: boolean) {\n if (value) {\n this.setItem(REMEMBER_LOCAL_STORAGE_KEY, 'true');\n } else {\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n }\n }\n\n private _profile?: Profile | null;\n\n protected _isAuthenticated: boolean | null = null;\n\n public get profile(): Profile | null | undefined {\n return this._profile;\n }\n\n constructor(\n @Inject(OAuthMethod)\n public readonly oAuthMethod: OAuthMethod,\n @Inject(GetOAuthProfileMethod)\n public readonly getOAuthProfileMethod: GetOAuthProfileMethod,\n @Inject(Router)\n private readonly router: Router,\n @Optional()\n @Inject(PROFILE_AUTH_ENDPOINT)\n public profileEndpoint: string | null = null,\n @Optional()\n @Inject(OAUTH_AUTH_ENDPOINT)\n public authEndpoint: string | null = null,\n @Optional()\n @Inject(OAUTH_SECRET)\n public secret: string | null = null,\n @Optional()\n @Inject(OAUTH_SSO_URL)\n private readonly ssoUrl: string | null = null,\n @Optional()\n @Inject(RXAP_O_AUTH_REDIRECT_SIGN_OUT)\n private readonly redirectSignOut: string[] | null = null,\n @Optional()\n @Inject(RXAP_O_AUTH_REDIRECT_URL)\n private readonly redirectUrl: string | null = null,\n @Optional()\n @Inject(OAUTH_CLIENT_ID)\n public clientId: string | null = null,\n ) {}\n\n public signInWithRedirect(lastUrl?: string): void {\n if (!this.redirectUrl) {\n throw new Error('Redirect url is not defined');\n }\n location.replace(\n `${this.ssoUrl}?redirect=${btoa(this.redirectUrl)}&secret=${\n this.secret\n }&payload=${btoa(JSON.stringify({ lastUrl }))}`\n );\n }\n\n public async isAuthenticated(): Promise<boolean> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n if (this._isAuthenticated !== null) {\n return this._isAuthenticated;\n }\n\n if (this.accessToken) {\n console.debug('Access token is defined: ' + this.accessToken);\n if (this.expiresIn && this.expiresIn > 60) {\n const profile = await this.getProfile();\n\n if (!profile) {\n console.log('profile is not defined');\n return (this._isAuthenticated = false);\n }\n\n this.authenticated(\n {\n refreshToken: this.refreshToken,\n accessToken: this.accessToken,\n expiresAt: this.expiresAt ?? new Date(Date.now() + 60 * 1000),\n expiresIn: this.expiresIn,\n },\n this.remember\n );\n\n return (this._isAuthenticated = true);\n } else {\n this.accessToken = null;\n this.expiresAt = null;\n console.warn(\n 'The access token expires soon. Use refresh token instead.'\n );\n }\n }\n if (this.refreshToken) {\n console.debug('Refresh token is defined: ' + this.refreshToken);\n try {\n await this.signInWithRefreshToken(this.refreshToken);\n return (this._isAuthenticated = true);\n } catch (e) {\n if (![401, 403, 400].includes(e.status)) {\n console.error('Could not sign in with refresh token', e.message);\n throw e;\n }\n console.warn('Refresh token is expired');\n }\n }\n\n console.warn('Unauthenticated');\n\n return (this._isAuthenticated = false);\n }\n\n public async signInWithEmailAndPassword(\n email: string,\n password: string,\n remember: boolean\n ): Promise<OAuthMethodResponse> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n const response = await this.oAuthMethod.call({\n username: email,\n password: password,\n authEndpoint: this.authEndpoint,\n secret: this.secret,\n clientId: this.clientId ?? undefined\n });\n\n this.authenticated(response, remember);\n\n return response;\n }\n\n public async getProfile<T extends Profile = Profile>(): Promise<T | null> {\n let profile: T | null = null;\n\n if (!this.accessToken) {\n throw new Error('The access token is not defined');\n }\n\n if (this.profileEndpoint) {\n try {\n profile = await this.getOAuthProfileMethod.call({\n accessToken: this.accessToken,\n profileEndpoint: this.profileEndpoint,\n });\n } catch (e) {\n console.error('Could not request the user profile', e.message);\n }\n } else {\n console.warn('The profile endpoint is not defined!');\n }\n\n return (this._profile = profile);\n }\n\n public async signOut() {\n this.clearStorage();\n this.accessToken = null;\n this.refreshToken = null;\n this.expiresAt = null;\n this._isAuthenticated = false;\n if (this.redirectSignOut) {\n await this.router.navigate(this.redirectSignOut);\n } else {\n if (!this.redirectUrl) {\n throw new Error('Redirect url is not defined');\n }\n location.replace(\n `${this.ssoUrl}?redirect=${btoa(this.redirectUrl)}&secret=${this.secret}&action=signOut`\n );\n }\n }\n\n public authenticated(\n response: OAuthStatus,\n remember: boolean = this.remember ?? false\n ): void {\n this.accessToken = response.accessToken;\n this.refreshToken = response.refreshToken ?? null;\n this.expiresAt = response.expiresAt;\n\n console.log(`Authenticated until ${this.expiresAt.toISOString()}`);\n\n this.remember = remember;\n\n if (remember) {\n this.setItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY, response.accessToken);\n if (response.refreshToken) {\n this.setItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY, response.refreshToken);\n }\n this.setItem(REMEMBER_LOCAL_STORAGE_KEY, 'true');\n if (response.expiresAt) {\n console.log(`Authenticated until ${response.expiresAt.toISOString()}`);\n this.setItem(\n EXPIRES_AT_LOCAL_STORAGE_KEY,\n response.expiresAt.getTime().toFixed(0)\n );\n }\n } else {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n\n this._isAuthenticated = true;\n }\n\n private getKey(key: string): string {\n return [this.secret, key].join('__');\n }\n\n private getItem(key: string): string | null {\n return localStorage.getItem(this.getKey(key));\n }\n\n private setItem(key: string, value: string): void {\n localStorage.setItem(this.getKey(key), value);\n }\n\n private removeItem(key: string): void {\n localStorage.removeItem(this.getKey(key));\n }\n\n protected clearStorage() {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n\n private async signInWithRefreshToken(\n refreshToken: string\n ): Promise<OAuthMethodResponse> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n const response = await this.oAuthMethod.call({\n refreshToken,\n authEndpoint: this.authEndpoint,\n secret: this.secret,\n clientId: this.clientId ?? undefined,\n });\n\n this.authenticated(response);\n\n return response;\n }\n}\n"]}
@@ -123,10 +123,15 @@ class OAuthMethod {
123
123
  default:
124
124
  throw new Error('Not supported grant type');
125
125
  }
126
- const headers = new HttpHeaders({
127
- 'Content-type': 'application/x-www-form-urlencoded; charset=utf-8',
128
- Authorization: `Basic ${parameters.secret}`,
129
- });
126
+ let headers = new HttpHeaders();
127
+ headers = headers.append('Content-type', 'application/x-www-form-urlencoded; charset=utf-8');
128
+ if (parameters.secret && parameters.clientId) {
129
+ params.append('client_id', parameters.clientId);
130
+ params.append('client_secret', parameters.secret);
131
+ }
132
+ else {
133
+ headers = headers.append('Authorization', `Basic ${parameters.secret}`);
134
+ }
130
135
  const response = yield this.http
131
136
  .post(parameters.authEndpoint, params.toString(), {
132
137
  headers,
@@ -183,12 +188,13 @@ const RXAP_O_AUTH_REDIRECT_URL = new InjectionToken('rxap/o-auth/redirect-url',
183
188
  const OAUTH_SECRET = new InjectionToken('OAUTH_SECRET');
184
189
  const OAUTH_AUTH_ENDPOINT = new InjectionToken('OAUTH_AUTH_ENDPOINT');
185
190
  const OAUTH_SSO_URL = new InjectionToken('OAUTH_SSO_URL');
191
+ const OAUTH_CLIENT_ID = new InjectionToken('OAUTH_CLIENT_ID');
186
192
  const ACCESS_TOKEN_LOCAL_STORAGE_KEY = 'access_token';
187
193
  const REFRESH_TOKEN_LOCAL_STORAGE_KEY = 'refresh_token';
188
194
  const EXPIRES_AT_LOCAL_STORAGE_KEY = 'expires_at';
189
195
  const REMEMBER_LOCAL_STORAGE_KEY = 'remember';
190
196
  class OAuthService {
191
- constructor(oAuthMethod, getOAuthProfileMethod, router, profileEndpoint = null, authEndpoint = null, secret = null, ssoUrl = null, redirectSignOut = null, redirectUrl = null) {
197
+ constructor(oAuthMethod, getOAuthProfileMethod, router, profileEndpoint = null, authEndpoint = null, secret = null, ssoUrl = null, redirectSignOut = null, redirectUrl = null, clientId = null) {
192
198
  this.oAuthMethod = oAuthMethod;
193
199
  this.getOAuthProfileMethod = getOAuthProfileMethod;
194
200
  this.router = router;
@@ -198,6 +204,7 @@ class OAuthService {
198
204
  this.ssoUrl = ssoUrl;
199
205
  this.redirectSignOut = redirectSignOut;
200
206
  this.redirectUrl = redirectUrl;
207
+ this.clientId = clientId;
201
208
  this._isAuthenticated = null;
202
209
  }
203
210
  get expiresAt() {
@@ -320,6 +327,7 @@ class OAuthService {
320
327
  });
321
328
  }
322
329
  signInWithEmailAndPassword(email, password, remember) {
330
+ var _a;
323
331
  return __awaiter(this, void 0, void 0, function* () {
324
332
  if (!this.secret) {
325
333
  throw new Error('The oauth secret is not defined');
@@ -332,6 +340,7 @@ class OAuthService {
332
340
  password: password,
333
341
  authEndpoint: this.authEndpoint,
334
342
  secret: this.secret,
343
+ clientId: (_a = this.clientId) !== null && _a !== void 0 ? _a : undefined
335
344
  });
336
345
  this.authenticated(response, remember);
337
346
  return response;
@@ -424,6 +433,7 @@ class OAuthService {
424
433
  this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);
425
434
  }
426
435
  signInWithRefreshToken(refreshToken) {
436
+ var _a;
427
437
  return __awaiter(this, void 0, void 0, function* () {
428
438
  if (!this.secret) {
429
439
  throw new Error('The oauth secret is not defined');
@@ -435,13 +445,14 @@ class OAuthService {
435
445
  refreshToken,
436
446
  authEndpoint: this.authEndpoint,
437
447
  secret: this.secret,
448
+ clientId: (_a = this.clientId) !== null && _a !== void 0 ? _a : undefined,
438
449
  });
439
450
  this.authenticated(response);
440
451
  return response;
441
452
  });
442
453
  }
443
454
  }
444
- OAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OAuthService, deps: [{ token: OAuthMethod }, { token: GetOAuthProfileMethod }, { token: Router }, { token: PROFILE_AUTH_ENDPOINT, optional: true }, { token: OAUTH_AUTH_ENDPOINT, optional: true }, { token: OAUTH_SECRET, optional: true }, { token: OAUTH_SSO_URL, optional: true }, { token: RXAP_O_AUTH_REDIRECT_SIGN_OUT, optional: true }, { token: RXAP_O_AUTH_REDIRECT_URL, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
455
+ OAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OAuthService, deps: [{ token: OAuthMethod }, { token: GetOAuthProfileMethod }, { token: Router }, { token: PROFILE_AUTH_ENDPOINT, optional: true }, { token: OAUTH_AUTH_ENDPOINT, optional: true }, { token: OAUTH_SECRET, optional: true }, { token: OAUTH_SSO_URL, optional: true }, { token: RXAP_O_AUTH_REDIRECT_SIGN_OUT, optional: true }, { token: RXAP_O_AUTH_REDIRECT_URL, optional: true }, { token: OAUTH_CLIENT_ID, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
445
456
  OAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OAuthService, providedIn: 'root' });
446
457
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OAuthService, decorators: [{
447
458
  type: Injectable,
@@ -485,6 +496,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
485
496
  }, {
486
497
  type: Inject,
487
498
  args: [RXAP_O_AUTH_REDIRECT_URL]
499
+ }] }, { type: undefined, decorators: [{
500
+ type: Optional
501
+ }, {
502
+ type: Inject,
503
+ args: [OAUTH_CLIENT_ID]
488
504
  }] }]; } });
489
505
 
490
506
  class OAuthExtractGuard {
@@ -840,5 +856,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
840
856
  * Generated bundle index. Do not edit.
841
857
  */
842
858
 
843
- export { ACCESS_TOKEN_LOCAL_STORAGE_KEY, AssertOAuthMethodParameters, AssertOAuthMethodWithRefreshTokenParameters, AssertOAuthMethodWithUsernamePasswordParameters, ContainerComponent, ContainerComponentModule, DefaultRedirectSignInFactory, DefaultRedirectUrl, EXPIRES_AT_LOCAL_STORAGE_KEY, GetOAuthProfileMethod, IsOAuthMethodWithRefreshTokenParameters, IsOAuthMethodWithUsernamePasswordParameters, LoadingComponent, LoadingComponentModule, OAUTH_AUTH_ENDPOINT, OAUTH_SECRET, OAUTH_SSO_URL, OAuthExtractGuard, OAuthMethod, OAuthModule, OAuthRedirectGuard, OAuthRoutingModule, OAuthService, PROFILE_AUTH_ENDPOINT, ProfileResolve, REFRESH_TOKEN_LOCAL_STORAGE_KEY, REMEMBER_LOCAL_STORAGE_KEY, RXAP_O_AUTH_REDIRECT_SIGN_IN, RXAP_O_AUTH_REDIRECT_SIGN_OUT, RXAP_O_AUTH_REDIRECT_URL, RXAP_O_AUTH_ROUTES, SignInWithRedirectComponent, SignInWithRedirectComponentModule };
859
+ export { ACCESS_TOKEN_LOCAL_STORAGE_KEY, AssertOAuthMethodParameters, AssertOAuthMethodWithRefreshTokenParameters, AssertOAuthMethodWithUsernamePasswordParameters, ContainerComponent, ContainerComponentModule, DefaultRedirectSignInFactory, DefaultRedirectUrl, EXPIRES_AT_LOCAL_STORAGE_KEY, GetOAuthProfileMethod, IsOAuthMethodWithRefreshTokenParameters, IsOAuthMethodWithUsernamePasswordParameters, LoadingComponent, LoadingComponentModule, OAUTH_AUTH_ENDPOINT, OAUTH_CLIENT_ID, OAUTH_SECRET, OAUTH_SSO_URL, OAuthExtractGuard, OAuthMethod, OAuthModule, OAuthRedirectGuard, OAuthRoutingModule, OAuthService, PROFILE_AUTH_ENDPOINT, ProfileResolve, REFRESH_TOKEN_LOCAL_STORAGE_KEY, REMEMBER_LOCAL_STORAGE_KEY, RXAP_O_AUTH_REDIRECT_SIGN_IN, RXAP_O_AUTH_REDIRECT_SIGN_OUT, RXAP_O_AUTH_REDIRECT_URL, RXAP_O_AUTH_ROUTES, SignInWithRedirectComponent, SignInWithRedirectComponentModule };
844
860
  //# sourceMappingURL=rxap-oauth.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rxap-oauth.js","sources":["../../../../libs/oauth/src/lib/get-o-auth-profile.method.ts","../../../../libs/oauth/src/lib/o-auth.method.ts","../../../../libs/oauth/src/lib/tokens.ts","../../../../libs/oauth/src/lib/o-auth.service.ts","../../../../libs/oauth/src/lib/o-auth-extract.guard.ts","../../../../libs/oauth/src/lib/o-auth-redirect.guard.ts","../../../../libs/oauth/src/lib/o-auth.module.ts","../../../../libs/oauth/src/lib/container/container.component.ts","../../../../libs/oauth/src/lib/container/container.component.html","../../../../libs/oauth/src/lib/loading/loading.component.ts","../../../../libs/oauth/src/lib/loading/loading.component.html","../../../../libs/oauth/src/lib/sign-in-with-redirect/sign-in-with-redirect.component.ts","../../../../libs/oauth/src/lib/sign-in-with-redirect/sign-in-with-redirect.component.html","../../../../libs/oauth/src/lib/routes.ts","../../../../libs/oauth/src/lib/profile.resolve.ts","../../../../libs/oauth/src/lib/container/container.component.module.ts","../../../../libs/oauth/src/lib/loading/loading.component.module.ts","../../../../libs/oauth/src/lib/sign-in-with-redirect/sign-in-with-redirect.component.module.ts","../../../../libs/oauth/src/lib/o-auth-routing.module.ts","../../../../libs/oauth/src/rxap-oauth.ts"],"sourcesContent":["import {\n Inject,\n Injectable,\n InjectionToken,\n Optional\n} from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { Method } from '@rxap/utilities/rxjs';\n\nexport const PROFILE_AUTH_ENDPOINT = new InjectionToken(\n 'PROFILE_AUTH_ENDPOINT'\n);\n\nexport interface GetOAuthProfileMethodParameters {\n accessToken: string;\n profileEndpoint?: string | null;\n withCredentials?: boolean;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class GetOAuthProfileMethod<T = any>\n implements Method<T, GetOAuthProfileMethodParameters>\n{\n constructor(\n @Inject(HttpClient)\n private readonly http: HttpClient,\n @Optional()\n @Inject(PROFILE_AUTH_ENDPOINT)\n public profileEndpoint: string | null = null\n ) {}\n\n public call(parameters: GetOAuthProfileMethodParameters): Promise<T> {\n const profileEndpoint = parameters.profileEndpoint ?? this.profileEndpoint;\n\n if (!profileEndpoint) {\n throw new Error('The profile endpoint is not defined');\n }\n\n return this.http\n .get<T>(profileEndpoint, {\n headers: {\n Authorization: `Bearer ${parameters.accessToken}`,\n },\n withCredentials: parameters.withCredentials ?? true,\n })\n .toPromise();\n }\n}\n","import {\n Injectable,\n Inject\n} from '@angular/core';\nimport {\n HttpClient,\n HttpHeaders\n} from '@angular/common/http';\nimport { Method } from '@rxap/utilities/rxjs';\n\nexport interface OAuthMethodWithUsernamePasswordParameters {\n grantType?: string;\n username: string;\n password: string;\n secret: string;\n authEndpoint: string;\n}\n\nexport interface OAuthMethodWithRefreshTokenParameters {\n grantType?: string;\n refreshToken: string;\n secret: string;\n authEndpoint: string;\n}\n\nexport type OAuthMethodParameters = (\n | OAuthMethodWithUsernamePasswordParameters\n | OAuthMethodWithRefreshTokenParameters\n) & { withCredentials?: boolean };\n\nexport function IsOAuthMethodWithRefreshTokenParameters(\n parameters: OAuthMethodParameters\n): parameters is OAuthMethodWithRefreshTokenParameters {\n // eslint-disable-next-line no-prototype-builtins\n return parameters.hasOwnProperty('refreshToken');\n}\n\nexport function IsOAuthMethodWithUsernamePasswordParameters(\n parameters: OAuthMethodParameters\n): parameters is OAuthMethodWithUsernamePasswordParameters {\n // eslint-disable-next-line no-prototype-builtins\n return (\n parameters.hasOwnProperty('username') &&\n parameters.hasOwnProperty('password')\n );\n}\n\nexport function AssertOAuthMethodWithUsernamePasswordParameters(\n parameters: OAuthMethodParameters\n): asserts parameters is OAuthMethodWithUsernamePasswordParameters {\n if (!IsOAuthMethodWithUsernamePasswordParameters(parameters)) {\n throw new Error(\n 'The grant type password requires the parameters username and password'\n );\n }\n}\n\nexport function AssertOAuthMethodWithRefreshTokenParameters(\n parameters: OAuthMethodParameters\n): asserts parameters is OAuthMethodWithRefreshTokenParameters {\n if (!IsOAuthMethodWithRefreshTokenParameters(parameters)) {\n throw new Error(\n 'The grant type refresh token requires the parameters refreshToken'\n );\n }\n}\n\nexport function AssertOAuthMethodParameters(\n parameters: any\n): asserts parameters is OAuthMethodParameters {\n if (!parameters.authEndpoint) {\n throw new Error('The authEndpoint parameter must be defined');\n }\n if (!parameters.secret) {\n throw new Error('The secret parameter must be defined');\n }\n if (parameters.grantType) {\n switch (parameters.grantType) {\n case 'password':\n AssertOAuthMethodWithUsernamePasswordParameters(parameters);\n break;\n\n case 'refresh_token':\n AssertOAuthMethodWithRefreshTokenParameters(parameters);\n break;\n\n default:\n throw new Error(\n `The grant type '${parameters.grantType}' is not supported`\n );\n }\n } else {\n if (\n !IsOAuthMethodWithRefreshTokenParameters(parameters) &&\n !IsOAuthMethodWithUsernamePasswordParameters(parameters)\n ) {\n throw new Error(\n 'Either the refresh token or the username and password must be defined'\n );\n }\n }\n}\n\nexport interface OAuthResponse {\n access_token: string;\n refresh_token: string;\n expires_in: number;\n}\n\nexport interface OAuthMethodResponse {\n accessToken: string;\n refreshToken: string;\n expiresIn: number;\n expiresAt: Date;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthMethod\n implements Method<OAuthMethodResponse, OAuthMethodParameters>\n{\n constructor(\n @Inject(HttpClient)\n private readonly http: HttpClient\n ) {}\n\n public async call(\n parameters: OAuthMethodParameters\n ): Promise<OAuthMethodResponse> {\n AssertOAuthMethodParameters(parameters);\n\n const params = new URLSearchParams();\n const grantType = this.getGrantType(parameters);\n params.append('grant_type', grantType);\n switch (grantType) {\n case 'password':\n AssertOAuthMethodWithUsernamePasswordParameters(parameters);\n params.append('username', parameters.username);\n params.append('password', parameters.password);\n break;\n\n case 'refresh_token':\n AssertOAuthMethodWithRefreshTokenParameters(parameters);\n params.append('refresh_token', parameters.refreshToken);\n break;\n\n default:\n throw new Error('Not supported grant type');\n }\n\n const headers = new HttpHeaders({\n 'Content-type': 'application/x-www-form-urlencoded; charset=utf-8',\n Authorization: `Basic ${parameters.secret}`,\n });\n\n const response = await this.http\n .post<OAuthResponse>(parameters.authEndpoint, params.toString(), {\n headers,\n withCredentials: parameters.withCredentials ?? true,\n })\n .toPromise();\n\n return {\n accessToken: response.access_token,\n refreshToken: response.refresh_token,\n expiresIn: response.expires_in,\n expiresAt: new Date(Date.now() + response.expires_in * 1000),\n };\n }\n\n private getGrantType(parameters: OAuthMethodParameters) {\n if (parameters.grantType) {\n return parameters.grantType;\n }\n\n if (IsOAuthMethodWithRefreshTokenParameters(parameters)) {\n return 'refresh_token';\n }\n\n if (IsOAuthMethodWithUsernamePasswordParameters(parameters)) {\n return 'password';\n }\n\n throw new Error('Could not guess the grant type');\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport function DefaultRedirectSignInFactory(): string[] {\n return [ '/', 'authentication', 'login' ];\n}\n\nexport const RXAP_O_AUTH_REDIRECT_SIGN_IN = new InjectionToken('rxap/o-auth/redirect-sign-in', {\n providedIn: 'root',\n factory: DefaultRedirectSignInFactory\n});\n\nexport const RXAP_O_AUTH_REDIRECT_SIGN_OUT = new InjectionToken('rxap/o-auth/redirect-sign-out');\n\nexport function DefaultRedirectUrl(): string {\n return location.origin + '/oauth';\n}\n\nexport const RXAP_O_AUTH_REDIRECT_URL = new InjectionToken('rxap/o-auth/redirect-url', {\n providedIn: 'root',\n factory: DefaultRedirectUrl\n});\n","import {\n Inject,\n Injectable,\n InjectionToken,\n Optional\n} from '@angular/core';\nimport {\n GetOAuthProfileMethod,\n PROFILE_AUTH_ENDPOINT\n} from './get-o-auth-profile.method';\nimport {\n OAuthMethod,\n OAuthMethodResponse\n} from './o-auth.method';\nimport {\n RXAP_O_AUTH_REDIRECT_SIGN_OUT,\n RXAP_O_AUTH_REDIRECT_URL\n} from './tokens';\nimport { Router } from '@angular/router';\n\nexport const OAUTH_SECRET = new InjectionToken('OAUTH_SECRET');\nexport const OAUTH_AUTH_ENDPOINT = new InjectionToken('OAUTH_AUTH_ENDPOINT');\nexport const OAUTH_SSO_URL = new InjectionToken('OAUTH_SSO_URL');\n\nexport const ACCESS_TOKEN_LOCAL_STORAGE_KEY = 'access_token';\nexport const REFRESH_TOKEN_LOCAL_STORAGE_KEY = 'refresh_token';\nexport const EXPIRES_AT_LOCAL_STORAGE_KEY = 'expires_at';\nexport const REMEMBER_LOCAL_STORAGE_KEY = 'remember';\n\nexport interface OAuthStatus {\n accessToken: string;\n refreshToken?: string | null;\n expiresIn: number;\n expiresAt: Date;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthService<Profile = any> {\n get expiresAt(): Date | null {\n const expiresAt = this.getItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n if (expiresAt) {\n return new Date(\n parseInt(this.getItem(EXPIRES_AT_LOCAL_STORAGE_KEY)!, 10)\n );\n }\n return null;\n }\n\n set expiresAt(value: Date | null) {\n if (value) {\n this.setItem(EXPIRES_AT_LOCAL_STORAGE_KEY, value.getTime().toFixed(0));\n } else {\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n }\n\n get refreshToken(): string | null {\n return this.getItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n }\n\n set refreshToken(value: string | null) {\n if (value) {\n this.setItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY, value);\n } else {\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n }\n }\n\n get accessToken(): string | null {\n return this.getItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n }\n\n set accessToken(value: string | null) {\n if (value) {\n this.setItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY, value);\n } else {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n }\n }\n\n /**\n * The time until the access token expires in seconds\n */\n public get expiresIn(): number | null {\n const expiresAt = this.expiresAt;\n if (expiresAt) {\n return Math.round(\n (expiresAt.getTime() - Date.now()) / 1000\n );\n }\n return null;\n }\n\n public get remember(): boolean {\n return !!this.getItem(REMEMBER_LOCAL_STORAGE_KEY);\n }\n\n public set remember(value: boolean) {\n if (value) {\n this.setItem(REMEMBER_LOCAL_STORAGE_KEY, 'true');\n } else {\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n }\n }\n\n private _profile?: Profile | null;\n\n protected _isAuthenticated: boolean | null = null;\n\n public get profile(): Profile | null | undefined {\n return this._profile;\n }\n\n constructor(\n @Inject(OAuthMethod)\n public readonly oAuthMethod: OAuthMethod,\n @Inject(GetOAuthProfileMethod)\n public readonly getOAuthProfileMethod: GetOAuthProfileMethod,\n @Inject(Router)\n private readonly router: Router,\n @Optional()\n @Inject(PROFILE_AUTH_ENDPOINT)\n public profileEndpoint: string | null = null,\n @Optional()\n @Inject(OAUTH_AUTH_ENDPOINT)\n public authEndpoint: string | null = null,\n @Optional()\n @Inject(OAUTH_SECRET)\n public secret: string | null = null,\n @Optional()\n @Inject(OAUTH_SSO_URL)\n private readonly ssoUrl: string | null = null,\n @Optional()\n @Inject(RXAP_O_AUTH_REDIRECT_SIGN_OUT)\n private readonly redirectSignOut: string[] | null = null,\n @Optional()\n @Inject(RXAP_O_AUTH_REDIRECT_URL)\n private readonly redirectUrl: string | null = null\n ) {}\n\n public signInWithRedirect(lastUrl?: string): void {\n if (!this.redirectUrl) {\n throw new Error('Redirect url is not defined');\n }\n location.replace(\n `${this.ssoUrl}?redirect=${btoa(this.redirectUrl)}&secret=${\n this.secret\n }&payload=${btoa(JSON.stringify({ lastUrl }))}`\n );\n }\n\n public async isAuthenticated(): Promise<boolean> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n if (this._isAuthenticated !== null) {\n return this._isAuthenticated;\n }\n\n if (this.accessToken) {\n console.debug('Access token is defined: ' + this.accessToken);\n if (this.expiresIn && this.expiresIn > 60) {\n const profile = await this.getProfile();\n\n if (!profile) {\n console.log('profile is not defined');\n return (this._isAuthenticated = false);\n }\n\n this.authenticated(\n {\n refreshToken: this.refreshToken,\n accessToken: this.accessToken,\n expiresAt: this.expiresAt ?? new Date(Date.now() + 60 * 1000),\n expiresIn: this.expiresIn,\n },\n this.remember\n );\n\n return (this._isAuthenticated = true);\n } else {\n this.accessToken = null;\n this.expiresAt = null;\n console.warn(\n 'The access token expires soon. Use refresh token instead.'\n );\n }\n }\n if (this.refreshToken) {\n console.debug('Refresh token is defined: ' + this.refreshToken);\n try {\n await this.signInWithRefreshToken(this.refreshToken);\n return (this._isAuthenticated = true);\n } catch (e) {\n if (![401, 403, 400].includes(e.status)) {\n console.error('Could not sign in with refresh token', e.message);\n throw e;\n }\n console.warn('Refresh token is expired');\n }\n }\n\n console.warn('Unauthenticated');\n\n return (this._isAuthenticated = false);\n }\n\n public async signInWithEmailAndPassword(\n email: string,\n password: string,\n remember: boolean\n ): Promise<OAuthMethodResponse> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n const response = await this.oAuthMethod.call({\n username: email,\n password: password,\n authEndpoint: this.authEndpoint,\n secret: this.secret,\n });\n\n this.authenticated(response, remember);\n\n return response;\n }\n\n public async getProfile<T extends Profile = Profile>(): Promise<T | null> {\n let profile: T | null = null;\n\n if (!this.accessToken) {\n throw new Error('The access token is not defined');\n }\n\n if (this.profileEndpoint) {\n try {\n profile = await this.getOAuthProfileMethod.call({\n accessToken: this.accessToken,\n profileEndpoint: this.profileEndpoint,\n });\n } catch (e) {\n console.error('Could not request the user profile', e.message);\n }\n } else {\n console.warn('The profile endpoint is not defined!');\n }\n\n return (this._profile = profile);\n }\n\n public async signOut() {\n this.clearStorage();\n this.accessToken = null;\n this.refreshToken = null;\n this.expiresAt = null;\n this._isAuthenticated = false;\n if (this.redirectSignOut) {\n await this.router.navigate(this.redirectSignOut);\n } else {\n if (!this.redirectUrl) {\n throw new Error('Redirect url is not defined');\n }\n location.replace(\n `${this.ssoUrl}?redirect=${btoa(this.redirectUrl)}&secret=${this.secret}&action=signOut`\n );\n }\n }\n\n public authenticated(\n response: OAuthStatus,\n remember: boolean = this.remember ?? false\n ): void {\n this.accessToken = response.accessToken;\n this.refreshToken = response.refreshToken ?? null;\n this.expiresAt = response.expiresAt;\n\n console.log(`Authenticated until ${this.expiresAt.toISOString()}`);\n\n this.remember = remember;\n\n if (remember) {\n this.setItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY, response.accessToken);\n if (response.refreshToken) {\n this.setItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY, response.refreshToken);\n }\n this.setItem(REMEMBER_LOCAL_STORAGE_KEY, 'true');\n if (response.expiresAt) {\n console.log(`Authenticated until ${response.expiresAt.toISOString()}`);\n this.setItem(\n EXPIRES_AT_LOCAL_STORAGE_KEY,\n response.expiresAt.getTime().toFixed(0)\n );\n }\n } else {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n\n this._isAuthenticated = true;\n }\n\n private getKey(key: string): string {\n return [this.secret, key].join('__');\n }\n\n private getItem(key: string): string | null {\n return localStorage.getItem(this.getKey(key));\n }\n\n private setItem(key: string, value: string): void {\n localStorage.setItem(this.getKey(key), value);\n }\n\n private removeItem(key: string): void {\n localStorage.removeItem(this.getKey(key));\n }\n\n protected clearStorage() {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n\n private async signInWithRefreshToken(\n refreshToken: string\n ): Promise<OAuthMethodResponse> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n const response = await this.oAuthMethod.call({\n refreshToken,\n authEndpoint: this.authEndpoint,\n secret: this.secret,\n });\n\n this.authenticated(response);\n\n return response;\n }\n}\n","import {\n ActivatedRouteSnapshot,\n CanActivate,\n UrlTree,\n Router\n} from '@angular/router';\nimport { Injectable } from '@angular/core';\nimport { OAuthService } from './o-auth.service';\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthExtractGuard implements CanActivate {\n\n constructor(\n private readonly router: Router,\n private readonly oAuthService: OAuthService\n ) {}\n\n public canActivate(route: ActivatedRouteSnapshot): UrlTree {\n\n if (route.queryParamMap.has('accessToken') && route.queryParamMap.has('refreshToken') && route.queryParamMap.has('expiresIn')) {\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const accessToken = route.queryParamMap.get('accessToken')!;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const refreshToken = route.queryParamMap.get('refreshToken')!;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const expiresIn = parseInt(route.queryParamMap.get('expiresIn')!, 10);\n const payloadBase64 = route.queryParamMap.get('payload');\n\n const expiresAt = new Date(Date.now() + expiresIn * 1000);\n\n this.oAuthService.authenticated({\n accessToken,\n refreshToken,\n expiresIn,\n expiresAt\n }, true);\n\n let redirectUrl = '/';\n\n if (payloadBase64) {\n try {\n const payload = JSON.parse(atob(payloadBase64));\n console.debug('sso redirect payload', payload);\n if (payload.lastUrl) {\n redirectUrl = payload.lastUrl;\n }\n } catch (e) {\n console.error('Could not parse redirect payload', e.message);\n }\n }\n\n return this.router.createUrlTree([ redirectUrl ]);\n\n } else {\n console.warn('Not every query parameter is defined!');\n }\n\n return this.router.createUrlTree([ ...route.url.map(url => url.path), 'redirect' ]);\n }\n\n\n}\n","import {\n ActivatedRouteSnapshot,\n CanActivate,\n CanActivateChild,\n RouterStateSnapshot,\n UrlTree\n} from '@angular/router';\nimport {\n Injectable,\n Inject,\n isDevMode\n} from '@angular/core';\nimport { OAuthService } from './o-auth.service';\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthRedirectGuard implements CanActivate, CanActivateChild {\n\n constructor(\n @Inject(OAuthService)\n private readonly oAuthService: OAuthService\n ) {\n }\n\n public async canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {\n\n const isAuthenticated = await this.oAuthService.isAuthenticated();\n\n console.log(`isAuthenticated: ${isAuthenticated}`);\n\n if (isAuthenticated) {\n return true;\n }\n\n this.oAuthService.signInWithRedirect(state.url);\n\n return false;\n\n }\n\n public canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {\n return this.canActivate(childRoute, state);\n }\n\n}\n","import {\n NgModule,\n ModuleWithProviders\n} from '@angular/core';\nimport {\n RXAP_O_AUTH_REDIRECT_SIGN_IN,\n RXAP_O_AUTH_REDIRECT_SIGN_OUT\n} from './tokens';\n\nexport interface OAuthModuleOptions {\n signInPath?: string[]\n signOutPath?: string[]\n}\n\n@NgModule()\nexport class OAuthModule {\n\n public static forRoot(options: OAuthModuleOptions = {}): ModuleWithProviders<OAuthModule> {\n return {\n ngModule: OAuthModule,\n providers: [\n {\n provide: RXAP_O_AUTH_REDIRECT_SIGN_IN,\n useValue: options.signInPath ?? [ '/', 'oauth', 'redirect' ]\n },\n {\n provide: RXAP_O_AUTH_REDIRECT_SIGN_OUT,\n useValue: options.signOutPath ?? null\n }\n ]\n };\n }\n\n}\n","import {\n Component,\n ChangeDetectionStrategy\n} from '@angular/core';\nimport { RouterOutlet } from '@angular/router';\nimport {\n trigger,\n transition,\n style,\n animate\n} from '@angular/animations';\n\n@Component({\n selector: 'rxap-container',\n templateUrl: './container.component.html',\n styleUrls: [ './container.component.scss' ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'rxap-container' },\n animations: [\n trigger('routeAnimations', [\n transition(\n ':enter',\n [\n style({ opacity: 0 }),\n animate('512ms', style({ opacity: 1 }))\n ]\n ),\n transition(\n ':leave',\n [\n style({ opacity: 1 }),\n animate('512ms', style({ opacity: 0 }))\n ]\n )\n ])\n ]\n})\nexport class ContainerComponent {\n\n public prepareRoute(outlet: RouterOutlet) {\n return outlet.isActivated ? outlet.activatedRoute : 'true';\n }\n\n}\n","<div [@routeAnimations]=\"prepareRoute(outlet)\" class=\"container\">\n\n <div class=\"split mat-elevation-z3\"></div>\n\n <router-outlet #outlet=\"outlet\"></router-outlet>\n\n</div>\n","import {\n ChangeDetectionStrategy,\n Component\n} from '@angular/core';\n\n@Component({\n selector: 'rxap-loading',\n templateUrl: './loading.component.html',\n styleUrls: [ './loading.component.scss' ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'rxap-loading' }\n})\nexport class LoadingComponent {\n}\n","<mat-progress-bar class=\"loading-bar\" mode=\"indeterminate\"></mat-progress-bar>\n","import {\n Component,\n ChangeDetectionStrategy\n} from '@angular/core';\nimport { OAuthService } from '../o-auth.service';\nimport {\n trigger,\n state,\n style,\n transition,\n animate\n} from '@angular/animations';\n\n@Component({\n selector: 'rxap-sign-in-with-redirect',\n templateUrl: './sign-in-with-redirect.component.html',\n styleUrls: [ './sign-in-with-redirect.component.scss' ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'rxap-sign-in-with-redirect' },\n animations: [\n trigger('fadeAnimation', [\n\n // the \"in\" style determines the \"resting\" state of the element when it is visible.\n state('in', style({ opacity: 1 })),\n\n // fade in when created. this could also be written as transition('void => *')\n transition(':enter', [\n style({ opacity: 0 }),\n animate(300)\n ]),\n\n // fade out when destroyed. this could also be written as transition('void => *')\n transition(\n ':leave',\n animate(300, style({ opacity: 0 }))\n )\n ])\n ]\n})\nexport class SignInWithRedirectComponent {\n\n constructor(\n private readonly authService: OAuthService\n ) {}\n\n public signIn() {\n this.authService.signInWithRedirect();\n }\n\n}\n","<div [@fadeAnimation]=\"'in'\" class=\"inner mat-elevation-z5\" fxLayout=\"column\" fxLayoutAlign=\"center center\" fxLayoutGap=\"32px\">\n\n <div class=\"header\" fxFlex=\"nogrow\" fxLayout=\"column\" fxLayoutAlign=\"center center\">\n\n <mat-icon class=\"avatar-icon\" color=\"primary\" fxFlex=\"nogrow\">account_circle</mat-icon>\n\n </div>\n\n <div fxFlex=\"nogrow\" fxLayout=\"row\" fxLayoutAlign=\"center center\">\n\n <div fxFlex=\"nogrow\">\n <button (click)=\"signIn()\" color=\"primary\" fxFlex=\"nogrow\" mat-raised-button>\n <span fxLayout=\"row\" fxLayoutAlign=\"start center\" fxLayoutGap=\"16px\">\n <mat-icon fxFlex=\"nogrow\">login</mat-icon>\n <span fxFlex=\"nogrow\">Sign In</span>\n </span>\n </button>\n </div>\n\n </div>\n\n</div>\n\n","import { Routes } from '@angular/router';\nimport {\n ContainerComponent\n} from './container/container.component';\nimport { LoadingComponent } from './loading/loading.component';\nimport { SignInWithRedirectComponent } from './sign-in-with-redirect/sign-in-with-redirect.component';\nimport { OAuthExtractGuard } from './o-auth-extract.guard';\n\nexport const RXAP_O_AUTH_ROUTES: Routes = [\n {\n path: 'oauth',\n component: ContainerComponent,\n children: [\n {\n path: 'redirect',\n component: SignInWithRedirectComponent\n },\n {\n canActivate: [ OAuthExtractGuard ],\n path: '',\n component: LoadingComponent\n },\n {\n path: '**',\n redirectTo: ''\n }\n ]\n }\n];\n","import {\n Resolve,\n Router\n} from '@angular/router';\nimport {\n Inject,\n Injectable\n} from '@angular/core';\nimport { OAuthService } from './o-auth.service';\nimport { RXAP_O_AUTH_REDIRECT_SIGN_IN } from './tokens';\n\n@Injectable({ providedIn: 'root' })\nexport class ProfileResolve<T = Record<string, any>> implements Resolve<T> {\n\n constructor(\n @Inject(OAuthService)\n private readonly oAuthService: OAuthService,\n @Inject(Router)\n private readonly router: Router,\n @Inject(RXAP_O_AUTH_REDIRECT_SIGN_IN)\n private readonly redirectLogin: string[]\n ) {\n }\n\n public async resolve(): Promise<T> {\n const profile = await this.oAuthService.getProfile();\n\n if (!profile) {\n await this.router.navigate(this.redirectLogin);\n }\n\n return profile;\n }\n\n}\n","import { NgModule } from '@angular/core';\nimport { ContainerComponent } from './container.component';\nimport { RouterModule } from '@angular/router';\n\n\n@NgModule({\n declarations: [ ContainerComponent ],\n imports: [\n RouterModule\n ],\n exports: [ ContainerComponent ]\n})\nexport class ContainerComponentModule {}\n","import { NgModule } from '@angular/core';\nimport { LoadingComponent } from './loading.component';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\n\n\n@NgModule({\n declarations: [\n LoadingComponent\n ],\n imports: [\n MatProgressBarModule\n ],\n exports: [\n LoadingComponent\n ]\n})\nexport class LoadingComponentModule {\n}\n","import { NgModule } from '@angular/core';\nimport { SignInWithRedirectComponent } from './sign-in-with-redirect.component';\nimport { MatIconModule } from '@angular/material/icon';\nimport { CommonModule } from '@angular/common';\nimport { MatCardModule } from '@angular/material/card';\nimport { FlexLayoutModule } from '@angular/flex-layout';\nimport { MatButtonModule } from '@angular/material/button';\n\n\n@NgModule({\n declarations: [ SignInWithRedirectComponent ],\n imports: [\n MatCardModule,\n MatButtonModule,\n FlexLayoutModule,\n MatIconModule,\n CommonModule\n ],\n exports: [ SignInWithRedirectComponent ]\n})\nexport class SignInWithRedirectComponentModule {}\n","import { NgModule } from '@angular/core';\nimport { ContainerComponentModule } from './container/container.component.module';\nimport { LoadingComponentModule } from './loading/loading.component.module';\nimport {\n SignInWithRedirectComponentModule\n} from './sign-in-with-redirect/sign-in-with-redirect.component.module';\n\n@NgModule({\n exports: [\n ContainerComponentModule,\n LoadingComponentModule,\n SignInWithRedirectComponentModule\n ]\n})\nexport class OAuthRoutingModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[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ACZ,gBAAgB;qBACjB;oBACD,OAAO,EAAO;wBACZ,oBAAoB;qBACrB;oBACD,OAAO,EAAO;wBACZ,gBAAgB;qBACjB;iBACF;;;MCKY,iCAAiC;;+HAAjC,iCAAiC;gIAAjC,iCAAiC,iBAV5B,2BAA2B,aAEzC,aAAa;QACb,eAAe;QACf,gBAAgB;QAChB,aAAa;QACb,YAAY,aAEE,2BAA2B;gIAEhC,iCAAiC,YAT9B;YACZ,aAAa;YACb,eAAe;YACf,gBAAgB;YAChB,aAAa;YACb,YAAY;SACb;4FAGU,iCAAiC;kBAX7C,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAE,2BAA2B,CAAE;oBAC7C,OAAO,EAAO;wBACZ,aAAa;wBACb,eAAe;wBACf,gBAAgB;wBAChB,aAAa;wBACb,YAAY;qBACb;oBACD,OAAO,EAAO,CAAE,2BAA2B,CAAE;iBAC9C;;;MCLY,kBAAkB;;gHAAlB,kBAAkB;iHAAlB,kBAAkB,YAL3B,wBAAwB;QACxB,sBAAsB;QACtB,iCAAiC;iHAGxB,kBAAkB,YAL3B,wBAAwB;QACxB,sBAAsB;QACtB,iCAAiC;4FAGxB,kBAAkB;kBAP9B,QAAQ;mBAAC;oBACR,OAAO,EAAE;wBACP,wBAAwB;wBACxB,sBAAsB;wBACtB,iCAAiC;qBAClC;iBACF;;;ACbD;;;;;;"}
1
+ {"version":3,"file":"rxap-oauth.js","sources":["../../../../libs/oauth/src/lib/get-o-auth-profile.method.ts","../../../../libs/oauth/src/lib/o-auth.method.ts","../../../../libs/oauth/src/lib/tokens.ts","../../../../libs/oauth/src/lib/o-auth.service.ts","../../../../libs/oauth/src/lib/o-auth-extract.guard.ts","../../../../libs/oauth/src/lib/o-auth-redirect.guard.ts","../../../../libs/oauth/src/lib/o-auth.module.ts","../../../../libs/oauth/src/lib/container/container.component.ts","../../../../libs/oauth/src/lib/container/container.component.html","../../../../libs/oauth/src/lib/loading/loading.component.ts","../../../../libs/oauth/src/lib/loading/loading.component.html","../../../../libs/oauth/src/lib/sign-in-with-redirect/sign-in-with-redirect.component.ts","../../../../libs/oauth/src/lib/sign-in-with-redirect/sign-in-with-redirect.component.html","../../../../libs/oauth/src/lib/routes.ts","../../../../libs/oauth/src/lib/profile.resolve.ts","../../../../libs/oauth/src/lib/container/container.component.module.ts","../../../../libs/oauth/src/lib/loading/loading.component.module.ts","../../../../libs/oauth/src/lib/sign-in-with-redirect/sign-in-with-redirect.component.module.ts","../../../../libs/oauth/src/lib/o-auth-routing.module.ts","../../../../libs/oauth/src/rxap-oauth.ts"],"sourcesContent":["import {\n Inject,\n Injectable,\n InjectionToken,\n Optional\n} from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { Method } from '@rxap/utilities/rxjs';\n\nexport const PROFILE_AUTH_ENDPOINT = new InjectionToken(\n 'PROFILE_AUTH_ENDPOINT'\n);\n\nexport interface GetOAuthProfileMethodParameters {\n accessToken: string;\n profileEndpoint?: string | null;\n withCredentials?: boolean;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class GetOAuthProfileMethod<T = any>\n implements Method<T, GetOAuthProfileMethodParameters>\n{\n constructor(\n @Inject(HttpClient)\n private readonly http: HttpClient,\n @Optional()\n @Inject(PROFILE_AUTH_ENDPOINT)\n public profileEndpoint: string | null = null\n ) {}\n\n public call(parameters: GetOAuthProfileMethodParameters): Promise<T> {\n const profileEndpoint = parameters.profileEndpoint ?? this.profileEndpoint;\n\n if (!profileEndpoint) {\n throw new Error('The profile endpoint is not defined');\n }\n\n return this.http\n .get<T>(profileEndpoint, {\n headers: {\n Authorization: `Bearer ${parameters.accessToken}`,\n },\n withCredentials: parameters.withCredentials ?? true,\n })\n .toPromise();\n }\n}\n","import {\n Injectable,\n Inject\n} from '@angular/core';\nimport {\n HttpClient,\n HttpHeaders\n} from '@angular/common/http';\nimport { Method } from '@rxap/utilities/rxjs';\n\nexport interface OAuthMethodWithUsernamePasswordParameters {\n grantType?: string;\n username: string;\n password: string;\n secret: string;\n clientId?: string;\n authEndpoint: string;\n}\n\nexport interface OAuthMethodWithRefreshTokenParameters {\n grantType?: string;\n refreshToken: string;\n secret: string;\n clientId?: string;\n authEndpoint: string;\n}\n\nexport type OAuthMethodParameters = (\n | OAuthMethodWithUsernamePasswordParameters\n | OAuthMethodWithRefreshTokenParameters\n) & { withCredentials?: boolean };\n\nexport function IsOAuthMethodWithRefreshTokenParameters(\n parameters: OAuthMethodParameters\n): parameters is OAuthMethodWithRefreshTokenParameters {\n // eslint-disable-next-line no-prototype-builtins\n return parameters.hasOwnProperty('refreshToken');\n}\n\nexport function IsOAuthMethodWithUsernamePasswordParameters(\n parameters: OAuthMethodParameters\n): parameters is OAuthMethodWithUsernamePasswordParameters {\n // eslint-disable-next-line no-prototype-builtins\n return (\n parameters.hasOwnProperty('username') &&\n parameters.hasOwnProperty('password')\n );\n}\n\nexport function AssertOAuthMethodWithUsernamePasswordParameters(\n parameters: OAuthMethodParameters\n): asserts parameters is OAuthMethodWithUsernamePasswordParameters {\n if (!IsOAuthMethodWithUsernamePasswordParameters(parameters)) {\n throw new Error(\n 'The grant type password requires the parameters username and password'\n );\n }\n}\n\nexport function AssertOAuthMethodWithRefreshTokenParameters(\n parameters: OAuthMethodParameters\n): asserts parameters is OAuthMethodWithRefreshTokenParameters {\n if (!IsOAuthMethodWithRefreshTokenParameters(parameters)) {\n throw new Error(\n 'The grant type refresh token requires the parameters refreshToken'\n );\n }\n}\n\nexport function AssertOAuthMethodParameters(\n parameters: any\n): asserts parameters is OAuthMethodParameters {\n if (!parameters.authEndpoint) {\n throw new Error('The authEndpoint parameter must be defined');\n }\n if (!parameters.secret) {\n throw new Error('The secret parameter must be defined');\n }\n if (parameters.grantType) {\n switch (parameters.grantType) {\n case 'password':\n AssertOAuthMethodWithUsernamePasswordParameters(parameters);\n break;\n\n case 'refresh_token':\n AssertOAuthMethodWithRefreshTokenParameters(parameters);\n break;\n\n default:\n throw new Error(\n `The grant type '${parameters.grantType}' is not supported`\n );\n }\n } else {\n if (\n !IsOAuthMethodWithRefreshTokenParameters(parameters) &&\n !IsOAuthMethodWithUsernamePasswordParameters(parameters)\n ) {\n throw new Error(\n 'Either the refresh token or the username and password must be defined'\n );\n }\n }\n}\n\nexport interface OAuthResponse {\n access_token: string;\n refresh_token: string;\n expires_in: number;\n}\n\nexport interface OAuthMethodResponse {\n accessToken: string;\n refreshToken: string;\n expiresIn: number;\n expiresAt: Date;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthMethod\n implements Method<OAuthMethodResponse, OAuthMethodParameters>\n{\n constructor(\n @Inject(HttpClient)\n private readonly http: HttpClient\n ) {}\n\n public async call(\n parameters: OAuthMethodParameters\n ): Promise<OAuthMethodResponse> {\n AssertOAuthMethodParameters(parameters);\n\n const params = new URLSearchParams();\n const grantType = this.getGrantType(parameters);\n params.append('grant_type', grantType);\n switch (grantType) {\n case 'password':\n AssertOAuthMethodWithUsernamePasswordParameters(parameters);\n params.append('username', parameters.username);\n params.append('password', parameters.password);\n break;\n\n case 'refresh_token':\n AssertOAuthMethodWithRefreshTokenParameters(parameters);\n params.append('refresh_token', parameters.refreshToken);\n break;\n\n default:\n throw new Error('Not supported grant type');\n }\n\n let headers = new HttpHeaders();\n\n headers = headers.append('Content-type', 'application/x-www-form-urlencoded; charset=utf-8');\n\n if (parameters.secret && parameters.clientId) {\n params.append('client_id', parameters.clientId);\n params.append('client_secret', parameters.secret);\n } else {\n headers = headers.append('Authorization', `Basic ${parameters.secret}`);\n }\n\n const response = await this.http\n .post<OAuthResponse>(parameters.authEndpoint, params.toString(), {\n headers,\n withCredentials: parameters.withCredentials ?? true,\n })\n .toPromise();\n\n return {\n accessToken: response.access_token,\n refreshToken: response.refresh_token,\n expiresIn: response.expires_in,\n expiresAt: new Date(Date.now() + response.expires_in * 1000),\n };\n }\n\n private getGrantType(parameters: OAuthMethodParameters) {\n if (parameters.grantType) {\n return parameters.grantType;\n }\n\n if (IsOAuthMethodWithRefreshTokenParameters(parameters)) {\n return 'refresh_token';\n }\n\n if (IsOAuthMethodWithUsernamePasswordParameters(parameters)) {\n return 'password';\n }\n\n throw new Error('Could not guess the grant type');\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport function DefaultRedirectSignInFactory(): string[] {\n return [ '/', 'authentication', 'login' ];\n}\n\nexport const RXAP_O_AUTH_REDIRECT_SIGN_IN = new InjectionToken('rxap/o-auth/redirect-sign-in', {\n providedIn: 'root',\n factory: DefaultRedirectSignInFactory\n});\n\nexport const RXAP_O_AUTH_REDIRECT_SIGN_OUT = new InjectionToken('rxap/o-auth/redirect-sign-out');\n\nexport function DefaultRedirectUrl(): string {\n return location.origin + '/oauth';\n}\n\nexport const RXAP_O_AUTH_REDIRECT_URL = new InjectionToken('rxap/o-auth/redirect-url', {\n providedIn: 'root',\n factory: DefaultRedirectUrl\n});\n","import {\n Inject,\n Injectable,\n InjectionToken,\n Optional\n} from '@angular/core';\nimport {\n GetOAuthProfileMethod,\n PROFILE_AUTH_ENDPOINT\n} from './get-o-auth-profile.method';\nimport {\n OAuthMethod,\n OAuthMethodResponse\n} from './o-auth.method';\nimport {\n RXAP_O_AUTH_REDIRECT_SIGN_OUT,\n RXAP_O_AUTH_REDIRECT_URL\n} from './tokens';\nimport { Router } from '@angular/router';\n\nexport const OAUTH_SECRET = new InjectionToken('OAUTH_SECRET');\nexport const OAUTH_AUTH_ENDPOINT = new InjectionToken('OAUTH_AUTH_ENDPOINT');\nexport const OAUTH_SSO_URL = new InjectionToken('OAUTH_SSO_URL');\nexport const OAUTH_CLIENT_ID = new InjectionToken('OAUTH_CLIENT_ID');\n\nexport const ACCESS_TOKEN_LOCAL_STORAGE_KEY = 'access_token';\nexport const REFRESH_TOKEN_LOCAL_STORAGE_KEY = 'refresh_token';\nexport const EXPIRES_AT_LOCAL_STORAGE_KEY = 'expires_at';\nexport const REMEMBER_LOCAL_STORAGE_KEY = 'remember';\n\nexport interface OAuthStatus {\n accessToken: string;\n refreshToken?: string | null;\n expiresIn: number;\n expiresAt: Date;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthService<Profile = any> {\n get expiresAt(): Date | null {\n const expiresAt = this.getItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n if (expiresAt) {\n return new Date(\n parseInt(this.getItem(EXPIRES_AT_LOCAL_STORAGE_KEY)!, 10)\n );\n }\n return null;\n }\n\n set expiresAt(value: Date | null) {\n if (value) {\n this.setItem(EXPIRES_AT_LOCAL_STORAGE_KEY, value.getTime().toFixed(0));\n } else {\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n }\n\n get refreshToken(): string | null {\n return this.getItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n }\n\n set refreshToken(value: string | null) {\n if (value) {\n this.setItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY, value);\n } else {\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n }\n }\n\n get accessToken(): string | null {\n return this.getItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n }\n\n set accessToken(value: string | null) {\n if (value) {\n this.setItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY, value);\n } else {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n }\n }\n\n /**\n * The time until the access token expires in seconds\n */\n public get expiresIn(): number | null {\n const expiresAt = this.expiresAt;\n if (expiresAt) {\n return Math.round(\n (expiresAt.getTime() - Date.now()) / 1000\n );\n }\n return null;\n }\n\n public get remember(): boolean {\n return !!this.getItem(REMEMBER_LOCAL_STORAGE_KEY);\n }\n\n public set remember(value: boolean) {\n if (value) {\n this.setItem(REMEMBER_LOCAL_STORAGE_KEY, 'true');\n } else {\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n }\n }\n\n private _profile?: Profile | null;\n\n protected _isAuthenticated: boolean | null = null;\n\n public get profile(): Profile | null | undefined {\n return this._profile;\n }\n\n constructor(\n @Inject(OAuthMethod)\n public readonly oAuthMethod: OAuthMethod,\n @Inject(GetOAuthProfileMethod)\n public readonly getOAuthProfileMethod: GetOAuthProfileMethod,\n @Inject(Router)\n private readonly router: Router,\n @Optional()\n @Inject(PROFILE_AUTH_ENDPOINT)\n public profileEndpoint: string | null = null,\n @Optional()\n @Inject(OAUTH_AUTH_ENDPOINT)\n public authEndpoint: string | null = null,\n @Optional()\n @Inject(OAUTH_SECRET)\n public secret: string | null = null,\n @Optional()\n @Inject(OAUTH_SSO_URL)\n private readonly ssoUrl: string | null = null,\n @Optional()\n @Inject(RXAP_O_AUTH_REDIRECT_SIGN_OUT)\n private readonly redirectSignOut: string[] | null = null,\n @Optional()\n @Inject(RXAP_O_AUTH_REDIRECT_URL)\n private readonly redirectUrl: string | null = null,\n @Optional()\n @Inject(OAUTH_CLIENT_ID)\n public clientId: string | null = null,\n ) {}\n\n public signInWithRedirect(lastUrl?: string): void {\n if (!this.redirectUrl) {\n throw new Error('Redirect url is not defined');\n }\n location.replace(\n `${this.ssoUrl}?redirect=${btoa(this.redirectUrl)}&secret=${\n this.secret\n }&payload=${btoa(JSON.stringify({ lastUrl }))}`\n );\n }\n\n public async isAuthenticated(): Promise<boolean> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n if (this._isAuthenticated !== null) {\n return this._isAuthenticated;\n }\n\n if (this.accessToken) {\n console.debug('Access token is defined: ' + this.accessToken);\n if (this.expiresIn && this.expiresIn > 60) {\n const profile = await this.getProfile();\n\n if (!profile) {\n console.log('profile is not defined');\n return (this._isAuthenticated = false);\n }\n\n this.authenticated(\n {\n refreshToken: this.refreshToken,\n accessToken: this.accessToken,\n expiresAt: this.expiresAt ?? new Date(Date.now() + 60 * 1000),\n expiresIn: this.expiresIn,\n },\n this.remember\n );\n\n return (this._isAuthenticated = true);\n } else {\n this.accessToken = null;\n this.expiresAt = null;\n console.warn(\n 'The access token expires soon. Use refresh token instead.'\n );\n }\n }\n if (this.refreshToken) {\n console.debug('Refresh token is defined: ' + this.refreshToken);\n try {\n await this.signInWithRefreshToken(this.refreshToken);\n return (this._isAuthenticated = true);\n } catch (e) {\n if (![401, 403, 400].includes(e.status)) {\n console.error('Could not sign in with refresh token', e.message);\n throw e;\n }\n console.warn('Refresh token is expired');\n }\n }\n\n console.warn('Unauthenticated');\n\n return (this._isAuthenticated = false);\n }\n\n public async signInWithEmailAndPassword(\n email: string,\n password: string,\n remember: boolean\n ): Promise<OAuthMethodResponse> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n const response = await this.oAuthMethod.call({\n username: email,\n password: password,\n authEndpoint: this.authEndpoint,\n secret: this.secret,\n clientId: this.clientId ?? undefined\n });\n\n this.authenticated(response, remember);\n\n return response;\n }\n\n public async getProfile<T extends Profile = Profile>(): Promise<T | null> {\n let profile: T | null = null;\n\n if (!this.accessToken) {\n throw new Error('The access token is not defined');\n }\n\n if (this.profileEndpoint) {\n try {\n profile = await this.getOAuthProfileMethod.call({\n accessToken: this.accessToken,\n profileEndpoint: this.profileEndpoint,\n });\n } catch (e) {\n console.error('Could not request the user profile', e.message);\n }\n } else {\n console.warn('The profile endpoint is not defined!');\n }\n\n return (this._profile = profile);\n }\n\n public async signOut() {\n this.clearStorage();\n this.accessToken = null;\n this.refreshToken = null;\n this.expiresAt = null;\n this._isAuthenticated = false;\n if (this.redirectSignOut) {\n await this.router.navigate(this.redirectSignOut);\n } else {\n if (!this.redirectUrl) {\n throw new Error('Redirect url is not defined');\n }\n location.replace(\n `${this.ssoUrl}?redirect=${btoa(this.redirectUrl)}&secret=${this.secret}&action=signOut`\n );\n }\n }\n\n public authenticated(\n response: OAuthStatus,\n remember: boolean = this.remember ?? false\n ): void {\n this.accessToken = response.accessToken;\n this.refreshToken = response.refreshToken ?? null;\n this.expiresAt = response.expiresAt;\n\n console.log(`Authenticated until ${this.expiresAt.toISOString()}`);\n\n this.remember = remember;\n\n if (remember) {\n this.setItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY, response.accessToken);\n if (response.refreshToken) {\n this.setItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY, response.refreshToken);\n }\n this.setItem(REMEMBER_LOCAL_STORAGE_KEY, 'true');\n if (response.expiresAt) {\n console.log(`Authenticated until ${response.expiresAt.toISOString()}`);\n this.setItem(\n EXPIRES_AT_LOCAL_STORAGE_KEY,\n response.expiresAt.getTime().toFixed(0)\n );\n }\n } else {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n\n this._isAuthenticated = true;\n }\n\n private getKey(key: string): string {\n return [this.secret, key].join('__');\n }\n\n private getItem(key: string): string | null {\n return localStorage.getItem(this.getKey(key));\n }\n\n private setItem(key: string, value: string): void {\n localStorage.setItem(this.getKey(key), value);\n }\n\n private removeItem(key: string): void {\n localStorage.removeItem(this.getKey(key));\n }\n\n protected clearStorage() {\n this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);\n this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);\n this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);\n }\n\n private async signInWithRefreshToken(\n refreshToken: string\n ): Promise<OAuthMethodResponse> {\n if (!this.secret) {\n throw new Error('The oauth secret is not defined');\n }\n\n if (!this.authEndpoint) {\n throw new Error('The oauth auth endpoint is not defined');\n }\n\n const response = await this.oAuthMethod.call({\n refreshToken,\n authEndpoint: this.authEndpoint,\n secret: this.secret,\n clientId: this.clientId ?? undefined,\n });\n\n this.authenticated(response);\n\n return response;\n }\n}\n","import {\n ActivatedRouteSnapshot,\n CanActivate,\n UrlTree,\n Router\n} from '@angular/router';\nimport { Injectable } from '@angular/core';\nimport { OAuthService } from './o-auth.service';\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthExtractGuard implements CanActivate {\n\n constructor(\n private readonly router: Router,\n private readonly oAuthService: OAuthService\n ) {}\n\n public canActivate(route: ActivatedRouteSnapshot): UrlTree {\n\n if (route.queryParamMap.has('accessToken') && route.queryParamMap.has('refreshToken') && route.queryParamMap.has('expiresIn')) {\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const accessToken = route.queryParamMap.get('accessToken')!;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const refreshToken = route.queryParamMap.get('refreshToken')!;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const expiresIn = parseInt(route.queryParamMap.get('expiresIn')!, 10);\n const payloadBase64 = route.queryParamMap.get('payload');\n\n const expiresAt = new Date(Date.now() + expiresIn * 1000);\n\n this.oAuthService.authenticated({\n accessToken,\n refreshToken,\n expiresIn,\n expiresAt\n }, true);\n\n let redirectUrl = '/';\n\n if (payloadBase64) {\n try {\n const payload = JSON.parse(atob(payloadBase64));\n console.debug('sso redirect payload', payload);\n if (payload.lastUrl) {\n redirectUrl = payload.lastUrl;\n }\n } catch (e) {\n console.error('Could not parse redirect payload', e.message);\n }\n }\n\n return this.router.createUrlTree([ redirectUrl ]);\n\n } else {\n console.warn('Not every query parameter is defined!');\n }\n\n return this.router.createUrlTree([ ...route.url.map(url => url.path), 'redirect' ]);\n }\n\n\n}\n","import {\n ActivatedRouteSnapshot,\n CanActivate,\n CanActivateChild,\n RouterStateSnapshot,\n UrlTree\n} from '@angular/router';\nimport {\n Injectable,\n Inject,\n isDevMode\n} from '@angular/core';\nimport { OAuthService } from './o-auth.service';\n\n@Injectable({ providedIn: 'root' })\nexport class OAuthRedirectGuard implements CanActivate, CanActivateChild {\n\n constructor(\n @Inject(OAuthService)\n private readonly oAuthService: OAuthService\n ) {\n }\n\n public async canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {\n\n const isAuthenticated = await this.oAuthService.isAuthenticated();\n\n console.log(`isAuthenticated: ${isAuthenticated}`);\n\n if (isAuthenticated) {\n return true;\n }\n\n this.oAuthService.signInWithRedirect(state.url);\n\n return false;\n\n }\n\n public canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {\n return this.canActivate(childRoute, state);\n }\n\n}\n","import {\n NgModule,\n ModuleWithProviders\n} from '@angular/core';\nimport {\n RXAP_O_AUTH_REDIRECT_SIGN_IN,\n RXAP_O_AUTH_REDIRECT_SIGN_OUT\n} from './tokens';\n\nexport interface OAuthModuleOptions {\n signInPath?: string[]\n signOutPath?: string[]\n}\n\n@NgModule()\nexport class OAuthModule {\n\n public static forRoot(options: OAuthModuleOptions = {}): ModuleWithProviders<OAuthModule> {\n return {\n ngModule: OAuthModule,\n providers: [\n {\n provide: RXAP_O_AUTH_REDIRECT_SIGN_IN,\n useValue: options.signInPath ?? [ '/', 'oauth', 'redirect' ]\n },\n {\n provide: RXAP_O_AUTH_REDIRECT_SIGN_OUT,\n useValue: options.signOutPath ?? null\n }\n ]\n };\n }\n\n}\n","import {\n Component,\n ChangeDetectionStrategy\n} from '@angular/core';\nimport { RouterOutlet } from '@angular/router';\nimport {\n trigger,\n transition,\n style,\n animate\n} from '@angular/animations';\n\n@Component({\n selector: 'rxap-container',\n templateUrl: './container.component.html',\n styleUrls: [ './container.component.scss' ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'rxap-container' },\n animations: [\n trigger('routeAnimations', [\n transition(\n ':enter',\n [\n style({ opacity: 0 }),\n animate('512ms', style({ opacity: 1 }))\n ]\n ),\n transition(\n ':leave',\n [\n style({ opacity: 1 }),\n animate('512ms', style({ opacity: 0 }))\n ]\n )\n ])\n ]\n})\nexport class ContainerComponent {\n\n public prepareRoute(outlet: RouterOutlet) {\n return outlet.isActivated ? outlet.activatedRoute : 'true';\n }\n\n}\n","<div [@routeAnimations]=\"prepareRoute(outlet)\" class=\"container\">\n\n <div class=\"split mat-elevation-z3\"></div>\n\n <router-outlet #outlet=\"outlet\"></router-outlet>\n\n</div>\n","import {\n ChangeDetectionStrategy,\n Component\n} from '@angular/core';\n\n@Component({\n selector: 'rxap-loading',\n templateUrl: './loading.component.html',\n styleUrls: [ './loading.component.scss' ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'rxap-loading' }\n})\nexport class LoadingComponent {\n}\n","<mat-progress-bar class=\"loading-bar\" mode=\"indeterminate\"></mat-progress-bar>\n","import {\n Component,\n ChangeDetectionStrategy\n} from '@angular/core';\nimport { OAuthService } from '../o-auth.service';\nimport {\n trigger,\n state,\n style,\n transition,\n animate\n} from '@angular/animations';\n\n@Component({\n selector: 'rxap-sign-in-with-redirect',\n templateUrl: './sign-in-with-redirect.component.html',\n styleUrls: [ './sign-in-with-redirect.component.scss' ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'rxap-sign-in-with-redirect' },\n animations: [\n trigger('fadeAnimation', [\n\n // the \"in\" style determines the \"resting\" state of the element when it is visible.\n state('in', style({ opacity: 1 })),\n\n // fade in when created. this could also be written as transition('void => *')\n transition(':enter', [\n style({ opacity: 0 }),\n animate(300)\n ]),\n\n // fade out when destroyed. this could also be written as transition('void => *')\n transition(\n ':leave',\n animate(300, style({ opacity: 0 }))\n )\n ])\n ]\n})\nexport class SignInWithRedirectComponent {\n\n constructor(\n private readonly authService: OAuthService\n ) {}\n\n public signIn() {\n this.authService.signInWithRedirect();\n }\n\n}\n","<div [@fadeAnimation]=\"'in'\" class=\"inner mat-elevation-z5\" fxLayout=\"column\" fxLayoutAlign=\"center center\" fxLayoutGap=\"32px\">\n\n <div class=\"header\" fxFlex=\"nogrow\" fxLayout=\"column\" fxLayoutAlign=\"center center\">\n\n <mat-icon class=\"avatar-icon\" color=\"primary\" fxFlex=\"nogrow\">account_circle</mat-icon>\n\n </div>\n\n <div fxFlex=\"nogrow\" fxLayout=\"row\" fxLayoutAlign=\"center center\">\n\n <div fxFlex=\"nogrow\">\n <button (click)=\"signIn()\" color=\"primary\" fxFlex=\"nogrow\" mat-raised-button>\n <span fxLayout=\"row\" fxLayoutAlign=\"start center\" fxLayoutGap=\"16px\">\n <mat-icon fxFlex=\"nogrow\">login</mat-icon>\n <span fxFlex=\"nogrow\">Sign In</span>\n </span>\n </button>\n </div>\n\n </div>\n\n</div>\n\n","import { Routes } from '@angular/router';\nimport {\n ContainerComponent\n} from './container/container.component';\nimport { LoadingComponent } from './loading/loading.component';\nimport { SignInWithRedirectComponent } from './sign-in-with-redirect/sign-in-with-redirect.component';\nimport { OAuthExtractGuard } from './o-auth-extract.guard';\n\nexport const RXAP_O_AUTH_ROUTES: Routes = [\n {\n path: 'oauth',\n component: ContainerComponent,\n children: [\n {\n path: 'redirect',\n component: SignInWithRedirectComponent\n },\n {\n canActivate: [ OAuthExtractGuard ],\n path: '',\n component: LoadingComponent\n },\n {\n path: '**',\n redirectTo: ''\n }\n ]\n }\n];\n","import {\n Resolve,\n Router\n} from '@angular/router';\nimport {\n Inject,\n Injectable\n} from '@angular/core';\nimport { OAuthService } from './o-auth.service';\nimport { RXAP_O_AUTH_REDIRECT_SIGN_IN } from './tokens';\n\n@Injectable({ providedIn: 'root' })\nexport class ProfileResolve<T = Record<string, any>> implements Resolve<T> {\n\n constructor(\n @Inject(OAuthService)\n private readonly oAuthService: OAuthService,\n @Inject(Router)\n private readonly router: Router,\n @Inject(RXAP_O_AUTH_REDIRECT_SIGN_IN)\n private readonly redirectLogin: string[]\n ) {\n }\n\n public async resolve(): Promise<T> {\n const profile = await this.oAuthService.getProfile();\n\n if (!profile) {\n await this.router.navigate(this.redirectLogin);\n }\n\n return profile;\n }\n\n}\n","import { NgModule } from '@angular/core';\nimport { ContainerComponent } from './container.component';\nimport { RouterModule } from '@angular/router';\n\n\n@NgModule({\n declarations: [ ContainerComponent ],\n imports: [\n RouterModule\n ],\n exports: [ ContainerComponent ]\n})\nexport class ContainerComponentModule {}\n","import { NgModule } from '@angular/core';\nimport { LoadingComponent } from './loading.component';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\n\n\n@NgModule({\n declarations: [\n LoadingComponent\n ],\n imports: [\n MatProgressBarModule\n ],\n exports: [\n LoadingComponent\n ]\n})\nexport class LoadingComponentModule {\n}\n","import { NgModule } from '@angular/core';\nimport { SignInWithRedirectComponent } from './sign-in-with-redirect.component';\nimport { MatIconModule } from '@angular/material/icon';\nimport { CommonModule } from '@angular/common';\nimport { MatCardModule } from '@angular/material/card';\nimport { FlexLayoutModule } from '@angular/flex-layout';\nimport { MatButtonModule } from '@angular/material/button';\n\n\n@NgModule({\n declarations: [ SignInWithRedirectComponent ],\n imports: [\n MatCardModule,\n MatButtonModule,\n FlexLayoutModule,\n MatIconModule,\n CommonModule\n ],\n exports: [ SignInWithRedirectComponent ]\n})\nexport class SignInWithRedirectComponentModule {}\n","import { NgModule } from '@angular/core';\nimport { ContainerComponentModule } from './container/container.component.module';\nimport { LoadingComponentModule } from './loading/loading.component.module';\nimport {\n SignInWithRedirectComponentModule\n} from './sign-in-with-redirect/sign-in-with-redirect.component.module';\n\n@NgModule({\n exports: [\n ContainerComponentModule,\n LoadingComponentModule,\n SignInWithRedirectComponentModule\n ]\n})\nexport class OAuthRoutingModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;MASa,qBAAqB,GAAG,IAAI,cAAc,CACrD,uBAAuB,EACvB;MASW,qBAAqB;IAGhC,YAEmB,IAAgB,EAG1B,kBAAiC,IAAI;QAH3B,SAAI,GAAJ,IAAI,CAAY;QAG1B,oBAAe,GAAf,eAAe,CAAsB;KAC1C;IAEG,IAAI,CAAC,UAA2C;;QACrD,MAAM,eAAe,GAAG,MAAA,UAAU,CAAC,eAAe,mCAAI,IAAI,CAAC,eAAe,CAAC;QAE3E,IAAI,CAAC,eAAe,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CA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sB;;oHAAtB,sBAAsB;qHAAtB,sBAAsB,iBAT/B,gBAAgB,aAGhB,oBAAoB,aAGpB,gBAAgB;qHAGP,sBAAsB,YAPnB;YACZ,oBAAoB;SACrB;4FAKU,sBAAsB;kBAXlC,QAAQ;mBAAC;oBACR,YAAY,EAAE;wBACZ,gBAAgB;qBACjB;oBACD,OAAO,EAAO;wBACZ,oBAAoB;qBACrB;oBACD,OAAO,EAAO;wBACZ,gBAAgB;qBACjB;iBACF;;;MCKY,iCAAiC;;+HAAjC,iCAAiC;gIAAjC,iCAAiC,iBAV5B,2BAA2B,aAEzC,aAAa;QACb,eAAe;QACf,gBAAgB;QAChB,aAAa;QACb,YAAY,aAEE,2BAA2B;gIAEhC,iCAAiC,YAT9B;YACZ,aAAa;YACb,eAAe;YACf,gBAAgB;YAChB,aAAa;YACb,YAAY;SACb;4FAGU,iCAAiC;kBAX7C,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAE,2BAA2B,CAAE;oBAC7C,OAAO,EAAO;wBACZ,aAAa;wBACb,eAAe;wBACf,gBAAgB;wBAChB,aAAa;wBACb,YAAY;qBACb;oBACD,OAAO,EAAO,CAAE,2BAA2B,CAAE;iBAC9C;;;MCLY,kBAAkB;;gHAAlB,kBAAkB;iHAAlB,kBAAkB,YAL3B,wBAAwB;QACxB,sBAAsB;QACtB,iCAAiC;iHAGxB,kBAAkB,YAL3B,wBAAwB;QACxB,sBAAsB;QACtB,iCAAiC;4FAGxB,kBAAkB;kBAP9B,QAAQ;mBAAC;oBACR,OAAO,EAAE;wBACP,wBAAwB;wBACxB,sBAAsB;wBACtB,iCAAiC;qBAClC;iBACF;;;ACbD;;;;;;"}
@@ -6,12 +6,14 @@ export interface OAuthMethodWithUsernamePasswordParameters {
6
6
  username: string;
7
7
  password: string;
8
8
  secret: string;
9
+ clientId?: string;
9
10
  authEndpoint: string;
10
11
  }
11
12
  export interface OAuthMethodWithRefreshTokenParameters {
12
13
  grantType?: string;
13
14
  refreshToken: string;
14
15
  secret: string;
16
+ clientId?: string;
15
17
  authEndpoint: string;
16
18
  }
17
19
  export declare type OAuthMethodParameters = (OAuthMethodWithUsernamePasswordParameters | OAuthMethodWithRefreshTokenParameters) & {
@@ -6,6 +6,7 @@ import * as i0 from "@angular/core";
6
6
  export declare const OAUTH_SECRET: InjectionToken<unknown>;
7
7
  export declare const OAUTH_AUTH_ENDPOINT: InjectionToken<unknown>;
8
8
  export declare const OAUTH_SSO_URL: InjectionToken<unknown>;
9
+ export declare const OAUTH_CLIENT_ID: InjectionToken<unknown>;
9
10
  export declare const ACCESS_TOKEN_LOCAL_STORAGE_KEY = "access_token";
10
11
  export declare const REFRESH_TOKEN_LOCAL_STORAGE_KEY = "refresh_token";
11
12
  export declare const EXPIRES_AT_LOCAL_STORAGE_KEY = "expires_at";
@@ -26,6 +27,7 @@ export declare class OAuthService<Profile = any> {
26
27
  private readonly ssoUrl;
27
28
  private readonly redirectSignOut;
28
29
  private readonly redirectUrl;
30
+ clientId: string | null;
29
31
  get expiresAt(): Date | null;
30
32
  set expiresAt(value: Date | null);
31
33
  get refreshToken(): string | null;
@@ -41,7 +43,7 @@ export declare class OAuthService<Profile = any> {
41
43
  private _profile?;
42
44
  protected _isAuthenticated: boolean | null;
43
45
  get profile(): Profile | null | undefined;
44
- constructor(oAuthMethod: OAuthMethod, getOAuthProfileMethod: GetOAuthProfileMethod, router: Router, profileEndpoint?: string | null, authEndpoint?: string | null, secret?: string | null, ssoUrl?: string | null, redirectSignOut?: string[] | null, redirectUrl?: string | null);
46
+ constructor(oAuthMethod: OAuthMethod, getOAuthProfileMethod: GetOAuthProfileMethod, router: Router, profileEndpoint?: string | null, authEndpoint?: string | null, secret?: string | null, ssoUrl?: string | null, redirectSignOut?: string[] | null, redirectUrl?: string | null, clientId?: string | null);
45
47
  signInWithRedirect(lastUrl?: string): void;
46
48
  isAuthenticated(): Promise<boolean>;
47
49
  signInWithEmailAndPassword(email: string, password: string, remember: boolean): Promise<OAuthMethodResponse>;
@@ -54,6 +56,6 @@ export declare class OAuthService<Profile = any> {
54
56
  private removeItem;
55
57
  protected clearStorage(): void;
56
58
  private signInWithRefreshToken;
57
- static ɵfac: i0.ɵɵFactoryDeclaration<OAuthService<any>, [null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>;
59
+ static ɵfac: i0.ɵɵFactoryDeclaration<OAuthService<any>, [null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>;
58
60
  static ɵprov: i0.ɵɵInjectableDeclaration<OAuthService<any>>;
59
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxap/oauth",
3
- "version": "12.0.10",
3
+ "version": "12.0.11",
4
4
  "peerDependencies": {
5
5
  "@angular-devkit/schematics": "^12.2.9",
6
6
  "@angular/animations": "^12.0.1",