@kolektor/nucleus-identity 0.1.1911 → 0.1.2192

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.
@@ -91,10 +91,10 @@ class LocationService {
91
91
  window.location.assign(url);
92
92
  }
93
93
  }
94
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: LocationService, deps: [{ token: i1.NucleusAppService }], target: i0.ɵɵFactoryTarget.Injectable }); }
95
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: LocationService, providedIn: 'root' }); }
94
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: LocationService, deps: [{ token: i1.NucleusAppService }], target: i0.ɵɵFactoryTarget.Injectable }); }
95
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: LocationService, providedIn: 'root' }); }
96
96
  }
97
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: LocationService, decorators: [{
97
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: LocationService, decorators: [{
98
98
  type: Injectable,
99
99
  args: [{
100
100
  providedIn: 'root',
@@ -144,10 +144,10 @@ class AngularRequestor extends Requestor {
144
144
  });
145
145
  });
146
146
  }
147
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: AngularRequestor, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
148
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: AngularRequestor, providedIn: 'root' }); }
147
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: AngularRequestor, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
148
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: AngularRequestor, providedIn: 'root' }); }
149
149
  }
150
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: AngularRequestor, decorators: [{
150
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: AngularRequestor, decorators: [{
151
151
  type: Injectable,
152
152
  args: [{
153
153
  providedIn: 'root',
@@ -256,10 +256,10 @@ class OidcConfigurationService {
256
256
  throw e;
257
257
  }
258
258
  }
259
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: OidcConfigurationService, deps: [{ token: AngularRequestor }, { token: NucleusIdentityConfig }, { token: i1.NucleusAppService }], target: i0.ɵɵFactoryTarget.Injectable }); }
260
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: OidcConfigurationService, providedIn: 'root' }); }
259
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: OidcConfigurationService, deps: [{ token: AngularRequestor }, { token: NucleusIdentityConfig }, { token: i1.NucleusAppService }], target: i0.ɵɵFactoryTarget.Injectable }); }
260
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: OidcConfigurationService, providedIn: 'root' }); }
261
261
  }
262
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: OidcConfigurationService, decorators: [{
262
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: OidcConfigurationService, decorators: [{
263
263
  type: Injectable,
264
264
  args: [{
265
265
  providedIn: 'root',
@@ -581,10 +581,10 @@ class TokenClient {
581
581
  throw new AppAuthError(response.error);
582
582
  }
583
583
  }
584
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: TokenClient, deps: [{ token: AngularRequestor }, { token: OidcConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable }); }
585
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: TokenClient, providedIn: 'root' }); }
584
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: TokenClient, deps: [{ token: AngularRequestor }, { token: OidcConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable }); }
585
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: TokenClient, providedIn: 'root' }); }
586
586
  }
587
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: TokenClient, decorators: [{
587
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: TokenClient, decorators: [{
588
588
  type: Injectable,
589
589
  args: [{
590
590
  providedIn: 'root',
@@ -913,10 +913,10 @@ class NucleusIdentityService {
913
913
  }, miliseconds);
914
914
  });
915
915
  }
916
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: NucleusIdentityService, deps: [{ token: i1.NucleusAppService }, { token: LocationService }, { token: i1$1.HttpClient }, { token: OidcConfigurationService }, { token: TokenClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
917
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: NucleusIdentityService, providedIn: 'root' }); }
916
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: NucleusIdentityService, deps: [{ token: i1.NucleusAppService }, { token: LocationService }, { token: i1$1.HttpClient }, { token: OidcConfigurationService }, { token: TokenClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
917
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: NucleusIdentityService, providedIn: 'root' }); }
918
918
  }
919
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: NucleusIdentityService, decorators: [{
919
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: NucleusIdentityService, decorators: [{
920
920
  type: Injectable,
921
921
  args: [{
922
922
  providedIn: 'root',
@@ -973,10 +973,10 @@ class NucleusTokenInterceptor {
973
973
  return throwError(() => err);
974
974
  }));
975
975
  }
976
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: NucleusTokenInterceptor, deps: [{ token: NucleusIdentityService }, { token: NucleusIdentityConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
977
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: NucleusTokenInterceptor, providedIn: 'root' }); }
976
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: NucleusTokenInterceptor, deps: [{ token: NucleusIdentityService }, { token: NucleusIdentityConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
977
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: NucleusTokenInterceptor, providedIn: 'root' }); }
978
978
  }
979
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: NucleusTokenInterceptor, decorators: [{
979
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: NucleusTokenInterceptor, decorators: [{
980
980
  type: Injectable,
981
981
  args: [{
982
982
  providedIn: 'root',
@@ -997,11 +997,11 @@ class NucleusIdentityModule {
997
997
  ],
998
998
  };
999
999
  }
1000
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: NucleusIdentityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1001
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.8", ngImport: i0, type: NucleusIdentityModule }); }
1002
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: NucleusIdentityModule }); }
1000
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: NucleusIdentityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1001
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.13", ngImport: i0, type: NucleusIdentityModule }); }
1002
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: NucleusIdentityModule }); }
1003
1003
  }
1004
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: NucleusIdentityModule, decorators: [{
1004
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.13", ngImport: i0, type: NucleusIdentityModule, decorators: [{
1005
1005
  type: NgModule,
1006
1006
  args: [{
1007
1007
  imports: [],
@@ -1 +1 @@
1
- {"version":3,"file":"kolektor-nucleus-identity.mjs","sources":["../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/nucleus-identity-config.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/models/service-principal.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/utils/location.service.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/utils/nucleus-authorization-notifier.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/utils/angular-requestor.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/utils/authorization-service-configuration.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/utils/oidc-configuration.service.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/models/identity.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/utils/secrets-store.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/models/device-code.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/models/client-registration.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/utils/token-client.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/nucleus-identity.service.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/nucleus-token-interceptor.service.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/nucleus-identity.module.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/models/otp.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/kolektor-nucleus-identity.ts"],"sourcesContent":["export class NucleusIdentityConfig {\n public authority!: string;\n\n public clientId!: string;\n\n public redirectUri?: string;\n\n public androidRedirectUri?: string;\n\n public iOSRedirectUri?: string;\n\n public httpInterceptorUrls?: string[] = [];\n\n public automaticLoginOnHttp401 = false;\n\n public requestedScopes?: string;\n\n public servicePrincipalRequestedScopes?: string;\n\n public authProviderHint?: string;\n}\n","export class ServicePrincipal {\n public id!: string;\n public secret!: string;\n public expiresAt!: Date;\n}\n\nexport class ServicePrincipalRegistrationStatus {\n public id!: string;\n public isRegistered = false;\n public expiresAt!: Date;\n\n constructor(servicePrincipal: ServicePrincipal | null) {\n if (servicePrincipal) {\n this.isRegistered = true;\n this.id = servicePrincipal.id;\n this.expiresAt = servicePrincipal.expiresAt;\n }\n }\n\n public get isExpired() {\n return false;\n }\n}\n","import { LocationLike } from '@openid/appauth';\nimport { NucleusAppService } from '@kolektor/nucleus-common';\nimport { Browser } from '@capacitor/browser';\nimport { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class LocationService implements LocationLike {\n constructor(private appService: NucleusAppService) {}\n\n get hash() {\n return window.location.hash;\n }\n set hash(v) {\n window.location.hash = v;\n }\n\n get host() {\n return window.location.host;\n }\n set host(v) {\n window.location.host = v;\n }\n\n get origin() {\n return window.location.origin;\n }\n\n get hostname() {\n return window.location.hostname;\n }\n set hostname(v) {\n window.location.hostname = v;\n }\n\n get pathname() {\n return window.location.pathname;\n }\n set pathname(v) {\n window.location.pathname = v;\n }\n\n get port() {\n return window.location.port;\n }\n set port(v) {\n window.location.port = v;\n }\n\n get protocol() {\n return window.location.protocol;\n }\n set protocol(v) {\n window.location.protocol = v;\n }\n\n get search() {\n return window.location.search;\n }\n set search(v) {\n window.location.search = v;\n }\n\n assign(url: string): void {\n if (this.appService.isNative) {\n Browser.open({ url });\n } else {\n window.location.assign(url);\n }\n }\n}\n","import { AuthorizationNotifier } from '@openid/appauth';\nimport { AuthorizationResponse, AuthorizationError } from '@openid/appauth';\nimport { AuthorizationRequest } from '@openid/appauth';\n\nexport class NucleusAuthorizationNotifier extends AuthorizationNotifier {\n response: AuthorizationResponse | null = null;\n request!: AuthorizationRequest;\n error: AuthorizationError | null = null;\n\n constructor() {\n super();\n this.setAuthorizationListener((request, response, error) => {\n console.log('Authorization request complete ', request, response, error);\n this.response = response;\n this.request = request;\n this.error = error;\n });\n }\n}\n","import { AppAuthError, Requestor } from '@openid/appauth';\nimport { Injectable } from '@angular/core';\nimport { HttpClient, HttpErrorResponse } from '@angular/common/http';\nimport { HttpHeaders } from '@capacitor/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AngularRequestor extends Requestor {\n constructor(private http: HttpClient) {\n super();\n }\n\n // eslint-disable-next-line no-undef\n xhr<T>(settings: JQueryAjaxSettings): Promise<T> {\n let method = 'GET';\n if (settings.method) {\n method = settings.method;\n }\n\n return new Promise<T>((resolve, reject) => {\n this.http\n .request<T>(method, settings.url as string, {\n body: settings.data,\n headers: settings.headers as HttpHeaders,\n })\n .subscribe({\n next: (res) => resolve(res),\n error: (err) => {\n let e = new AppAuthError(err);\n if (err instanceof HttpErrorResponse) {\n e = new AppAuthError(err.error?.error || err.statusText);\n }\n reject(e);\n },\n });\n });\n }\n}\n","import {\n AuthorizationServiceConfiguration,\n AuthorizationServiceConfigurationJson,\n JQueryRequestor,\n Requestor,\n} from '@openid/appauth';\n\nconst WELL_KNOWN_PATH = '.well-known';\nconst OPENID_CONFIGURATION = 'openid-configuration';\n\nexport interface NucleusAuthorizationServiceConfigurationJson\n extends AuthorizationServiceConfigurationJson {\n device_authorization_endpoint?: string;\n registration_endpoint?: string;\n}\n\nexport class NucleusAuthorizationServiceConfiguration extends AuthorizationServiceConfiguration {\n constructor(request: NucleusAuthorizationServiceConfigurationJson) {\n super(request);\n this.deviceAuthorizationEndpoint = request.device_authorization_endpoint;\n this.registrationEndpoint = request.registration_endpoint;\n }\n\n public deviceAuthorizationEndpoint?: string;\n public registrationEndpoint?: string;\n\n static override async fetchFromIssuer(\n openIdIssuerUrl: string,\n requestor?: Requestor\n ) {\n const fullUrl = `${openIdIssuerUrl}/${WELL_KNOWN_PATH}/${OPENID_CONFIGURATION}`;\n const requestorToUse = requestor || new JQueryRequestor();\n const json =\n await requestorToUse.xhr<NucleusAuthorizationServiceConfigurationJson>({\n url: fullUrl,\n dataType: 'json',\n method: 'GET',\n });\n return new NucleusAuthorizationServiceConfiguration(json);\n }\n\n override toJson() {\n const res = super.toJson() as NucleusAuthorizationServiceConfigurationJson;\n res.device_authorization_endpoint = this.deviceAuthorizationEndpoint;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return res as any;\n }\n}\n","import { Injectable } from '@angular/core';\nimport { NucleusAppService } from '@kolektor/nucleus-common';\nimport { NucleusIdentityConfig } from '../nucleus-identity-config';\nimport { AngularRequestor } from './angular-requestor';\nimport { NucleusAuthorizationServiceConfiguration } from './authorization-service-configuration';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class OidcConfigurationService {\n constructor(\n private requestor: AngularRequestor,\n private config: NucleusIdentityConfig,\n private appService: NucleusAppService\n ) {}\n\n private _configuration: NucleusAuthorizationServiceConfiguration | null =\n null;\n\n public async getConfiguration() {\n await this.assureConfiguration();\n if (!this._configuration) {\n throw Error('Failed to get OIDC configuration!');\n }\n\n return this._configuration;\n }\n\n public get clientId() {\n return this.config.clientId;\n }\n\n public get requestedScopes() {\n return this.config.requestedScopes;\n }\n\n public get servicePrincipalRequestedScopes() {\n return this.config.servicePrincipalRequestedScopes;\n }\n\n public get authProviderHint() {\n return this.config.authProviderHint;\n }\n\n public get redirectUrl() {\n let uri = window.location.href;\n const platform = this.appService.platform;\n if (platform === 'android' && this.config.androidRedirectUri) {\n uri = this.config.androidRedirectUri;\n } else if (platform === 'ios' && this.config.iOSRedirectUri) {\n uri = this.config.iOSRedirectUri;\n } else if (this.config.redirectUri) {\n uri = this.config.redirectUri;\n }\n return this.NormalizeRedirectUri(uri);\n }\n\n public getServerUrl(relativeUri: string | null = null) {\n let authority = this.config.authority;\n if (!authority || authority === 'origin') {\n authority = window.origin;\n }\n\n let url = new URL(authority);\n\n if (relativeUri) {\n url = new URL(relativeUri, url);\n }\n\n return url.href;\n }\n\n private NormalizeRedirectUri(uri: string) {\n const i = uri.indexOf('#');\n if (i > 0) {\n uri = uri.substring(0, i);\n }\n return uri;\n }\n\n private async assureConfiguration() {\n if (this._configuration != null) {\n return;\n }\n let authority = this.getServerUrl();\n if (authority[authority.length - 1] === '/') {\n authority = authority.slice(0, -1);\n }\n try {\n this._configuration =\n await NucleusAuthorizationServiceConfiguration.fetchFromIssuer(\n authority,\n this.requestor\n );\n } catch (e) {\n console.error(\n 'Nucleus.Identity: Cannot load OIDC configuration: ' +\n (e as Error).message\n );\n throw e;\n }\n }\n}\n","import { TokenResponse } from '@openid/appauth';\n\nexport class Claim {\n public name: string;\n public values: string[];\n\n constructor(name: string, values: string[]) {\n this.name = name;\n this.values = values;\n }\n}\n\nexport class Identity {\n public name: string;\n public subject: string;\n\n public claims: Claim[] = [];\n\n constructor(res: TokenResponse) {\n if (!res.idToken) {\n throw Error('There is no id token in the token response!');\n }\n\n const token = this.decodeToken(res.idToken);\n\n this.name = token.name;\n this.subject = token.sub;\n for (const key in token) {\n if ({}.hasOwnProperty.call(token, key)) {\n let vals = token[key];\n\n if (!Array.isArray(vals)) {\n vals = [vals];\n }\n\n const claim = new Claim(key, vals);\n this.claims.push(claim);\n }\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private decodeToken(jwt: string): any {\n if (!jwt) {\n throw new Error(\n 'NucleusIdentity: There was no identity token in the response!'\n );\n }\n\n try {\n const arr = jwt.split('.');\n // var header = arr[0];\n const payload = this.b64DecodeUnicode(arr[1]);\n // var signature = arr[2];\n return JSON.parse(payload);\n } catch (error) {\n console.error('Error while decoding identity token', error);\n console.error('Error while decoding identity token JWT', jwt);\n }\n }\n\n private b64DecodeUnicode(str: string) {\n str = str.replace(/-/g, '+').replace(/_/g, '/'); // Qlector fix :)\n return decodeURIComponent(\n atob(str)\n .split('')\n .map((c) => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2))\n .join('')\n );\n }\n}\n","import 'capacitor-secure-storage-plugin';\nimport { TokenResponse, TokenResponseJson } from '@openid/appauth';\nimport { ServicePrincipal } from '../models/service-principal';\nimport { SecureStoragePlugin } from 'capacitor-secure-storage-plugin';\nimport { Identity } from '../models/identity';\n\nexport class SecretsStore {\n constructor(clientId: string) {\n this._tokenStorageKeyPrefix = `Nucleus.Identity.${clientId}`; // do not change this or login with existing tokens will fail\n this._servicePrincipalKey = `${this._tokenStorageKeyPrefix}.SvcP`;\n this._defaultIdentityIdStorageKey = `${this._tokenStorageKeyPrefix}.IdId`;\n this._defaultIdentityId = localStorage.getItem(\n this._defaultIdentityIdStorageKey\n );\n }\n private _tokenStorageKeyPrefix: string;\n private _tokens: { [id: string]: TokenResponse | null } = {};\n private _identities: { [id: string]: Identity } = {};\n private _servicePrincipalKey;\n private _servicePrincipal: ServicePrincipal | null = null;\n // this specify which identity id is used by default, when If id is not specified in getToken or getIdentity\n private _defaultIdentityId: string | null;\n private _defaultIdentityIdStorageKey: string;\n\n public get defaultIdentityId() {\n return this._defaultIdentityId;\n }\n\n public removeServicePrincipal() {\n this._servicePrincipal = null;\n return this.clear(this._servicePrincipalKey);\n }\n\n public async setServicePrincipal(servicePrincipal: ServicePrincipal) {\n this._servicePrincipal = servicePrincipal;\n await this.save(this._servicePrincipalKey, servicePrincipal);\n }\n\n public async getServicePrincipal() {\n if (!this._servicePrincipal) {\n this._servicePrincipal = await this.load<ServicePrincipal>(\n this._servicePrincipalKey\n );\n }\n return this._servicePrincipal;\n }\n\n public setToken(token: TokenResponse, id: string | null = null) {\n return this.setTokenInternal(token, true, id);\n }\n\n public getIdentity(id: string | null = null): Identity | null {\n const key = this.getTokenKey(id);\n return this._identities[key];\n }\n\n public setDefaultIdentityId(id: string | null) {\n this._defaultIdentityId = id;\n if (this._defaultIdentityId) {\n localStorage.setItem(\n this._defaultIdentityIdStorageKey,\n this._defaultIdentityId\n );\n } else {\n localStorage.removeItem(this._defaultIdentityIdStorageKey);\n }\n }\n\n public async getToken(id: string | null = null) {\n const key = this.getTokenKey(id);\n\n // if token is not there or it is invalid we check storage again before returning\n if (!this._tokens[key] || !this._tokens[key]?.isValid()) {\n await this.reloadTokenFromStorage(id);\n }\n return this._tokens[key];\n }\n\n public removeToken(id: string | null = null) {\n const key = this.getTokenKey(id);\n delete this._tokens[key];\n delete this._identities[key];\n return this.clear(key);\n }\n\n private async reloadTokenFromStorage(id: string | null) {\n const key = this.getTokenKey(id);\n const storedToken = await this.load<TokenResponseJson>(key);\n if (storedToken) {\n const res = new TokenResponse(storedToken);\n if (res?.accessToken || res?.idToken) {\n await this.setTokenInternal(res, false, id);\n }\n }\n return null;\n }\n\n private async setTokenInternal(\n token: TokenResponse,\n save: boolean,\n id: string | null\n ) {\n const key = this.getTokenKey(id);\n if (token == null) {\n await this.removeToken(id);\n } else {\n this._tokens[key] = token;\n this._identities[key] = new Identity(token);\n if (save) {\n try {\n await this.save(key, token.toJson());\n } catch (e) {\n console.warn('Nucleus.Identity: Could not save to SecureStorage.');\n }\n }\n }\n }\n\n private getTokenKey(id: string | null) {\n if (!id) {\n id = this._defaultIdentityId;\n }\n return id\n ? `${this._tokenStorageKeyPrefix}.${id}`\n : this._tokenStorageKeyPrefix;\n }\n\n private clear(key: string) {\n return SecureStoragePlugin.remove({ key });\n }\n\n private save<T>(key: string, value: T): Promise<{ value: boolean }> {\n return SecureStoragePlugin.set({ key, value: JSON.stringify(value) });\n }\n\n private async load<T>(key: string) {\n try {\n const x = await SecureStoragePlugin.get({ key });\n if (x?.value) {\n return JSON.parse(x.value) as T;\n } else {\n return null;\n }\n } catch {\n return null;\n }\n }\n}\n","import { nowInSeconds } from '@openid/appauth';\n\nexport interface DeviceCodeJson {\n device_code: string;\n user_code: string;\n verification_uri: string;\n verification_uri_complete: string;\n expires_in: string;\n message: string;\n}\n\nexport class DeviceCode {\n constructor(response: DeviceCodeJson) {\n this.deviceCode = response.device_code;\n this.userCode = response.user_code;\n this.verificationUrl = response.verification_uri;\n this.verificationUrlComplete = response.verification_uri_complete;\n this.expiresIn = parseInt(response.expires_in, 10);\n this.issuedAt = nowInSeconds();\n }\n\n private expiresIn: number;\n private issuedAt: number;\n\n public deviceCode: string;\n public userCode: string;\n public verificationUrl: string;\n public verificationUrlComplete: string;\n\n isExpired(buffer = 60) {\n return this.secondsLeft(buffer) <= 0;\n }\n\n secondsLeft(buffer = 60) {\n const now = nowInSeconds();\n return this.issuedAt + this.expiresIn - buffer - now;\n }\n}\n","export interface ClientRegistrationResponseJson {\n client_id: string;\n client_secret: string;\n client_secret_expires_at: number;\n}\n\nexport class ClientRegistrationResponse {\n constructor(response: ClientRegistrationResponseJson) {\n this.clientId = response.client_id;\n this.clientSecret = response.client_secret;\n this.secretExpirationDate = new Date(\n response.client_secret_expires_at * 1000\n );\n }\n\n clientId: string;\n clientSecret: string;\n secretExpirationDate: Date;\n}\n","import {\n AppAuthError,\n BaseTokenRequestHandler,\n BasicQueryStringUtils,\n GRANT_TYPE_AUTHORIZATION_CODE,\n GRANT_TYPE_REFRESH_TOKEN,\n QueryStringUtils,\n StringMap,\n TokenErrorJson,\n TokenRequest,\n TokenRequestHandler,\n} from '@openid/appauth';\nimport { OidcConfigurationService } from './oidc-configuration.service';\nimport { AngularRequestor } from './angular-requestor';\nimport { Injectable } from '@angular/core';\nimport { DeviceCode, DeviceCodeJson } from '../models/device-code';\nimport {\n ClientRegistrationResponse,\n ClientRegistrationResponseJson,\n} from '../models/client-registration';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TokenClient {\n constructor(\n private requestor: AngularRequestor,\n private config: OidcConfigurationService\n ) {\n this._tokenHandler = new BaseTokenRequestHandler(requestor);\n this._utils = new BasicQueryStringUtils();\n }\n\n private _tokenHandler: TokenRequestHandler;\n private _utils: QueryStringUtils;\n\n public async getByAuthorizationCode(\n redirectUrl: string,\n code: string,\n codeVerifier?: string\n ) {\n const config = await this.config.getConfiguration();\n const redirectUri = redirectUrl;\n const req = new TokenRequest({\n client_id: this.config.clientId,\n redirect_uri: redirectUri,\n grant_type: GRANT_TYPE_AUTHORIZATION_CODE,\n code,\n extras: codeVerifier ? { code_verifier: codeVerifier } : undefined,\n });\n return await this._tokenHandler.performTokenRequest(config, req);\n }\n\n public async getByRefreshToken(refreshToken: string) {\n const config = await this.config.getConfiguration();\n const redirectUri = this.config.redirectUrl;\n const req = new TokenRequest({\n client_id: this.config.clientId,\n redirect_uri: redirectUri,\n grant_type: GRANT_TYPE_REFRESH_TOKEN,\n refresh_token: refreshToken,\n });\n return await this._tokenHandler.performTokenRequest(config, req);\n }\n\n public async getByClientCredentials(\n clientId: string,\n clientSecret: string,\n scope: string\n ) {\n const config = await this.config.getConfiguration();\n const req = new TokenRequest({\n client_id: clientId,\n redirect_uri: '',\n grant_type: 'client_credentials',\n extras: {\n client_secret: clientSecret,\n scope,\n },\n });\n return await this._tokenHandler.performTokenRequest(config, req);\n }\n\n public async getBySecret(\n provider: string,\n secret: string,\n assertionToken: string,\n scope: string\n ) {\n const config = await this.config.getConfiguration();\n const req = new TokenRequest({\n client_id: this.config.clientId,\n redirect_uri: '',\n grant_type: 'urn:kolektor:nucleus:secret',\n extras: {\n secret_provider: provider,\n secret_value: secret,\n client_assertion_type:\n 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',\n client_assertion: assertionToken,\n scope,\n },\n });\n\n return await this._tokenHandler.performTokenRequest(config, req);\n }\n\n public async getByDeviceCode(deviceCode: string) {\n const config = await this.config.getConfiguration();\n const req = new TokenRequest({\n client_id: this.config.clientId,\n redirect_uri: '',\n grant_type: 'urn:ietf:params:oauth:grant-type:device_code',\n extras: {\n device_code: deviceCode,\n },\n });\n return await this._tokenHandler.performTokenRequest(config, req);\n }\n\n public async registerServicePrincipal(token: string) {\n const config = await this.config.getConfiguration();\n\n const response = await this.requestor.xhr<\n ClientRegistrationResponseJson | TokenErrorJson\n >({\n url: config.registrationEndpoint,\n method: 'POST',\n dataType: 'json',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`,\n },\n // data: this._utils.stringify(map)\n });\n\n if ((response as TokenErrorJson).error === undefined) {\n return new ClientRegistrationResponse(\n response as ClientRegistrationResponseJson\n );\n } else {\n throw new AppAuthError((response as TokenErrorJson).error);\n }\n }\n\n public async getRegistrationCode(\n existingServicePrincipalId: string | null = null\n ) {\n const params = {\n custom_action: 'sp_register',\n service_principal_id: existingServicePrincipalId,\n };\n\n return this.getDeviceCodeInternal(params as StringMap);\n }\n\n public async getDeviceCode(scope: string) {\n const params = {\n scope,\n };\n return this.getDeviceCodeInternal(params);\n }\n\n private async getDeviceCodeInternal(params: StringMap) {\n const config = await this.config.getConfiguration();\n\n params['client_id'] = this.config.clientId;\n const map: StringMap = params;\n\n const response = await this.requestor.xhr<DeviceCodeJson | TokenErrorJson>({\n url: config.deviceAuthorizationEndpoint,\n method: 'POST',\n dataType: 'json',\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n data: this._utils.stringify(map),\n });\n\n if ((response as TokenErrorJson).error === undefined) {\n return new DeviceCode(response as DeviceCodeJson);\n } else {\n throw new AppAuthError((response as TokenErrorJson).error);\n }\n }\n}\n","import {\n AppAuthError,\n AuthorizationRequest,\n AuthorizationRequestHandler,\n BasicQueryStringUtils,\n Crypto,\n DefaultCrypto,\n LocalStorageBackend,\n RedirectRequestHandler,\n StringMap,\n TokenResponse,\n} from '@openid/appauth';\n\nimport { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\n\nimport { App } from '@capacitor/app';\nimport { Browser } from '@capacitor/browser';\nimport { Device } from '@capacitor/device';\n\nimport { NucleusAppService } from '@kolektor/nucleus-common';\n\nimport { lastValueFrom } from 'rxjs';\n\nimport { DeviceCode } from './models/device-code';\nimport { OtpResponse, OtpStatus, OtpType } from './models/otp';\nimport { ServicePrincipalRegistrationStatus } from './models/service-principal';\n\nimport { LocationService } from './utils/location.service';\nimport { NucleusAuthorizationNotifier } from './utils/nucleus-authorization-notifier';\nimport { OidcConfigurationService } from './utils/oidc-configuration.service';\nimport { SecretsStore } from './utils/secrets-store';\nimport { TokenClient } from './utils/token-client';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NucleusIdentityService {\n constructor(\n private appService: NucleusAppService,\n location: LocationService,\n private http: HttpClient,\n private config: OidcConfigurationService,\n private tokenClient: TokenClient\n ) {\n const storage = new LocalStorageBackend();\n this._crypto = new DefaultCrypto();\n this._authorizationHandler = new RedirectRequestHandler(\n storage,\n new BasicQueryStringUtils(),\n location,\n this._crypto\n );\n this._authorizationHandler.setAuthorizationNotifier(\n this._authorizationNotifier\n );\n this._store = new SecretsStore(config.clientId);\n }\n\n private _authorizationHandler: AuthorizationRequestHandler;\n private _authorizationNotifier = new NucleusAuthorizationNotifier();\n private _crypto: Crypto;\n private _initStarted = false;\n private _initialized = false;\n private _refreshTokenPromise: Promise<TokenResponse | null> | null = null;\n private _getTokenPromise: Promise<string | null> | null = null;\n private _getServicePrincipalTokenPromise: Promise<string> | null = null;\n private _servicePrincipalTokenId = '_svcp';\n private _store: SecretsStore;\n\n public get identity() {\n return this._store.getIdentity();\n }\n\n public get isAuthenticated() {\n return this.identity != null;\n }\n\n public get servicePrincipalIdentity() {\n return this._store.getIdentity(this._servicePrincipalTokenId);\n }\n\n public get isServicePrincipalAuthenticated() {\n return this.servicePrincipalIdentity != null;\n }\n\n public get isIdentityServicePrincipal() {\n return this._store.defaultIdentityId === this._servicePrincipalTokenId;\n }\n\n public async init(startLogin = false): Promise<void> {\n if (this._initStarted || this._initialized) {\n console.warn(\n \"Nucleus.Identity: Auth initialization was already started. Don't call init() multiple times!\"\n );\n return;\n }\n this._initStarted = true;\n\n this.handleLaunchCodeHash();\n await this._authorizationHandler.completeAuthorizationRequestIfPossible();\n\n const authErr = this._authorizationNotifier.error;\n if (authErr) {\n throw new Error(\n 'Authorization err: ' + authErr.error + ': ' + authErr.errorDescription\n );\n } else if (this._authorizationNotifier.response) {\n window.location.hash = '';\n const request = this._authorizationNotifier.request;\n const response = this._authorizationNotifier.response;\n\n const codeVerifier = request.internal\n ? request.internal['code_verifier']\n : undefined;\n const res = await this.tokenClient.getByAuthorizationCode(\n request.redirectUri,\n response.code,\n codeVerifier\n );\n this._store.setDefaultIdentityId(null);\n await this._store.setToken(res);\n } else {\n const res = await this._store.getToken();\n if (!res && startLogin) {\n await this.login();\n }\n }\n this._initialized = true;\n }\n\n public async loginWithSecret(\n provider: string,\n secret: string\n ): Promise<void> {\n this._store.removeToken().catch(() => console.log('No token to remove.'));\n const assertionToken = await this.getServicePrincipalAccessToken();\n const scope = this.prepareScope(true, this.config?.requestedScopes);\n const res = await this.tokenClient.getBySecret(\n provider,\n secret,\n assertionToken,\n scope\n );\n this._store.setDefaultIdentityId(null);\n await this._store.setToken(res);\n }\n\n public async login(): Promise<void> {\n this._store.removeToken();\n const config = await this.config.getConfiguration();\n const request = this.prepareAuthorizationRequest();\n if (this.appService.isNative) {\n const listener = await App.addListener('appUrlOpen', (data) => {\n if (this.appService.platform === 'ios') {\n Browser.close();\n }\n listener.remove();\n const hash = this.getCodeHash(data.url);\n if (hash) {\n const targetUrl =\n window.location.origin + window.location.pathname + '#' + hash;\n window.location.assign(targetUrl);\n window.location.reload();\n } else {\n console.warn(\n 'Nucleus.Identity: Redirect url did not contain authorization code!',\n data\n );\n }\n });\n }\n this._authorizationHandler.performAuthorizationRequest(config, request);\n }\n\n public async logout(): Promise<void> {\n this._store.removeToken();\n const config = await this.config.getConfiguration();\n const redirectUrl = this.config.redirectUrl;\n const logoutUrl =\n config.endSessionEndpoint +\n '?post_logout_redirect_uri=' +\n encodeURI(redirectUrl);\n if (this.appService.isNative) {\n const listener = await App.addListener('appUrlOpen', () => {\n Device.getInfo().then((info) => {\n if (info.platform === 'ios') {\n Browser.close();\n }\n });\n listener.remove();\n });\n Browser.open({ url: logoutUrl });\n } else {\n window.location.assign(logoutUrl);\n }\n }\n\n public async getAccessToken() {\n if (!this._getTokenPromise) {\n this._getTokenPromise = this.getAccessTokenInternal();\n }\n try {\n return await this._getTokenPromise;\n } finally {\n this._getTokenPromise = null;\n }\n }\n\n public async getServicePrincipalAccessToken() {\n if (!this._getServicePrincipalTokenPromise) {\n this._getServicePrincipalTokenPromise =\n this.getServicePrincipalAccessTokenInternal();\n }\n try {\n return await this._getServicePrincipalTokenPromise;\n } finally {\n this._getServicePrincipalTokenPromise = null;\n }\n }\n\n public async loginServicePrincipal() {\n const sp = await this._store.getServicePrincipal();\n if (sp) {\n const scope = this.prepareScope(\n false,\n this.config.servicePrincipalRequestedScopes\n );\n const res = await this.tokenClient.getByClientCredentials(\n sp.id,\n sp.secret,\n scope\n );\n await this._store.setToken(res, this._servicePrincipalTokenId);\n return res;\n } else {\n throw Error('Service principal is not registered!');\n }\n }\n\n public async loginAsServicePrincipal() {\n const token = await this._store.getToken(this._servicePrincipalTokenId);\n if (!token) {\n await this.loginServicePrincipal();\n }\n this._store.setDefaultIdentityId(this._servicePrincipalTokenId);\n }\n\n public async getOtp(type: OtpType, expiresIn = -1) {\n let url = this.config.getServerUrl(`/otp/create?type=${type}`);\n if (expiresIn > 0) {\n url += `&expiresIn=${expiresIn}`;\n }\n return lastValueFrom(this.http.get<OtpResponse>(url));\n }\n\n public async getOtpStatus(id: string) {\n const url = this.config.getServerUrl(`/otp/status/${id}`);\n return lastValueFrom(this.http.get<OtpStatus>(url));\n }\n\n public getOtpUrl(redirectUrl: string, password: string) {\n const encoded = encodeURIComponent(redirectUrl);\n const url = `/otp/auth?otpValue=${password}&returnUrl=${encoded}`;\n return this.config.getServerUrl(url);\n }\n\n public async startServicePrincipalRegistration() {\n const sp = await this._store.getServicePrincipal();\n return await this.tokenClient.getRegistrationCode(sp?.id);\n }\n\n public async completeServicePrincipalRegistration(deviceCode: DeviceCode) {\n const tokenRes = await this.waitForDeviceToken(deviceCode);\n const regRes = await this.tokenClient.registerServicePrincipal(\n tokenRes.accessToken\n );\n\n await this._store.setServicePrincipal({\n id: regRes.clientId,\n secret: regRes.clientSecret,\n expiresAt: regRes.secretExpirationDate,\n });\n }\n\n public removeServicePrincipalRegistration() {\n return this._store.removeServicePrincipal();\n }\n\n public async getServicePrincipalRegistrationStatus() {\n const sp = await this._store.getServicePrincipal();\n return new ServicePrincipalRegistrationStatus(sp);\n }\n\n public async startDeviceCodeLogin() {\n const scope = this.prepareScope(true, this.config.requestedScopes);\n return await this.tokenClient.getDeviceCode(scope);\n }\n\n public async completeDeviceCodeLogin(deviceCode: DeviceCode) {\n const res = await this.waitForDeviceToken(deviceCode);\n await this._store.setToken(res);\n }\n\n private async waitForDeviceToken(deviceCode: DeviceCode) {\n let res: TokenResponse | null = null;\n do {\n if (deviceCode.isExpired()) {\n throw Error('Device code is expired!');\n }\n\n try {\n res = await this.tokenClient.getByDeviceCode(deviceCode.deviceCode);\n } catch (error) {\n if (\n error instanceof AppAuthError &&\n error.message === 'authorization_pending'\n ) {\n await this.delay(2000);\n } else {\n throw error;\n }\n }\n } while (!res);\n return res;\n }\n\n private prepareAuthorizationRequest(): AuthorizationRequest {\n const redirectUri = this.config.redirectUrl;\n\n const params = {\n response_mode: 'fragment',\n prompt: 'consent',\n access_type: 'offline',\n auth_provider_hint: this.config.authProviderHint,\n };\n\n return new AuthorizationRequest(\n {\n client_id: this.config.clientId,\n redirect_uri: redirectUri,\n response_type: AuthorizationRequest.RESPONSE_TYPE_CODE,\n scope: this.prepareScope(true, this.config.requestedScopes),\n extras: params as StringMap,\n },\n this._crypto,\n true\n );\n }\n\n private async getServicePrincipalAccessTokenInternal() {\n let token = await this._store.getToken(this._servicePrincipalTokenId);\n if (!token?.isValid()) {\n token = await this.loginServicePrincipal();\n }\n return token?.accessToken;\n }\n\n private async getAccessTokenInternal() {\n let token = await this._store.getToken();\n if (token && !token.isValid()) {\n token = await this.loginWithRefreshToken(token);\n }\n return token?.accessToken ?? null;\n }\n\n private async loginWithRefreshToken(token: TokenResponse) {\n if (!this._refreshTokenPromise) {\n this._refreshTokenPromise = this.loginWithRefreshTokenInternal(token);\n }\n try {\n return await this._refreshTokenPromise;\n } finally {\n this._refreshTokenPromise = null;\n }\n }\n\n private async loginWithRefreshTokenInternal(token: TokenResponse) {\n if (token?.refreshToken) {\n try {\n const res = await this.tokenClient.getByRefreshToken(\n token.refreshToken\n );\n await this._store.setToken(res);\n return res;\n } catch (err) {\n console.warn(\n 'Nucleus.Identity: Failed to login with refresh token.',\n err\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((err as any).message === 'invalid_grant') {\n await this.logout();\n }\n }\n } else {\n console.warn('Nucleus.Identity: There is no refresh token available.');\n }\n return null;\n }\n\n private getCodeHash(url: string) {\n const arr = url.split('#');\n if (arr.length > 1) {\n const hash = arr[1];\n if (hash.startsWith('code=')) {\n return hash;\n }\n }\n return null;\n }\n\n private handleLaunchCodeHash() {\n if (this.appService.isNative && this.appService.launchUrl) {\n const hash = this.getCodeHash(this.appService.launchUrl);\n if (hash) {\n console.log(\n 'Nucleus.Identity: Got authorization code from launchUrl, will assign it to hash.'\n );\n window.location.hash = '#' + hash;\n }\n }\n }\n\n private prepareScope(offlineAccess: boolean, aditionalScope?: string) {\n let scope = 'openid';\n if (offlineAccess) {\n scope += ' offline_access';\n }\n if (aditionalScope) {\n scope += ' ' + aditionalScope;\n }\n return scope;\n }\n\n private delay(miliseconds: number) {\n return new Promise<void>((resolve) => {\n setTimeout(() => {\n resolve();\n }, miliseconds);\n });\n }\n}\n","import {\n HttpErrorResponse,\n HttpEvent,\n HttpHandler,\n HttpInterceptor,\n HttpRequest,\n} from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable, from, throwError } from 'rxjs';\nimport { catchError, mergeMap } from 'rxjs/operators';\nimport { NucleusIdentityConfig } from './nucleus-identity-config';\nimport { NucleusIdentityService } from './nucleus-identity.service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NucleusTokenInterceptor implements HttpInterceptor {\n constructor(\n private auth: NucleusIdentityService,\n private config: NucleusIdentityConfig\n ) {\n this._authority = config.authority.toLowerCase();\n this._interceptUrls = config.httpInterceptorUrls?.map((x) =>\n x.toLowerCase()\n );\n }\n\n private _authority: string;\n private _authorityInterceptPaths = [\n '/api',\n '/manage',\n '/otp/create',\n '/otp/status',\n ];\n private _interceptUrls?: string[];\n\n public intercept(\n req: HttpRequest<unknown>,\n next: HttpHandler\n ): Observable<HttpEvent<unknown>> {\n if (this.shouldIntercept(req.url)) {\n const res = this.authorizeRequest(this.auth.getAccessToken(), req, next);\n return this.checkUnauthorized(res);\n }\n return next.handle(req);\n }\n\n private shouldIntercept(url: string): boolean {\n url = url.toLowerCase();\n\n if (url.startsWith(this._authority)) {\n const pathname = new URL(url).pathname;\n return this._authorityInterceptPaths.some((x) => pathname.startsWith(x));\n }\n\n if (this._interceptUrls && this._interceptUrls.length > 0) {\n return (\n this.config.httpInterceptorUrls?.some((x) => url.startsWith(x)) ?? false\n );\n }\n return false;\n }\n\n private authorizeRequest(\n getToken: Promise<string | null>,\n req: HttpRequest<unknown>,\n next: HttpHandler\n ): Observable<HttpEvent<unknown>> {\n return from(getToken).pipe(\n mergeMap((token) => {\n if (token) {\n const headers = req.headers.set('Authorization', `Bearer ${token}`);\n req = req.clone({ headers });\n }\n return next.handle(req);\n })\n );\n }\n\n private checkUnauthorized(\n response: Observable<HttpEvent<unknown>>\n ): Observable<HttpEvent<unknown>> {\n return response.pipe(\n catchError((err) => {\n if (err instanceof HttpErrorResponse && err.status === 401) {\n if (this.config.automaticLoginOnHttp401) {\n this.auth.login();\n }\n }\n return throwError(() => err);\n })\n );\n }\n}\n","import { NgModule, ModuleWithProviders } from '@angular/core';\nimport { HTTP_INTERCEPTORS } from '@angular/common/http';\nimport { NucleusTokenInterceptor } from './nucleus-token-interceptor.service';\nimport { NucleusIdentityConfig } from './nucleus-identity-config';\n\n@NgModule({\n imports: [],\n declarations: [],\n exports: [],\n})\nexport class NucleusIdentityModule {\n static forRoot(\n config: NucleusIdentityConfig\n ): ModuleWithProviders<NucleusIdentityModule> {\n return {\n ngModule: NucleusIdentityModule,\n providers: [\n { provide: NucleusIdentityConfig, useValue: config },\n {\n provide: HTTP_INTERCEPTORS,\n useClass: NucleusTokenInterceptor,\n multi: true,\n },\n ],\n };\n }\n}\n","export class OtpResponse {\n public password!: string;\n public passwordId!: string;\n}\n\nexport class OtpStatus {\n public isExpired!: boolean;\n public isUsed!: boolean;\n public secondsToExpiration!: number;\n}\n\nexport enum OtpType {\n SimpleNumbers = 0,\n SimpleAlfanumeric = 1,\n Complex = 2,\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1","i1.AngularRequestor","i2.NucleusIdentityConfig","i3","i2.OidcConfigurationService","i2.LocationService","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oBAAA,OAAO,EAAE,iBAAiB;AAC1B,oBAAA,QAAQ,EAAE,uBAAuB;AACjC,oBAAA,KAAK,EAAE,IAAI;AACZ,iBAAA;AACF,aAAA;SACF;IACH;8GAfW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAArB,qBAAqB,EAAA,CAAA,CAAA;+GAArB,qBAAqB,EAAA,CAAA,CAAA;;2FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBALjC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE,EAAE;AACZ,iBAAA;;;MCTY,WAAW,CAAA;AAGvB;MAEY,SAAS,CAAA;AAIrB;IAEW;AAAZ,CAAA,UAAY,OAAO,EAAA;AACjB,IAAA,OAAA,CAAA,OAAA,CAAA,eAAA,CAAA,GAAA,CAAA,CAAA,GAAA,eAAiB;AACjB,IAAA,OAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,mBAAqB;AACrB,IAAA,OAAA,CAAA,OAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAW;AACb,CAAC,EAJW,OAAO,KAAP,OAAO,GAAA,EAAA,CAAA,CAAA;;ACXnB;;AAEG;;;;"}
1
+ {"version":3,"file":"kolektor-nucleus-identity.mjs","sources":["../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/nucleus-identity-config.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/models/service-principal.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/utils/location.service.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/utils/nucleus-authorization-notifier.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/utils/angular-requestor.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/utils/authorization-service-configuration.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/utils/oidc-configuration.service.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/models/identity.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/utils/secrets-store.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/models/device-code.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/models/client-registration.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/utils/token-client.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/nucleus-identity.service.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/nucleus-token-interceptor.service.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/nucleus-identity.module.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/lib/models/otp.ts","../../../../../../libs/ng/nucleus/nucleus-identity/src/kolektor-nucleus-identity.ts"],"sourcesContent":["export class NucleusIdentityConfig {\n public authority!: string;\n\n public clientId!: string;\n\n public redirectUri?: string;\n\n public androidRedirectUri?: string;\n\n public iOSRedirectUri?: string;\n\n public httpInterceptorUrls?: string[] = [];\n\n public automaticLoginOnHttp401 = false;\n\n public requestedScopes?: string;\n\n public servicePrincipalRequestedScopes?: string;\n\n public authProviderHint?: string;\n}\n","export class ServicePrincipal {\n public id!: string;\n public secret!: string;\n public expiresAt!: Date;\n}\n\nexport class ServicePrincipalRegistrationStatus {\n public id!: string;\n public isRegistered = false;\n public expiresAt!: Date;\n\n constructor(servicePrincipal: ServicePrincipal | null) {\n if (servicePrincipal) {\n this.isRegistered = true;\n this.id = servicePrincipal.id;\n this.expiresAt = servicePrincipal.expiresAt;\n }\n }\n\n public get isExpired() {\n return false;\n }\n}\n","import { LocationLike } from '@openid/appauth';\nimport { NucleusAppService } from '@kolektor/nucleus-common';\nimport { Browser } from '@capacitor/browser';\nimport { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class LocationService implements LocationLike {\n constructor(private appService: NucleusAppService) {}\n\n get hash() {\n return window.location.hash;\n }\n set hash(v) {\n window.location.hash = v;\n }\n\n get host() {\n return window.location.host;\n }\n set host(v) {\n window.location.host = v;\n }\n\n get origin() {\n return window.location.origin;\n }\n\n get hostname() {\n return window.location.hostname;\n }\n set hostname(v) {\n window.location.hostname = v;\n }\n\n get pathname() {\n return window.location.pathname;\n }\n set pathname(v) {\n window.location.pathname = v;\n }\n\n get port() {\n return window.location.port;\n }\n set port(v) {\n window.location.port = v;\n }\n\n get protocol() {\n return window.location.protocol;\n }\n set protocol(v) {\n window.location.protocol = v;\n }\n\n get search() {\n return window.location.search;\n }\n set search(v) {\n window.location.search = v;\n }\n\n assign(url: string): void {\n if (this.appService.isNative) {\n Browser.open({ url });\n } else {\n window.location.assign(url);\n }\n }\n}\n","import { AuthorizationNotifier } from '@openid/appauth';\nimport { AuthorizationResponse, AuthorizationError } from '@openid/appauth';\nimport { AuthorizationRequest } from '@openid/appauth';\n\nexport class NucleusAuthorizationNotifier extends AuthorizationNotifier {\n response: AuthorizationResponse | null = null;\n request!: AuthorizationRequest;\n error: AuthorizationError | null = null;\n\n constructor() {\n super();\n this.setAuthorizationListener((request, response, error) => {\n console.log('Authorization request complete ', request, response, error);\n this.response = response;\n this.request = request;\n this.error = error;\n });\n }\n}\n","import { AppAuthError, Requestor } from '@openid/appauth';\nimport { Injectable } from '@angular/core';\nimport { HttpClient, HttpErrorResponse } from '@angular/common/http';\nimport { HttpHeaders } from '@capacitor/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AngularRequestor extends Requestor {\n constructor(private http: HttpClient) {\n super();\n }\n\n // eslint-disable-next-line no-undef\n xhr<T>(settings: JQueryAjaxSettings): Promise<T> {\n let method = 'GET';\n if (settings.method) {\n method = settings.method;\n }\n\n return new Promise<T>((resolve, reject) => {\n this.http\n .request<T>(method, settings.url as string, {\n body: settings.data,\n headers: settings.headers as HttpHeaders,\n })\n .subscribe({\n next: (res) => resolve(res),\n error: (err) => {\n let e = new AppAuthError(err);\n if (err instanceof HttpErrorResponse) {\n e = new AppAuthError(err.error?.error || err.statusText);\n }\n reject(e);\n },\n });\n });\n }\n}\n","import {\n AuthorizationServiceConfiguration,\n AuthorizationServiceConfigurationJson,\n JQueryRequestor,\n Requestor,\n} from '@openid/appauth';\n\nconst WELL_KNOWN_PATH = '.well-known';\nconst OPENID_CONFIGURATION = 'openid-configuration';\n\nexport interface NucleusAuthorizationServiceConfigurationJson\n extends AuthorizationServiceConfigurationJson {\n device_authorization_endpoint?: string;\n registration_endpoint?: string;\n}\n\nexport class NucleusAuthorizationServiceConfiguration extends AuthorizationServiceConfiguration {\n constructor(request: NucleusAuthorizationServiceConfigurationJson) {\n super(request);\n this.deviceAuthorizationEndpoint = request.device_authorization_endpoint;\n this.registrationEndpoint = request.registration_endpoint;\n }\n\n public deviceAuthorizationEndpoint?: string;\n public registrationEndpoint?: string;\n\n static override async fetchFromIssuer(\n openIdIssuerUrl: string,\n requestor?: Requestor\n ) {\n const fullUrl = `${openIdIssuerUrl}/${WELL_KNOWN_PATH}/${OPENID_CONFIGURATION}`;\n const requestorToUse = requestor || new JQueryRequestor();\n const json =\n await requestorToUse.xhr<NucleusAuthorizationServiceConfigurationJson>({\n url: fullUrl,\n dataType: 'json',\n method: 'GET',\n });\n return new NucleusAuthorizationServiceConfiguration(json);\n }\n\n override toJson() {\n const res = super.toJson() as NucleusAuthorizationServiceConfigurationJson;\n res.device_authorization_endpoint = this.deviceAuthorizationEndpoint;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return res as any;\n }\n}\n","import { Injectable } from '@angular/core';\nimport { NucleusAppService } from '@kolektor/nucleus-common';\nimport { NucleusIdentityConfig } from '../nucleus-identity-config';\nimport { AngularRequestor } from './angular-requestor';\nimport { NucleusAuthorizationServiceConfiguration } from './authorization-service-configuration';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class OidcConfigurationService {\n constructor(\n private requestor: AngularRequestor,\n private config: NucleusIdentityConfig,\n private appService: NucleusAppService\n ) {}\n\n private _configuration: NucleusAuthorizationServiceConfiguration | null =\n null;\n\n public async getConfiguration() {\n await this.assureConfiguration();\n if (!this._configuration) {\n throw Error('Failed to get OIDC configuration!');\n }\n\n return this._configuration;\n }\n\n public get clientId() {\n return this.config.clientId;\n }\n\n public get requestedScopes() {\n return this.config.requestedScopes;\n }\n\n public get servicePrincipalRequestedScopes() {\n return this.config.servicePrincipalRequestedScopes;\n }\n\n public get authProviderHint() {\n return this.config.authProviderHint;\n }\n\n public get redirectUrl() {\n let uri = window.location.href;\n const platform = this.appService.platform;\n if (platform === 'android' && this.config.androidRedirectUri) {\n uri = this.config.androidRedirectUri;\n } else if (platform === 'ios' && this.config.iOSRedirectUri) {\n uri = this.config.iOSRedirectUri;\n } else if (this.config.redirectUri) {\n uri = this.config.redirectUri;\n }\n return this.NormalizeRedirectUri(uri);\n }\n\n public getServerUrl(relativeUri: string | null = null) {\n let authority = this.config.authority;\n if (!authority || authority === 'origin') {\n authority = window.origin;\n }\n\n let url = new URL(authority);\n\n if (relativeUri) {\n url = new URL(relativeUri, url);\n }\n\n return url.href;\n }\n\n private NormalizeRedirectUri(uri: string) {\n const i = uri.indexOf('#');\n if (i > 0) {\n uri = uri.substring(0, i);\n }\n return uri;\n }\n\n private async assureConfiguration() {\n if (this._configuration != null) {\n return;\n }\n let authority = this.getServerUrl();\n if (authority[authority.length - 1] === '/') {\n authority = authority.slice(0, -1);\n }\n try {\n this._configuration =\n await NucleusAuthorizationServiceConfiguration.fetchFromIssuer(\n authority,\n this.requestor\n );\n } catch (e) {\n console.error(\n 'Nucleus.Identity: Cannot load OIDC configuration: ' +\n (e as Error).message\n );\n throw e;\n }\n }\n}\n","import { TokenResponse } from '@openid/appauth';\n\nexport class Claim {\n public name: string;\n public values: string[];\n\n constructor(name: string, values: string[]) {\n this.name = name;\n this.values = values;\n }\n}\n\nexport class Identity {\n public name: string;\n public subject: string;\n\n public claims: Claim[] = [];\n\n constructor(res: TokenResponse) {\n if (!res.idToken) {\n throw Error('There is no id token in the token response!');\n }\n\n const token = this.decodeToken(res.idToken);\n\n this.name = token.name;\n this.subject = token.sub;\n for (const key in token) {\n if ({}.hasOwnProperty.call(token, key)) {\n let vals = token[key];\n\n if (!Array.isArray(vals)) {\n vals = [vals];\n }\n\n const claim = new Claim(key, vals);\n this.claims.push(claim);\n }\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private decodeToken(jwt: string): any {\n if (!jwt) {\n throw new Error(\n 'NucleusIdentity: There was no identity token in the response!'\n );\n }\n\n try {\n const arr = jwt.split('.');\n // var header = arr[0];\n const payload = this.b64DecodeUnicode(arr[1]);\n // var signature = arr[2];\n return JSON.parse(payload);\n } catch (error) {\n console.error('Error while decoding identity token', error);\n console.error('Error while decoding identity token JWT', jwt);\n }\n }\n\n private b64DecodeUnicode(str: string) {\n str = str.replace(/-/g, '+').replace(/_/g, '/'); // Qlector fix :)\n return decodeURIComponent(\n atob(str)\n .split('')\n .map((c) => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2))\n .join('')\n );\n }\n}\n","import 'capacitor-secure-storage-plugin';\nimport { TokenResponse, TokenResponseJson } from '@openid/appauth';\nimport { ServicePrincipal } from '../models/service-principal';\nimport { SecureStoragePlugin } from 'capacitor-secure-storage-plugin';\nimport { Identity } from '../models/identity';\n\nexport class SecretsStore {\n constructor(clientId: string) {\n this._tokenStorageKeyPrefix = `Nucleus.Identity.${clientId}`; // do not change this or login with existing tokens will fail\n this._servicePrincipalKey = `${this._tokenStorageKeyPrefix}.SvcP`;\n this._defaultIdentityIdStorageKey = `${this._tokenStorageKeyPrefix}.IdId`;\n this._defaultIdentityId = localStorage.getItem(\n this._defaultIdentityIdStorageKey\n );\n }\n private _tokenStorageKeyPrefix: string;\n private _tokens: { [id: string]: TokenResponse | null } = {};\n private _identities: { [id: string]: Identity } = {};\n private _servicePrincipalKey;\n private _servicePrincipal: ServicePrincipal | null = null;\n // this specify which identity id is used by default, when If id is not specified in getToken or getIdentity\n private _defaultIdentityId: string | null;\n private _defaultIdentityIdStorageKey: string;\n\n public get defaultIdentityId() {\n return this._defaultIdentityId;\n }\n\n public removeServicePrincipal() {\n this._servicePrincipal = null;\n return this.clear(this._servicePrincipalKey);\n }\n\n public async setServicePrincipal(servicePrincipal: ServicePrincipal) {\n this._servicePrincipal = servicePrincipal;\n await this.save(this._servicePrincipalKey, servicePrincipal);\n }\n\n public async getServicePrincipal() {\n if (!this._servicePrincipal) {\n this._servicePrincipal = await this.load<ServicePrincipal>(\n this._servicePrincipalKey\n );\n }\n return this._servicePrincipal;\n }\n\n public setToken(token: TokenResponse, id: string | null = null) {\n return this.setTokenInternal(token, true, id);\n }\n\n public getIdentity(id: string | null = null): Identity | null {\n const key = this.getTokenKey(id);\n return this._identities[key];\n }\n\n public setDefaultIdentityId(id: string | null) {\n this._defaultIdentityId = id;\n if (this._defaultIdentityId) {\n localStorage.setItem(\n this._defaultIdentityIdStorageKey,\n this._defaultIdentityId\n );\n } else {\n localStorage.removeItem(this._defaultIdentityIdStorageKey);\n }\n }\n\n public async getToken(id: string | null = null) {\n const key = this.getTokenKey(id);\n\n // if token is not there or it is invalid we check storage again before returning\n if (!this._tokens[key] || !this._tokens[key]?.isValid()) {\n await this.reloadTokenFromStorage(id);\n }\n return this._tokens[key];\n }\n\n public removeToken(id: string | null = null) {\n const key = this.getTokenKey(id);\n delete this._tokens[key];\n delete this._identities[key];\n return this.clear(key);\n }\n\n private async reloadTokenFromStorage(id: string | null) {\n const key = this.getTokenKey(id);\n const storedToken = await this.load<TokenResponseJson>(key);\n if (storedToken) {\n const res = new TokenResponse(storedToken);\n if (res?.accessToken || res?.idToken) {\n await this.setTokenInternal(res, false, id);\n }\n }\n return null;\n }\n\n private async setTokenInternal(\n token: TokenResponse,\n save: boolean,\n id: string | null\n ) {\n const key = this.getTokenKey(id);\n if (token == null) {\n await this.removeToken(id);\n } else {\n this._tokens[key] = token;\n this._identities[key] = new Identity(token);\n if (save) {\n try {\n await this.save(key, token.toJson());\n } catch (e) {\n console.warn('Nucleus.Identity: Could not save to SecureStorage.');\n }\n }\n }\n }\n\n private getTokenKey(id: string | null) {\n if (!id) {\n id = this._defaultIdentityId;\n }\n return id\n ? `${this._tokenStorageKeyPrefix}.${id}`\n : this._tokenStorageKeyPrefix;\n }\n\n private clear(key: string) {\n return SecureStoragePlugin.remove({ key });\n }\n\n private save<T>(key: string, value: T): Promise<{ value: boolean }> {\n return SecureStoragePlugin.set({ key, value: JSON.stringify(value) });\n }\n\n private async load<T>(key: string) {\n try {\n const x = await SecureStoragePlugin.get({ key });\n if (x?.value) {\n return JSON.parse(x.value) as T;\n } else {\n return null;\n }\n } catch {\n return null;\n }\n }\n}\n","import { nowInSeconds } from '@openid/appauth';\n\nexport interface DeviceCodeJson {\n device_code: string;\n user_code: string;\n verification_uri: string;\n verification_uri_complete: string;\n expires_in: string;\n message: string;\n}\n\nexport class DeviceCode {\n constructor(response: DeviceCodeJson) {\n this.deviceCode = response.device_code;\n this.userCode = response.user_code;\n this.verificationUrl = response.verification_uri;\n this.verificationUrlComplete = response.verification_uri_complete;\n this.expiresIn = parseInt(response.expires_in, 10);\n this.issuedAt = nowInSeconds();\n }\n\n private expiresIn: number;\n private issuedAt: number;\n\n public deviceCode: string;\n public userCode: string;\n public verificationUrl: string;\n public verificationUrlComplete: string;\n\n isExpired(buffer = 60) {\n return this.secondsLeft(buffer) <= 0;\n }\n\n secondsLeft(buffer = 60) {\n const now = nowInSeconds();\n return this.issuedAt + this.expiresIn - buffer - now;\n }\n}\n","export interface ClientRegistrationResponseJson {\n client_id: string;\n client_secret: string;\n client_secret_expires_at: number;\n}\n\nexport class ClientRegistrationResponse {\n constructor(response: ClientRegistrationResponseJson) {\n this.clientId = response.client_id;\n this.clientSecret = response.client_secret;\n this.secretExpirationDate = new Date(\n response.client_secret_expires_at * 1000\n );\n }\n\n clientId: string;\n clientSecret: string;\n secretExpirationDate: Date;\n}\n","import {\n AppAuthError,\n BaseTokenRequestHandler,\n BasicQueryStringUtils,\n GRANT_TYPE_AUTHORIZATION_CODE,\n GRANT_TYPE_REFRESH_TOKEN,\n QueryStringUtils,\n StringMap,\n TokenErrorJson,\n TokenRequest,\n TokenRequestHandler,\n} from '@openid/appauth';\nimport { OidcConfigurationService } from './oidc-configuration.service';\nimport { AngularRequestor } from './angular-requestor';\nimport { Injectable } from '@angular/core';\nimport { DeviceCode, DeviceCodeJson } from '../models/device-code';\nimport {\n ClientRegistrationResponse,\n ClientRegistrationResponseJson,\n} from '../models/client-registration';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TokenClient {\n constructor(\n private requestor: AngularRequestor,\n private config: OidcConfigurationService\n ) {\n this._tokenHandler = new BaseTokenRequestHandler(requestor);\n this._utils = new BasicQueryStringUtils();\n }\n\n private _tokenHandler: TokenRequestHandler;\n private _utils: QueryStringUtils;\n\n public async getByAuthorizationCode(\n redirectUrl: string,\n code: string,\n codeVerifier?: string\n ) {\n const config = await this.config.getConfiguration();\n const redirectUri = redirectUrl;\n const req = new TokenRequest({\n client_id: this.config.clientId,\n redirect_uri: redirectUri,\n grant_type: GRANT_TYPE_AUTHORIZATION_CODE,\n code,\n extras: codeVerifier ? { code_verifier: codeVerifier } : undefined,\n });\n return await this._tokenHandler.performTokenRequest(config, req);\n }\n\n public async getByRefreshToken(refreshToken: string) {\n const config = await this.config.getConfiguration();\n const redirectUri = this.config.redirectUrl;\n const req = new TokenRequest({\n client_id: this.config.clientId,\n redirect_uri: redirectUri,\n grant_type: GRANT_TYPE_REFRESH_TOKEN,\n refresh_token: refreshToken,\n });\n return await this._tokenHandler.performTokenRequest(config, req);\n }\n\n public async getByClientCredentials(\n clientId: string,\n clientSecret: string,\n scope: string\n ) {\n const config = await this.config.getConfiguration();\n const req = new TokenRequest({\n client_id: clientId,\n redirect_uri: '',\n grant_type: 'client_credentials',\n extras: {\n client_secret: clientSecret,\n scope,\n },\n });\n return await this._tokenHandler.performTokenRequest(config, req);\n }\n\n public async getBySecret(\n provider: string,\n secret: string,\n assertionToken: string,\n scope: string\n ) {\n const config = await this.config.getConfiguration();\n const req = new TokenRequest({\n client_id: this.config.clientId,\n redirect_uri: '',\n grant_type: 'urn:kolektor:nucleus:secret',\n extras: {\n secret_provider: provider,\n secret_value: secret,\n client_assertion_type:\n 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',\n client_assertion: assertionToken,\n scope,\n },\n });\n\n return await this._tokenHandler.performTokenRequest(config, req);\n }\n\n public async getByDeviceCode(deviceCode: string) {\n const config = await this.config.getConfiguration();\n const req = new TokenRequest({\n client_id: this.config.clientId,\n redirect_uri: '',\n grant_type: 'urn:ietf:params:oauth:grant-type:device_code',\n extras: {\n device_code: deviceCode,\n },\n });\n return await this._tokenHandler.performTokenRequest(config, req);\n }\n\n public async registerServicePrincipal(token: string) {\n const config = await this.config.getConfiguration();\n\n const response = await this.requestor.xhr<\n ClientRegistrationResponseJson | TokenErrorJson\n >({\n url: config.registrationEndpoint,\n method: 'POST',\n dataType: 'json',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`,\n },\n // data: this._utils.stringify(map)\n });\n\n if ((response as TokenErrorJson).error === undefined) {\n return new ClientRegistrationResponse(\n response as ClientRegistrationResponseJson\n );\n } else {\n throw new AppAuthError((response as TokenErrorJson).error);\n }\n }\n\n public async getRegistrationCode(\n existingServicePrincipalId: string | null = null\n ) {\n const params = {\n custom_action: 'sp_register',\n service_principal_id: existingServicePrincipalId,\n };\n\n return this.getDeviceCodeInternal(params as StringMap);\n }\n\n public async getDeviceCode(scope: string) {\n const params = {\n scope,\n };\n return this.getDeviceCodeInternal(params);\n }\n\n private async getDeviceCodeInternal(params: StringMap) {\n const config = await this.config.getConfiguration();\n\n params['client_id'] = this.config.clientId;\n const map: StringMap = params;\n\n const response = await this.requestor.xhr<DeviceCodeJson | TokenErrorJson>({\n url: config.deviceAuthorizationEndpoint,\n method: 'POST',\n dataType: 'json',\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n data: this._utils.stringify(map),\n });\n\n if ((response as TokenErrorJson).error === undefined) {\n return new DeviceCode(response as DeviceCodeJson);\n } else {\n throw new AppAuthError((response as TokenErrorJson).error);\n }\n }\n}\n","import {\n AppAuthError,\n AuthorizationRequest,\n AuthorizationRequestHandler,\n BasicQueryStringUtils,\n Crypto,\n DefaultCrypto,\n LocalStorageBackend,\n RedirectRequestHandler,\n StringMap,\n TokenResponse,\n} from '@openid/appauth';\n\nimport { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\n\nimport { App } from '@capacitor/app';\nimport { Browser } from '@capacitor/browser';\nimport { Device } from '@capacitor/device';\n\nimport { NucleusAppService } from '@kolektor/nucleus-common';\n\nimport { lastValueFrom } from 'rxjs';\n\nimport { DeviceCode } from './models/device-code';\nimport { OtpResponse, OtpStatus, OtpType } from './models/otp';\nimport { ServicePrincipalRegistrationStatus } from './models/service-principal';\n\nimport { LocationService } from './utils/location.service';\nimport { NucleusAuthorizationNotifier } from './utils/nucleus-authorization-notifier';\nimport { OidcConfigurationService } from './utils/oidc-configuration.service';\nimport { SecretsStore } from './utils/secrets-store';\nimport { TokenClient } from './utils/token-client';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NucleusIdentityService {\n constructor(\n private appService: NucleusAppService,\n location: LocationService,\n private http: HttpClient,\n private config: OidcConfigurationService,\n private tokenClient: TokenClient\n ) {\n const storage = new LocalStorageBackend();\n this._crypto = new DefaultCrypto();\n this._authorizationHandler = new RedirectRequestHandler(\n storage,\n new BasicQueryStringUtils(),\n location,\n this._crypto\n );\n this._authorizationHandler.setAuthorizationNotifier(\n this._authorizationNotifier\n );\n this._store = new SecretsStore(config.clientId);\n }\n\n private _authorizationHandler: AuthorizationRequestHandler;\n private _authorizationNotifier = new NucleusAuthorizationNotifier();\n private _crypto: Crypto;\n private _initStarted = false;\n private _initialized = false;\n private _refreshTokenPromise: Promise<TokenResponse | null> | null = null;\n private _getTokenPromise: Promise<string | null> | null = null;\n private _getServicePrincipalTokenPromise: Promise<string> | null = null;\n private _servicePrincipalTokenId = '_svcp';\n private _store: SecretsStore;\n\n public get identity() {\n return this._store.getIdentity();\n }\n\n public get isAuthenticated() {\n return this.identity != null;\n }\n\n public get servicePrincipalIdentity() {\n return this._store.getIdentity(this._servicePrincipalTokenId);\n }\n\n public get isServicePrincipalAuthenticated() {\n return this.servicePrincipalIdentity != null;\n }\n\n public get isIdentityServicePrincipal() {\n return this._store.defaultIdentityId === this._servicePrincipalTokenId;\n }\n\n public async init(startLogin = false): Promise<void> {\n if (this._initStarted || this._initialized) {\n console.warn(\n \"Nucleus.Identity: Auth initialization was already started. Don't call init() multiple times!\"\n );\n return;\n }\n this._initStarted = true;\n\n this.handleLaunchCodeHash();\n await this._authorizationHandler.completeAuthorizationRequestIfPossible();\n\n const authErr = this._authorizationNotifier.error;\n if (authErr) {\n throw new Error(\n 'Authorization err: ' + authErr.error + ': ' + authErr.errorDescription\n );\n } else if (this._authorizationNotifier.response) {\n window.location.hash = '';\n const request = this._authorizationNotifier.request;\n const response = this._authorizationNotifier.response;\n\n const codeVerifier = request.internal\n ? request.internal['code_verifier']\n : undefined;\n const res = await this.tokenClient.getByAuthorizationCode(\n request.redirectUri,\n response.code,\n codeVerifier\n );\n this._store.setDefaultIdentityId(null);\n await this._store.setToken(res);\n } else {\n const res = await this._store.getToken();\n if (!res && startLogin) {\n await this.login();\n }\n }\n this._initialized = true;\n }\n\n public async loginWithSecret(\n provider: string,\n secret: string\n ): Promise<void> {\n this._store.removeToken().catch(() => console.log('No token to remove.'));\n const assertionToken = await this.getServicePrincipalAccessToken();\n const scope = this.prepareScope(true, this.config?.requestedScopes);\n const res = await this.tokenClient.getBySecret(\n provider,\n secret,\n assertionToken,\n scope\n );\n this._store.setDefaultIdentityId(null);\n await this._store.setToken(res);\n }\n\n public async login(): Promise<void> {\n this._store.removeToken();\n const config = await this.config.getConfiguration();\n const request = this.prepareAuthorizationRequest();\n if (this.appService.isNative) {\n const listener = await App.addListener('appUrlOpen', (data) => {\n if (this.appService.platform === 'ios') {\n Browser.close();\n }\n listener.remove();\n const hash = this.getCodeHash(data.url);\n if (hash) {\n const targetUrl =\n window.location.origin + window.location.pathname + '#' + hash;\n window.location.assign(targetUrl);\n window.location.reload();\n } else {\n console.warn(\n 'Nucleus.Identity: Redirect url did not contain authorization code!',\n data\n );\n }\n });\n }\n this._authorizationHandler.performAuthorizationRequest(config, request);\n }\n\n public async logout(): Promise<void> {\n this._store.removeToken();\n const config = await this.config.getConfiguration();\n const redirectUrl = this.config.redirectUrl;\n const logoutUrl =\n config.endSessionEndpoint +\n '?post_logout_redirect_uri=' +\n encodeURI(redirectUrl);\n if (this.appService.isNative) {\n const listener = await App.addListener('appUrlOpen', () => {\n Device.getInfo().then((info) => {\n if (info.platform === 'ios') {\n Browser.close();\n }\n });\n listener.remove();\n });\n Browser.open({ url: logoutUrl });\n } else {\n window.location.assign(logoutUrl);\n }\n }\n\n public async getAccessToken() {\n if (!this._getTokenPromise) {\n this._getTokenPromise = this.getAccessTokenInternal();\n }\n try {\n return await this._getTokenPromise;\n } finally {\n this._getTokenPromise = null;\n }\n }\n\n public async getServicePrincipalAccessToken() {\n if (!this._getServicePrincipalTokenPromise) {\n this._getServicePrincipalTokenPromise =\n this.getServicePrincipalAccessTokenInternal();\n }\n try {\n return await this._getServicePrincipalTokenPromise;\n } finally {\n this._getServicePrincipalTokenPromise = null;\n }\n }\n\n public async loginServicePrincipal() {\n const sp = await this._store.getServicePrincipal();\n if (sp) {\n const scope = this.prepareScope(\n false,\n this.config.servicePrincipalRequestedScopes\n );\n const res = await this.tokenClient.getByClientCredentials(\n sp.id,\n sp.secret,\n scope\n );\n await this._store.setToken(res, this._servicePrincipalTokenId);\n return res;\n } else {\n throw Error('Service principal is not registered!');\n }\n }\n\n public async loginAsServicePrincipal() {\n const token = await this._store.getToken(this._servicePrincipalTokenId);\n if (!token) {\n await this.loginServicePrincipal();\n }\n this._store.setDefaultIdentityId(this._servicePrincipalTokenId);\n }\n\n public async getOtp(type: OtpType, expiresIn = -1) {\n let url = this.config.getServerUrl(`/otp/create?type=${type}`);\n if (expiresIn > 0) {\n url += `&expiresIn=${expiresIn}`;\n }\n return lastValueFrom(this.http.get<OtpResponse>(url));\n }\n\n public async getOtpStatus(id: string) {\n const url = this.config.getServerUrl(`/otp/status/${id}`);\n return lastValueFrom(this.http.get<OtpStatus>(url));\n }\n\n public getOtpUrl(redirectUrl: string, password: string) {\n const encoded = encodeURIComponent(redirectUrl);\n const url = `/otp/auth?otpValue=${password}&returnUrl=${encoded}`;\n return this.config.getServerUrl(url);\n }\n\n public async startServicePrincipalRegistration() {\n const sp = await this._store.getServicePrincipal();\n return await this.tokenClient.getRegistrationCode(sp?.id);\n }\n\n public async completeServicePrincipalRegistration(deviceCode: DeviceCode) {\n const tokenRes = await this.waitForDeviceToken(deviceCode);\n const regRes = await this.tokenClient.registerServicePrincipal(\n tokenRes.accessToken\n );\n\n await this._store.setServicePrincipal({\n id: regRes.clientId,\n secret: regRes.clientSecret,\n expiresAt: regRes.secretExpirationDate,\n });\n }\n\n public removeServicePrincipalRegistration() {\n return this._store.removeServicePrincipal();\n }\n\n public async getServicePrincipalRegistrationStatus() {\n const sp = await this._store.getServicePrincipal();\n return new ServicePrincipalRegistrationStatus(sp);\n }\n\n public async startDeviceCodeLogin() {\n const scope = this.prepareScope(true, this.config.requestedScopes);\n return await this.tokenClient.getDeviceCode(scope);\n }\n\n public async completeDeviceCodeLogin(deviceCode: DeviceCode) {\n const res = await this.waitForDeviceToken(deviceCode);\n await this._store.setToken(res);\n }\n\n private async waitForDeviceToken(deviceCode: DeviceCode) {\n let res: TokenResponse | null = null;\n do {\n if (deviceCode.isExpired()) {\n throw Error('Device code is expired!');\n }\n\n try {\n res = await this.tokenClient.getByDeviceCode(deviceCode.deviceCode);\n } catch (error) {\n if (\n error instanceof AppAuthError &&\n error.message === 'authorization_pending'\n ) {\n await this.delay(2000);\n } else {\n throw error;\n }\n }\n } while (!res);\n return res;\n }\n\n private prepareAuthorizationRequest(): AuthorizationRequest {\n const redirectUri = this.config.redirectUrl;\n\n const params = {\n response_mode: 'fragment',\n prompt: 'consent',\n access_type: 'offline',\n auth_provider_hint: this.config.authProviderHint,\n };\n\n return new AuthorizationRequest(\n {\n client_id: this.config.clientId,\n redirect_uri: redirectUri,\n response_type: AuthorizationRequest.RESPONSE_TYPE_CODE,\n scope: this.prepareScope(true, this.config.requestedScopes),\n extras: params as StringMap,\n },\n this._crypto,\n true\n );\n }\n\n private async getServicePrincipalAccessTokenInternal() {\n let token = await this._store.getToken(this._servicePrincipalTokenId);\n if (!token?.isValid()) {\n token = await this.loginServicePrincipal();\n }\n return token?.accessToken;\n }\n\n private async getAccessTokenInternal() {\n let token = await this._store.getToken();\n if (token && !token.isValid()) {\n token = await this.loginWithRefreshToken(token);\n }\n return token?.accessToken ?? null;\n }\n\n private async loginWithRefreshToken(token: TokenResponse) {\n if (!this._refreshTokenPromise) {\n this._refreshTokenPromise = this.loginWithRefreshTokenInternal(token);\n }\n try {\n return await this._refreshTokenPromise;\n } finally {\n this._refreshTokenPromise = null;\n }\n }\n\n private async loginWithRefreshTokenInternal(token: TokenResponse) {\n if (token?.refreshToken) {\n try {\n const res = await this.tokenClient.getByRefreshToken(\n token.refreshToken\n );\n await this._store.setToken(res);\n return res;\n } catch (err) {\n console.warn(\n 'Nucleus.Identity: Failed to login with refresh token.',\n err\n );\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((err as any).message === 'invalid_grant') {\n await this.logout();\n }\n }\n } else {\n console.warn('Nucleus.Identity: There is no refresh token available.');\n }\n return null;\n }\n\n private getCodeHash(url: string) {\n const arr = url.split('#');\n if (arr.length > 1) {\n const hash = arr[1];\n if (hash.startsWith('code=')) {\n return hash;\n }\n }\n return null;\n }\n\n private handleLaunchCodeHash() {\n if (this.appService.isNative && this.appService.launchUrl) {\n const hash = this.getCodeHash(this.appService.launchUrl);\n if (hash) {\n console.log(\n 'Nucleus.Identity: Got authorization code from launchUrl, will assign it to hash.'\n );\n window.location.hash = '#' + hash;\n }\n }\n }\n\n private prepareScope(offlineAccess: boolean, aditionalScope?: string) {\n let scope = 'openid';\n if (offlineAccess) {\n scope += ' offline_access';\n }\n if (aditionalScope) {\n scope += ' ' + aditionalScope;\n }\n return scope;\n }\n\n private delay(miliseconds: number) {\n return new Promise<void>((resolve) => {\n setTimeout(() => {\n resolve();\n }, miliseconds);\n });\n }\n}\n","import { HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable, from, throwError } from 'rxjs';\nimport { catchError, mergeMap } from 'rxjs/operators';\nimport { NucleusIdentityConfig } from './nucleus-identity-config';\nimport { NucleusIdentityService } from './nucleus-identity.service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NucleusTokenInterceptor implements HttpInterceptor {\n constructor(\n private auth: NucleusIdentityService,\n private config: NucleusIdentityConfig\n ) {\n this._authority = config.authority.toLowerCase();\n this._interceptUrls = config.httpInterceptorUrls?.map((x) =>\n x.toLowerCase()\n );\n }\n\n private _authority: string;\n private _authorityInterceptPaths = [\n '/api',\n '/manage',\n '/otp/create',\n '/otp/status',\n ];\n private _interceptUrls?: string[];\n\n public intercept(\n req: HttpRequest<unknown>,\n next: HttpHandler\n ): Observable<HttpEvent<unknown>> {\n if (this.shouldIntercept(req.url)) {\n const res = this.authorizeRequest(this.auth.getAccessToken(), req, next);\n return this.checkUnauthorized(res);\n }\n return next.handle(req);\n }\n\n private shouldIntercept(url: string): boolean {\n url = url.toLowerCase();\n\n if (url.startsWith(this._authority)) {\n const pathname = new URL(url).pathname;\n return this._authorityInterceptPaths.some((x) => pathname.startsWith(x));\n }\n\n if (this._interceptUrls && this._interceptUrls.length > 0) {\n return (\n this.config.httpInterceptorUrls?.some((x) => url.startsWith(x)) ?? false\n );\n }\n return false;\n }\n\n private authorizeRequest(\n getToken: Promise<string | null>,\n req: HttpRequest<unknown>,\n next: HttpHandler\n ): Observable<HttpEvent<unknown>> {\n return from(getToken).pipe(\n mergeMap((token) => {\n if (token) {\n const headers = req.headers.set('Authorization', `Bearer ${token}`);\n req = req.clone({ headers });\n }\n return next.handle(req);\n })\n );\n }\n\n private checkUnauthorized(\n response: Observable<HttpEvent<unknown>>\n ): Observable<HttpEvent<unknown>> {\n return response.pipe(\n catchError((err) => {\n if (err instanceof HttpErrorResponse && err.status === 401) {\n if (this.config.automaticLoginOnHttp401) {\n this.auth.login();\n }\n }\n return throwError(() => err);\n })\n );\n }\n}\n","import { NgModule, ModuleWithProviders } from '@angular/core';\nimport { HTTP_INTERCEPTORS } from '@angular/common/http';\nimport { NucleusTokenInterceptor } from './nucleus-token-interceptor.service';\nimport { NucleusIdentityConfig } from './nucleus-identity-config';\n\n@NgModule({\n imports: [],\n declarations: [],\n exports: [],\n})\nexport class NucleusIdentityModule {\n static forRoot(\n config: NucleusIdentityConfig\n ): ModuleWithProviders<NucleusIdentityModule> {\n return {\n ngModule: NucleusIdentityModule,\n providers: [\n { provide: NucleusIdentityConfig, useValue: config },\n {\n provide: HTTP_INTERCEPTORS,\n useClass: NucleusTokenInterceptor,\n multi: true,\n },\n ],\n };\n }\n}\n","export class OtpResponse {\n public password!: string;\n public passwordId!: string;\n}\n\nexport class OtpStatus {\n public isExpired!: boolean;\n public isUsed!: boolean;\n public secondsToExpiration!: number;\n}\n\nexport enum OtpType {\n SimpleNumbers = 0,\n SimpleAlfanumeric = 1,\n Complex = 2,\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1","i1.AngularRequestor","i2.NucleusIdentityConfig","i3","i2.OidcConfigurationService","i2.LocationService","i4.OidcConfigurationService","i5.TokenClient","i1.NucleusIdentityService"],"mappings":";;;;;;;;;;;;;MAAa,qBAAqB,CAAA;AAAlC,IAAA,WAAA,GAAA;QAWS,IAAA,CAAA,mBAAmB,GAAc,EAAE;QAEnC,IAAA,C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AAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;gHAArB,qBAAqB,EAAA,CAAA,CAAA;gHAArB,qBAAqB,EAAA,CAAA,CAAA;;4FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBALjC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,YAAY,EAAE,EAAE;AAChB,oBAAA,OAAO,EAAE,EAAE;AACZ,iBAAA;;;MCTY,WAAW,CAAA;AAGvB;MAEY,SAAS,CAAA;AAIrB;IAEW;AAAZ,CAAA,UAAY,OAAO,EAAA;AACjB,IAAA,OAAA,CAAA,OAAA,CAAA,eAAA,CAAA,GAAA,CAAA,CAAA,GAAA,eAAiB;AACjB,IAAA,OAAA,CAAA,OAAA,CAAA,mBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,mBAAqB;AACrB,IAAA,OAAA,CAAA,OAAA,CAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAW;AACb,CAAC,EAJW,OAAO,KAAP,OAAO,GAAA,EAAA,CAAA,CAAA;;ACXnB;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -1,6 +1,237 @@
1
- export * from './lib/nucleus-identity.module';
2
- export * from './lib/nucleus-identity.service';
3
- export * from './lib/nucleus-identity-config';
4
- export { OtpResponse, OtpStatus, OtpType } from './lib/models/otp';
5
- export { DeviceCode } from './lib/models/device-code';
6
- export { ServicePrincipalRegistrationStatus } from './lib/models/service-principal';
1
+ import * as i0 from '@angular/core';
2
+ import { ModuleWithProviders } from '@angular/core';
3
+ import * as _openid_appauth from '@openid/appauth';
4
+ import { TokenResponse, LocationLike, Requestor, AuthorizationServiceConfiguration, AuthorizationServiceConfigurationJson } from '@openid/appauth';
5
+ import { HttpClient } from '@angular/common/http';
6
+ import { NucleusAppService } from '@kolektor/nucleus-common';
7
+
8
+ declare class NucleusIdentityConfig {
9
+ authority: string;
10
+ clientId: string;
11
+ redirectUri?: string;
12
+ androidRedirectUri?: string;
13
+ iOSRedirectUri?: string;
14
+ httpInterceptorUrls?: string[];
15
+ automaticLoginOnHttp401: boolean;
16
+ requestedScopes?: string;
17
+ servicePrincipalRequestedScopes?: string;
18
+ authProviderHint?: string;
19
+ }
20
+
21
+ declare class NucleusIdentityModule {
22
+ static forRoot(config: NucleusIdentityConfig): ModuleWithProviders<NucleusIdentityModule>;
23
+ static ɵfac: i0.ɵɵFactoryDeclaration<NucleusIdentityModule, never>;
24
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NucleusIdentityModule, never, never, never>;
25
+ static ɵinj: i0.ɵɵInjectorDeclaration<NucleusIdentityModule>;
26
+ }
27
+
28
+ declare class Claim {
29
+ name: string;
30
+ values: string[];
31
+ constructor(name: string, values: string[]);
32
+ }
33
+ declare class Identity {
34
+ name: string;
35
+ subject: string;
36
+ claims: Claim[];
37
+ constructor(res: TokenResponse);
38
+ private decodeToken;
39
+ private b64DecodeUnicode;
40
+ }
41
+
42
+ interface DeviceCodeJson {
43
+ device_code: string;
44
+ user_code: string;
45
+ verification_uri: string;
46
+ verification_uri_complete: string;
47
+ expires_in: string;
48
+ message: string;
49
+ }
50
+ declare class DeviceCode {
51
+ constructor(response: DeviceCodeJson);
52
+ private expiresIn;
53
+ private issuedAt;
54
+ deviceCode: string;
55
+ userCode: string;
56
+ verificationUrl: string;
57
+ verificationUrlComplete: string;
58
+ isExpired(buffer?: number): boolean;
59
+ secondsLeft(buffer?: number): number;
60
+ }
61
+
62
+ declare class OtpResponse {
63
+ password: string;
64
+ passwordId: string;
65
+ }
66
+ declare class OtpStatus {
67
+ isExpired: boolean;
68
+ isUsed: boolean;
69
+ secondsToExpiration: number;
70
+ }
71
+ declare enum OtpType {
72
+ SimpleNumbers = 0,
73
+ SimpleAlfanumeric = 1,
74
+ Complex = 2
75
+ }
76
+
77
+ declare class ServicePrincipal {
78
+ id: string;
79
+ secret: string;
80
+ expiresAt: Date;
81
+ }
82
+ declare class ServicePrincipalRegistrationStatus {
83
+ id: string;
84
+ isRegistered: boolean;
85
+ expiresAt: Date;
86
+ constructor(servicePrincipal: ServicePrincipal | null);
87
+ get isExpired(): boolean;
88
+ }
89
+
90
+ declare class LocationService implements LocationLike {
91
+ private appService;
92
+ constructor(appService: NucleusAppService);
93
+ get hash(): string;
94
+ set hash(v: string);
95
+ get host(): string;
96
+ set host(v: string);
97
+ get origin(): string;
98
+ get hostname(): string;
99
+ set hostname(v: string);
100
+ get pathname(): string;
101
+ set pathname(v: string);
102
+ get port(): string;
103
+ set port(v: string);
104
+ get protocol(): string;
105
+ set protocol(v: string);
106
+ get search(): string;
107
+ set search(v: string);
108
+ assign(url: string): void;
109
+ static ɵfac: i0.ɵɵFactoryDeclaration<LocationService, never>;
110
+ static ɵprov: i0.ɵɵInjectableDeclaration<LocationService>;
111
+ }
112
+
113
+ declare class AngularRequestor extends Requestor {
114
+ private http;
115
+ constructor(http: HttpClient);
116
+ xhr<T>(settings: JQueryAjaxSettings): Promise<T>;
117
+ static ɵfac: i0.ɵɵFactoryDeclaration<AngularRequestor, never>;
118
+ static ɵprov: i0.ɵɵInjectableDeclaration<AngularRequestor>;
119
+ }
120
+
121
+ interface NucleusAuthorizationServiceConfigurationJson extends AuthorizationServiceConfigurationJson {
122
+ device_authorization_endpoint?: string;
123
+ registration_endpoint?: string;
124
+ }
125
+ declare class NucleusAuthorizationServiceConfiguration extends AuthorizationServiceConfiguration {
126
+ constructor(request: NucleusAuthorizationServiceConfigurationJson);
127
+ deviceAuthorizationEndpoint?: string;
128
+ registrationEndpoint?: string;
129
+ static fetchFromIssuer(openIdIssuerUrl: string, requestor?: Requestor): Promise<NucleusAuthorizationServiceConfiguration>;
130
+ toJson(): any;
131
+ }
132
+
133
+ declare class OidcConfigurationService {
134
+ private requestor;
135
+ private config;
136
+ private appService;
137
+ constructor(requestor: AngularRequestor, config: NucleusIdentityConfig, appService: NucleusAppService);
138
+ private _configuration;
139
+ getConfiguration(): Promise<NucleusAuthorizationServiceConfiguration>;
140
+ get clientId(): string;
141
+ get requestedScopes(): string | undefined;
142
+ get servicePrincipalRequestedScopes(): string | undefined;
143
+ get authProviderHint(): string | undefined;
144
+ get redirectUrl(): string;
145
+ getServerUrl(relativeUri?: string | null): string;
146
+ private NormalizeRedirectUri;
147
+ private assureConfiguration;
148
+ static ɵfac: i0.ɵɵFactoryDeclaration<OidcConfigurationService, never>;
149
+ static ɵprov: i0.ɵɵInjectableDeclaration<OidcConfigurationService>;
150
+ }
151
+
152
+ interface ClientRegistrationResponseJson {
153
+ client_id: string;
154
+ client_secret: string;
155
+ client_secret_expires_at: number;
156
+ }
157
+ declare class ClientRegistrationResponse {
158
+ constructor(response: ClientRegistrationResponseJson);
159
+ clientId: string;
160
+ clientSecret: string;
161
+ secretExpirationDate: Date;
162
+ }
163
+
164
+ declare class TokenClient {
165
+ private requestor;
166
+ private config;
167
+ constructor(requestor: AngularRequestor, config: OidcConfigurationService);
168
+ private _tokenHandler;
169
+ private _utils;
170
+ getByAuthorizationCode(redirectUrl: string, code: string, codeVerifier?: string): Promise<_openid_appauth.TokenResponse>;
171
+ getByRefreshToken(refreshToken: string): Promise<_openid_appauth.TokenResponse>;
172
+ getByClientCredentials(clientId: string, clientSecret: string, scope: string): Promise<_openid_appauth.TokenResponse>;
173
+ getBySecret(provider: string, secret: string, assertionToken: string, scope: string): Promise<_openid_appauth.TokenResponse>;
174
+ getByDeviceCode(deviceCode: string): Promise<_openid_appauth.TokenResponse>;
175
+ registerServicePrincipal(token: string): Promise<ClientRegistrationResponse>;
176
+ getRegistrationCode(existingServicePrincipalId?: string | null): Promise<DeviceCode>;
177
+ getDeviceCode(scope: string): Promise<DeviceCode>;
178
+ private getDeviceCodeInternal;
179
+ static ɵfac: i0.ɵɵFactoryDeclaration<TokenClient, never>;
180
+ static ɵprov: i0.ɵɵInjectableDeclaration<TokenClient>;
181
+ }
182
+
183
+ declare class NucleusIdentityService {
184
+ private appService;
185
+ private http;
186
+ private config;
187
+ private tokenClient;
188
+ constructor(appService: NucleusAppService, location: LocationService, http: HttpClient, config: OidcConfigurationService, tokenClient: TokenClient);
189
+ private _authorizationHandler;
190
+ private _authorizationNotifier;
191
+ private _crypto;
192
+ private _initStarted;
193
+ private _initialized;
194
+ private _refreshTokenPromise;
195
+ private _getTokenPromise;
196
+ private _getServicePrincipalTokenPromise;
197
+ private _servicePrincipalTokenId;
198
+ private _store;
199
+ get identity(): Identity | null;
200
+ get isAuthenticated(): boolean;
201
+ get servicePrincipalIdentity(): Identity | null;
202
+ get isServicePrincipalAuthenticated(): boolean;
203
+ get isIdentityServicePrincipal(): boolean;
204
+ init(startLogin?: boolean): Promise<void>;
205
+ loginWithSecret(provider: string, secret: string): Promise<void>;
206
+ login(): Promise<void>;
207
+ logout(): Promise<void>;
208
+ getAccessToken(): Promise<string | null>;
209
+ getServicePrincipalAccessToken(): Promise<string>;
210
+ loginServicePrincipal(): Promise<TokenResponse>;
211
+ loginAsServicePrincipal(): Promise<void>;
212
+ getOtp(type: OtpType, expiresIn?: number): Promise<OtpResponse>;
213
+ getOtpStatus(id: string): Promise<OtpStatus>;
214
+ getOtpUrl(redirectUrl: string, password: string): string;
215
+ startServicePrincipalRegistration(): Promise<DeviceCode>;
216
+ completeServicePrincipalRegistration(deviceCode: DeviceCode): Promise<void>;
217
+ removeServicePrincipalRegistration(): Promise<{
218
+ value: boolean;
219
+ }>;
220
+ getServicePrincipalRegistrationStatus(): Promise<ServicePrincipalRegistrationStatus>;
221
+ startDeviceCodeLogin(): Promise<DeviceCode>;
222
+ completeDeviceCodeLogin(deviceCode: DeviceCode): Promise<void>;
223
+ private waitForDeviceToken;
224
+ private prepareAuthorizationRequest;
225
+ private getServicePrincipalAccessTokenInternal;
226
+ private getAccessTokenInternal;
227
+ private loginWithRefreshToken;
228
+ private loginWithRefreshTokenInternal;
229
+ private getCodeHash;
230
+ private handleLaunchCodeHash;
231
+ private prepareScope;
232
+ private delay;
233
+ static ɵfac: i0.ɵɵFactoryDeclaration<NucleusIdentityService, never>;
234
+ static ɵprov: i0.ɵɵInjectableDeclaration<NucleusIdentityService>;
235
+ }
236
+
237
+ export { DeviceCode, NucleusIdentityConfig, NucleusIdentityModule, NucleusIdentityService, OtpResponse, OtpStatus, OtpType, ServicePrincipalRegistrationStatus };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@kolektor/nucleus-identity",
3
3
  "peerDependencies": {
4
- "@angular/common": "^17.3.0",
5
- "@angular/core": "^17.3.0",
4
+ "@angular/common": "^20.3.0",
5
+ "@angular/core": "^20.3.0",
6
6
  "@capacitor/app": "^7.0.0",
7
7
  "@capacitor/browser": "^7.0.0",
8
8
  "@capacitor/device": "^7.0.0",
@@ -21,13 +21,11 @@
21
21
  },
22
22
  ".": {
23
23
  "types": "./index.d.ts",
24
- "esm2022": "./esm2022/kolektor-nucleus-identity.mjs",
25
- "esm": "./esm2022/kolektor-nucleus-identity.mjs",
26
24
  "default": "./fesm2022/kolektor-nucleus-identity.mjs"
27
25
  }
28
26
  },
29
27
  "dependencies": {
30
28
  "tslib": "^2.3.0"
31
29
  },
32
- "version": "0.1.1911"
30
+ "version": "0.1.2192"
33
31
  }