@igo2/auth 20.1.0-next.9 → 20.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/igo2-auth-facebook.mjs +3 -3
- package/fesm2022/igo2-auth-form.mjs +16 -17
- package/fesm2022/igo2-auth-form.mjs.map +1 -1
- package/fesm2022/igo2-auth-google.mjs +3 -3
- package/fesm2022/igo2-auth-internal.mjs +3 -3
- package/fesm2022/igo2-auth-microsoft.mjs +124 -85
- package/fesm2022/igo2-auth-microsoft.mjs.map +1 -1
- package/fesm2022/igo2-auth-monitoring.mjs +3 -3
- package/fesm2022/igo2-auth.mjs +251 -148
- package/fesm2022/igo2-auth.mjs.map +1 -1
- package/form/index.d.ts +1 -1
- package/index.d.ts +155 -84
- package/internal/index.d.ts +1 -1
- package/locale/en.auth.json +4 -3
- package/locale/fr.auth.json +4 -3
- package/microsoft/index.d.ts +39 -24
- package/package.json +4 -4
|
@@ -49,10 +49,10 @@ class AuthFacebookComponent {
|
|
|
49
49
|
};
|
|
50
50
|
fjs.parentNode.insertBefore(js, fjs);
|
|
51
51
|
}
|
|
52
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
53
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.
|
|
52
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthFacebookComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
53
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: AuthFacebookComponent, isStandalone: true, selector: "igo-auth-facebook", outputs: { login: "login" }, ngImport: i0, template: "<div\n class=\"fb-login-button\"\n data-max-rows=\"1\"\n data-size=\"large\"\n data-button-type=\"login_with\"\n data-show-faces=\"false\"\n data-auto-logout-link=\"false\"\n data-use-continue-as=\"false\"\n></div>\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-3px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
54
54
|
}
|
|
55
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
55
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthFacebookComponent, decorators: [{
|
|
56
56
|
type: Component,
|
|
57
57
|
args: [{ selector: 'igo-auth-facebook', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, template: "<div\n class=\"fb-login-button\"\n data-max-rows=\"1\"\n data-size=\"large\"\n data-button-type=\"login_with\"\n data-show-faces=\"false\"\n data-auto-logout-link=\"false\"\n data-use-continue-as=\"false\"\n></div>\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-3px}\n"] }]
|
|
58
58
|
}], ctorParameters: () => [], propDecorators: { login: [{ type: i0.Output, args: ["login"] }] } });
|
|
@@ -92,17 +92,16 @@ class AuthFormComponent {
|
|
|
92
92
|
this.login.emit(true);
|
|
93
93
|
}
|
|
94
94
|
logout() {
|
|
95
|
-
this.auth.logout()
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
else if (this.options?.homeRoute) {
|
|
102
|
-
this.router.navigate([this.options?.homeRoute]);
|
|
103
|
-
}
|
|
95
|
+
this.auth.logout();
|
|
96
|
+
this.user = undefined;
|
|
97
|
+
if (this.router) {
|
|
98
|
+
if (this.options?.logoutRoute) {
|
|
99
|
+
this.router.navigate([this.options?.logoutRoute]);
|
|
104
100
|
}
|
|
105
|
-
|
|
101
|
+
else if (this.options?.homeRoute) {
|
|
102
|
+
this.router.navigate([this.options?.homeRoute]);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
106
105
|
}
|
|
107
106
|
home() {
|
|
108
107
|
if (this.router && this.options?.homeRoute) {
|
|
@@ -134,10 +133,10 @@ class AuthFormComponent {
|
|
|
134
133
|
}
|
|
135
134
|
});
|
|
136
135
|
}
|
|
137
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
138
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.
|
|
136
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
137
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.19", type: AuthFormComponent, isStandalone: true, selector: "igo-auth-form", inputs: { backgroundDisable: "backgroundDisable", hasAlreadyConnectedDiv: "hasAlreadyConnectedDiv", hasLogoutDiv: "hasLogoutDiv", showAlreadyConnectedDiv: "showAlreadyConnectedDiv", showLogoutDiv: "showLogoutDiv" }, outputs: { login: "login" }, ngImport: i0, template: "@if (visible) {\n <div>\n @if (!auth.logged && backgroundDisable) {\n <div class=\"backgroundDisable\"></div>\n }\n @if (!auth.logged && showLoginDiv) {\n <div class=\"login center-block\">\n <h3>{{ 'igo.auth.connection' | translate }}</h3>\n @if (options.google && options.google.enabled !== false) {\n <igo-auth-google (login)=\"onLogin()\" />\n }\n @if (options.microsoft && options.microsoft.enabled !== false) {\n <igo-auth-microsoft (login)=\"onLogin()\" />\n }\n @if (options.microsoftb2c && options.microsoftb2c.enabled !== false) {\n <igo-auth-microsoftb2c (login)=\"onLogin()\" />\n }\n @if (options.facebook && options.facebook.enabled !== false) {\n <igo-auth-facebook (login)=\"onLogin()\" />\n }\n @if (!options.intern || options.intern.enabled !== false) {\n <igo-auth-intern\n [allowAnonymous]=\"options.allowAnonymous\"\n (login)=\"onLogin()\"\n />\n }\n </div>\n }\n @if (auth.logged && showAlreadyConnectedDiv) {\n <div class=\"login center-block\">\n <p>{{ 'igo.auth.welcome' | translate: user }}</p>\n <button matButton=\"elevated\" type=\"button\" (click)=\"logout()\">\n {{ 'igo.auth.signOut' | translate }}\n </button>\n </div>\n }\n @if (showLogoutDiv) {\n <div class=\"login center-block\">\n <p>{{ 'igo.auth.deconnection' | translate }}</p>\n @if (options.homeRoute) {\n <button matButton=\"elevated\" type=\"button\" (click)=\"home()\">\n {{ 'igo.auth.home' | translate }}\n </button>\n }\n </div>\n }\n </div>\n}\n", styles: [":host{z-index:999}div.login{z-index:200;width:90%;min-width:360px;max-width:600px;padding:24px 48px;border:1px solid;background-color:#fff;border-color:#888}div.login h3{margin-top:0}.center-block{position:fixed;top:20%;left:50%;transform:translate(-50%)}.backgroundDisable{position:fixed;top:0;left:0;background:#000;opacity:.8;z-index:100;height:100%;width:100%}\n"], dependencies: [{ kind: "component", type: AuthGoogleComponent, selector: "igo-auth-google", outputs: ["login"] }, { kind: "component", type: AuthMicrosoftComponent, selector: "igo-auth-microsoft", outputs: ["login"] }, { kind: "component", type: AuthMicrosoftb2cComponent, selector: "igo-auth-microsoftb2c", outputs: ["login"] }, { kind: "component", type: AuthFacebookComponent, selector: "igo-auth-facebook", outputs: ["login"] }, { kind: "component", type: AuthInternComponent, selector: "igo-auth-intern", inputs: ["allowAnonymous"], outputs: ["login"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: IgoLanguageModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Default });
|
|
139
138
|
}
|
|
140
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
139
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthFormComponent, decorators: [{
|
|
141
140
|
type: Component,
|
|
142
141
|
args: [{ selector: 'igo-auth-form', changeDetection: ChangeDetectionStrategy.Default, imports: [
|
|
143
142
|
AuthGoogleComponent,
|
|
@@ -161,8 +160,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
161
160
|
}], login: [{ type: i0.Output, args: ["login"] }] } });
|
|
162
161
|
|
|
163
162
|
class IgoAuthFormModule {
|
|
164
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
165
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.
|
|
163
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: IgoAuthFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
164
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.19", ngImport: i0, type: IgoAuthFormModule, imports: [CommonModule,
|
|
166
165
|
ReactiveFormsModule,
|
|
167
166
|
MatFormFieldModule,
|
|
168
167
|
MatInputModule,
|
|
@@ -177,7 +176,7 @@ class IgoAuthFormModule {
|
|
|
177
176
|
AuthFacebookComponent,
|
|
178
177
|
AuthMicrosoftComponent,
|
|
179
178
|
AuthMicrosoftb2cComponent], exports: [AuthFormComponent] });
|
|
180
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.
|
|
179
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: IgoAuthFormModule, imports: [CommonModule,
|
|
181
180
|
ReactiveFormsModule,
|
|
182
181
|
MatFormFieldModule,
|
|
183
182
|
MatInputModule,
|
|
@@ -193,7 +192,7 @@ class IgoAuthFormModule {
|
|
|
193
192
|
AuthMicrosoftComponent,
|
|
194
193
|
AuthMicrosoftb2cComponent] });
|
|
195
194
|
}
|
|
196
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
195
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: IgoAuthFormModule, decorators: [{
|
|
197
196
|
type: NgModule,
|
|
198
197
|
args: [{
|
|
199
198
|
imports: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"igo2-auth-form.mjs","sources":["../../../packages/auth/form/src/auth-form/auth-form.component.ts","../../../packages/auth/form/src/auth-form/auth-form.component.html","../../../packages/auth/form/src/auth-form.module.ts","../../../packages/auth/form/src/public_api.ts","../../../packages/auth/form/src/igo2-auth-form.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n Input,\n OnInit,\n inject,\n output\n} from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { NavigationStart, Router } from '@angular/router';\n\nimport { AuthOptions, AuthService } from '@igo2/auth';\nimport { AuthFacebookComponent } from '@igo2/auth/facebook';\nimport { AuthGoogleComponent } from '@igo2/auth/google';\nimport { AuthInternComponent } from '@igo2/auth/internal';\nimport {\n AuthMicrosoftComponent,\n AuthMicrosoftb2cComponent\n} from '@igo2/auth/microsoft';\nimport { ConfigService } from '@igo2/core/config';\nimport { IgoLanguageModule } from '@igo2/core/language';\n\nimport { filter } from 'rxjs/operators';\n\nimport { AuthFormOptions } from '../shared';\n\n@Component({\n selector: 'igo-auth-form',\n templateUrl: './auth-form.component.html',\n styleUrls: ['./auth-form.component.scss'],\n changeDetection: ChangeDetectionStrategy.Default,\n imports: [\n AuthGoogleComponent,\n AuthMicrosoftComponent,\n AuthMicrosoftb2cComponent,\n AuthFacebookComponent,\n AuthInternComponent,\n MatButtonModule,\n IgoLanguageModule\n ]\n})\nexport class AuthFormComponent implements OnInit {\n auth = inject(AuthService);\n private config = inject(ConfigService);\n private router = inject(Router, { optional: true });\n\n @Input()\n get backgroundDisable(): boolean {\n if (this.isLogoutRoute || this.isLogoutRoute) {\n return false;\n }\n return this._backgroundDisable;\n }\n set backgroundDisable(value: boolean) {\n this._backgroundDisable = value.toString() === 'true';\n }\n private _backgroundDisable = true;\n\n @Input()\n get hasAlreadyConnectedDiv(): boolean {\n return this._hasAlreadyConnectedDiv;\n }\n set hasAlreadyConnectedDiv(value: boolean) {\n this._hasAlreadyConnectedDiv = value.toString() === 'true';\n }\n private _hasAlreadyConnectedDiv = true;\n\n @Input()\n get hasLogoutDiv(): boolean {\n return this._hasLogoutDiv;\n }\n set hasLogoutDiv(value: boolean) {\n this._hasLogoutDiv = value.toString() === 'true';\n }\n private _hasLogoutDiv = true;\n\n @Input()\n get showAlreadyConnectedDiv(): boolean {\n if (this.isLogoutRoute) {\n return this.hasAlreadyConnectedDiv;\n }\n return this._showAlreadyConnectedDiv;\n }\n set showAlreadyConnectedDiv(value: boolean) {\n this._showAlreadyConnectedDiv = value.toString() === 'true';\n }\n private _showAlreadyConnectedDiv = false;\n\n @Input()\n get showLogoutDiv(): boolean {\n if (this.isLogoutRoute) {\n return this.hasLogoutDiv;\n }\n return this._showLogoutDiv;\n }\n set showLogoutDiv(value: boolean) {\n this._showLogoutDiv = value.toString() === 'true';\n }\n private _showLogoutDiv = false;\n\n get showLoginDiv(): boolean {\n if (!this.isLogoutRoute) {\n return true;\n }\n }\n\n readonly login = output<boolean>();\n\n public options?: AuthOptions & AuthFormOptions;\n public user;\n\n public visible = true;\n\n private isLogoutRoute: boolean;\n\n constructor() {\n this.options = this.config.getConfig('auth');\n this.visible = Object.getOwnPropertyNames(this.options).length !== 0;\n }\n\n public ngOnInit() {\n this.analyzeRoute();\n this.getName();\n }\n\n public onLogin() {\n this.auth.goToRedirectUrl();\n this.getName();\n this.login.emit(true);\n }\n\n public logout() {\n this.auth.logout().subscribe(() => {\n this.user = undefined;\n if (this.router) {\n if (this.options?.logoutRoute) {\n this.router.navigate([this.options?.logoutRoute]);\n } else if (this.options?.homeRoute) {\n this.router.navigate([this.options?.homeRoute]);\n }\n }\n });\n }\n\n public home() {\n if (this.router && this.options?.homeRoute) {\n this.router.navigate([this.options?.homeRoute]);\n }\n }\n\n private getName() {\n const tokenDecoded = this.auth.decodeToken();\n if (tokenDecoded) {\n this.user = {\n name: tokenDecoded.user.firstName || tokenDecoded.user.sourceId\n };\n }\n }\n\n private analyzeRoute() {\n if (!this.router) {\n return;\n }\n\n this.router.events\n .pipe(filter((event) => event instanceof NavigationStart))\n .subscribe((changeEvent: any) => {\n if (changeEvent.url) {\n const currentRoute = changeEvent.url;\n const logoutRoute = this.options?.logoutRoute;\n\n this.isLogoutRoute = currentRoute === logoutRoute;\n\n if (this.isLogoutRoute) {\n this.auth.logout();\n }\n }\n });\n }\n}\n","@if (visible) {\n <div>\n @if (!auth.logged && backgroundDisable) {\n <div class=\"backgroundDisable\"></div>\n }\n @if (!auth.logged && showLoginDiv) {\n <div class=\"login center-block\">\n <h3>{{ 'igo.auth.connection' | translate }}</h3>\n @if (options.google && options.google.enabled !== false) {\n <igo-auth-google (login)=\"onLogin()\" />\n }\n @if (options.microsoft && options.microsoft.enabled !== false) {\n <igo-auth-microsoft (login)=\"onLogin()\" />\n }\n @if (options.microsoftb2c && options.microsoftb2c.enabled !== false) {\n <igo-auth-microsoftb2c (login)=\"onLogin()\" />\n }\n @if (options.facebook && options.facebook.enabled !== false) {\n <igo-auth-facebook (login)=\"onLogin()\" />\n }\n @if (!options.intern || options.intern.enabled !== false) {\n <igo-auth-intern\n [allowAnonymous]=\"options.allowAnonymous\"\n (login)=\"onLogin()\"\n />\n }\n </div>\n }\n @if (auth.logged && showAlreadyConnectedDiv) {\n <div class=\"login center-block\">\n <p>{{ 'igo.auth.welcome' | translate: user }}</p>\n <button matButton=\"elevated\" type=\"button\" (click)=\"logout()\">\n {{ 'igo.auth.signOut' | translate }}\n </button>\n </div>\n }\n @if (showLogoutDiv) {\n <div class=\"login center-block\">\n <p>{{ 'igo.auth.deconnection' | translate }}</p>\n @if (options.homeRoute) {\n <button matButton=\"elevated\" type=\"button\" (click)=\"home()\">\n {{ 'igo.auth.home' | translate }}\n </button>\n }\n </div>\n }\n </div>\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\n\nimport { AuthFacebookComponent } from '@igo2/auth/facebook';\nimport { AuthGoogleComponent } from '@igo2/auth/google';\nimport { AuthInternComponent } from '@igo2/auth/internal';\nimport {\n AuthMicrosoftComponent,\n AuthMicrosoftb2cComponent\n} from '@igo2/auth/microsoft';\nimport { IgoLanguageModule } from '@igo2/core/language';\n\nimport { MsalModule } from '@azure/msal-angular';\n\nimport { AuthFormComponent } from './auth-form/auth-form.component';\n\n@NgModule({\n imports: [\n CommonModule,\n ReactiveFormsModule,\n MatFormFieldModule,\n MatInputModule,\n MatIconModule,\n MatProgressSpinnerModule,\n MatButtonModule,\n IgoLanguageModule,\n MsalModule,\n AuthFormComponent,\n AuthGoogleComponent,\n AuthInternComponent,\n AuthFacebookComponent,\n AuthMicrosoftComponent,\n AuthMicrosoftb2cComponent\n ],\n exports: [AuthFormComponent]\n})\nexport class IgoAuthFormModule {}\n","/*\n * Public API Surface of auth\n */\n\nexport * from './shared/auth-form.interface';\nexport * from './auth-form.module';\n\nexport * from './auth-form/auth-form.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;MAyCa,iBAAiB,CAAA;AAC5B,IAAA,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC;AAClB,IAAA,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC;IAC9B,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAEnD,IAAA,IACI,iBAAiB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;kBApB7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,mBAAmB;wBACnB,kBAAkB;wBAClB,cAAc;wBACd,aAAa;wBACb,wBAAwB;wBACxB,eAAe;wBACf,iBAAiB;wBACjB,UAAU;wBACV,iBAAiB;wBACjB,mBAAmB;wBACnB,mBAAmB;wBACnB,qBAAqB;wBACrB,sBAAsB;wBACtB;AACD,qBAAA;oBACD,OAAO,EAAE,CAAC,iBAAiB;AAC5B,iBAAA;;;ACzCD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"igo2-auth-form.mjs","sources":["../../../packages/auth/form/src/auth-form/auth-form.component.ts","../../../packages/auth/form/src/auth-form/auth-form.component.html","../../../packages/auth/form/src/auth-form.module.ts","../../../packages/auth/form/src/public_api.ts","../../../packages/auth/form/src/igo2-auth-form.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n Input,\n OnInit,\n inject,\n output\n} from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { NavigationStart, Router } from '@angular/router';\n\nimport { AuthOptions, AuthService } from '@igo2/auth';\nimport { AuthFacebookComponent } from '@igo2/auth/facebook';\nimport { AuthGoogleComponent } from '@igo2/auth/google';\nimport { AuthInternComponent } from '@igo2/auth/internal';\nimport {\n AuthMicrosoftComponent,\n AuthMicrosoftb2cComponent\n} from '@igo2/auth/microsoft';\nimport { ConfigService } from '@igo2/core/config';\nimport { IgoLanguageModule } from '@igo2/core/language';\n\nimport { filter } from 'rxjs/operators';\n\nimport { AuthFormOptions } from '../shared';\n\n@Component({\n selector: 'igo-auth-form',\n templateUrl: './auth-form.component.html',\n styleUrls: ['./auth-form.component.scss'],\n changeDetection: ChangeDetectionStrategy.Default,\n imports: [\n AuthGoogleComponent,\n AuthMicrosoftComponent,\n AuthMicrosoftb2cComponent,\n AuthFacebookComponent,\n AuthInternComponent,\n MatButtonModule,\n IgoLanguageModule\n ]\n})\nexport class AuthFormComponent implements OnInit {\n auth = inject(AuthService);\n private config = inject(ConfigService);\n private router = inject(Router, { optional: true });\n\n @Input()\n get backgroundDisable(): boolean {\n if (this.isLogoutRoute || this.isLogoutRoute) {\n return false;\n }\n return this._backgroundDisable;\n }\n set backgroundDisable(value: boolean) {\n this._backgroundDisable = value.toString() === 'true';\n }\n private _backgroundDisable = true;\n\n @Input()\n get hasAlreadyConnectedDiv(): boolean {\n return this._hasAlreadyConnectedDiv;\n }\n set hasAlreadyConnectedDiv(value: boolean) {\n this._hasAlreadyConnectedDiv = value.toString() === 'true';\n }\n private _hasAlreadyConnectedDiv = true;\n\n @Input()\n get hasLogoutDiv(): boolean {\n return this._hasLogoutDiv;\n }\n set hasLogoutDiv(value: boolean) {\n this._hasLogoutDiv = value.toString() === 'true';\n }\n private _hasLogoutDiv = true;\n\n @Input()\n get showAlreadyConnectedDiv(): boolean {\n if (this.isLogoutRoute) {\n return this.hasAlreadyConnectedDiv;\n }\n return this._showAlreadyConnectedDiv;\n }\n set showAlreadyConnectedDiv(value: boolean) {\n this._showAlreadyConnectedDiv = value.toString() === 'true';\n }\n private _showAlreadyConnectedDiv = false;\n\n @Input()\n get showLogoutDiv(): boolean {\n if (this.isLogoutRoute) {\n return this.hasLogoutDiv;\n }\n return this._showLogoutDiv;\n }\n set showLogoutDiv(value: boolean) {\n this._showLogoutDiv = value.toString() === 'true';\n }\n private _showLogoutDiv = false;\n\n get showLoginDiv(): boolean {\n if (!this.isLogoutRoute) {\n return true;\n }\n }\n\n readonly login = output<boolean>();\n\n public options?: AuthOptions & AuthFormOptions;\n public user;\n\n public visible = true;\n\n private isLogoutRoute: boolean;\n\n constructor() {\n this.options = this.config.getConfig('auth');\n this.visible = Object.getOwnPropertyNames(this.options).length !== 0;\n }\n\n public ngOnInit() {\n this.analyzeRoute();\n this.getName();\n }\n\n public onLogin() {\n this.auth.goToRedirectUrl();\n this.getName();\n this.login.emit(true);\n }\n\n public logout() {\n this.auth.logout();\n this.user = undefined;\n if (this.router) {\n if (this.options?.logoutRoute) {\n this.router.navigate([this.options?.logoutRoute]);\n } else if (this.options?.homeRoute) {\n this.router.navigate([this.options?.homeRoute]);\n }\n }\n }\n\n public home() {\n if (this.router && this.options?.homeRoute) {\n this.router.navigate([this.options?.homeRoute]);\n }\n }\n\n private getName() {\n const tokenDecoded = this.auth.decodeToken();\n if (tokenDecoded) {\n this.user = {\n name: tokenDecoded.user.firstName || tokenDecoded.user.sourceId\n };\n }\n }\n\n private analyzeRoute() {\n if (!this.router) {\n return;\n }\n\n this.router.events\n .pipe(filter((event) => event instanceof NavigationStart))\n .subscribe((changeEvent: any) => {\n if (changeEvent.url) {\n const currentRoute = changeEvent.url;\n const logoutRoute = this.options?.logoutRoute;\n\n this.isLogoutRoute = currentRoute === logoutRoute;\n\n if (this.isLogoutRoute) {\n this.auth.logout();\n }\n }\n });\n }\n}\n","@if (visible) {\n <div>\n @if (!auth.logged && backgroundDisable) {\n <div class=\"backgroundDisable\"></div>\n }\n @if (!auth.logged && showLoginDiv) {\n <div class=\"login center-block\">\n <h3>{{ 'igo.auth.connection' | translate }}</h3>\n @if (options.google && options.google.enabled !== false) {\n <igo-auth-google (login)=\"onLogin()\" />\n }\n @if (options.microsoft && options.microsoft.enabled !== false) {\n <igo-auth-microsoft (login)=\"onLogin()\" />\n }\n @if (options.microsoftb2c && options.microsoftb2c.enabled !== false) {\n <igo-auth-microsoftb2c (login)=\"onLogin()\" />\n }\n @if (options.facebook && options.facebook.enabled !== false) {\n <igo-auth-facebook (login)=\"onLogin()\" />\n }\n @if (!options.intern || options.intern.enabled !== false) {\n <igo-auth-intern\n [allowAnonymous]=\"options.allowAnonymous\"\n (login)=\"onLogin()\"\n />\n }\n </div>\n }\n @if (auth.logged && showAlreadyConnectedDiv) {\n <div class=\"login center-block\">\n <p>{{ 'igo.auth.welcome' | translate: user }}</p>\n <button matButton=\"elevated\" type=\"button\" (click)=\"logout()\">\n {{ 'igo.auth.signOut' | translate }}\n </button>\n </div>\n }\n @if (showLogoutDiv) {\n <div class=\"login center-block\">\n <p>{{ 'igo.auth.deconnection' | translate }}</p>\n @if (options.homeRoute) {\n <button matButton=\"elevated\" type=\"button\" (click)=\"home()\">\n {{ 'igo.auth.home' | translate }}\n </button>\n }\n </div>\n }\n </div>\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\n\nimport { AuthFacebookComponent } from '@igo2/auth/facebook';\nimport { AuthGoogleComponent } from '@igo2/auth/google';\nimport { AuthInternComponent } from '@igo2/auth/internal';\nimport {\n AuthMicrosoftComponent,\n AuthMicrosoftb2cComponent\n} from '@igo2/auth/microsoft';\nimport { IgoLanguageModule } from '@igo2/core/language';\n\nimport { MsalModule } from '@azure/msal-angular';\n\nimport { AuthFormComponent } from './auth-form/auth-form.component';\n\n@NgModule({\n imports: [\n CommonModule,\n ReactiveFormsModule,\n MatFormFieldModule,\n MatInputModule,\n MatIconModule,\n MatProgressSpinnerModule,\n MatButtonModule,\n IgoLanguageModule,\n MsalModule,\n AuthFormComponent,\n AuthGoogleComponent,\n AuthInternComponent,\n AuthFacebookComponent,\n AuthMicrosoftComponent,\n AuthMicrosoftb2cComponent\n ],\n exports: [AuthFormComponent]\n})\nexport class IgoAuthFormModule {}\n","/*\n * Public API Surface of auth\n */\n\nexport * from './shared/auth-form.interface';\nexport * from './auth-form.module';\n\nexport * from './auth-form/auth-form.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;MAyCa,iBAAiB,CAAA;AAC5B,IAAA,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC;AAClB,I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ACnB,qBAAqB;YACrB,sBAAsB;YACtB,yBAAyB,CAAA,EAAA,CAAA;;4FAIhB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBApB7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,mBAAmB;wBACnB,kBAAkB;wBAClB,cAAc;wBACd,aAAa;wBACb,wBAAwB;wBACxB,eAAe;wBACf,iBAAiB;wBACjB,UAAU;wBACV,iBAAiB;wBACjB,mBAAmB;wBACnB,mBAAmB;wBACnB,qBAAqB;wBACrB,sBAAsB;wBACtB;AACD,qBAAA;oBACD,OAAO,EAAE,CAAC,iBAAiB;AAC5B,iBAAA;;;ACzCD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -90,10 +90,10 @@ class AuthGoogleComponent {
|
|
|
90
90
|
js.src = 'https://apis.google.com/js/platform.js';
|
|
91
91
|
fjs.parentNode.insertBefore(js, fjs);
|
|
92
92
|
}
|
|
93
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
94
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.
|
|
93
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthGoogleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
94
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: AuthGoogleComponent, isStandalone: true, selector: "igo-auth-google", outputs: { login: "login" }, ngImport: i0, template: "<div\n class=\"g-signin2 google-login-button\"\n data-height=\"40\"\n data-width=\"265\"\n data-longtitle=\"true\"\n></div>\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block}.google-login-button ::ng-deep .abcRioButton{color:#000000de}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
95
95
|
}
|
|
96
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
96
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthGoogleComponent, decorators: [{
|
|
97
97
|
type: Component,
|
|
98
98
|
args: [{ selector: 'igo-auth-google', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, template: "<div\n class=\"g-signin2 google-login-button\"\n data-height=\"40\"\n data-width=\"265\"\n data-longtitle=\"true\"\n></div>\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block}.google-login-button ::ng-deep .abcRioButton{color:#000000de}\n"] }]
|
|
99
99
|
}], ctorParameters: () => [], propDecorators: { login: [{ type: i0.Output, args: ["login"] }] } });
|
|
@@ -57,10 +57,10 @@ class AuthInternComponent {
|
|
|
57
57
|
this.login.emit(true);
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
61
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.
|
|
60
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthInternComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
61
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.19", type: AuthInternComponent, isStandalone: true, selector: "igo-auth-intern", inputs: { allowAnonymous: "allowAnonymous" }, outputs: { login: "login" }, ngImport: i0, template: "<form [formGroup]=\"form\" role=\"form\" (ngSubmit)=\"loginUser(form.value)\">\n <div>\n <mat-form-field class=\"full-width\">\n <mat-label>{{ 'igo.auth.user' | translate }}</mat-label>\n <input\n matInput\n required\n placeholder=\"{{ 'igo.auth.user' | translate }}\"\n formControlName=\"username\"\n />\n </mat-form-field>\n </div>\n\n <div>\n <mat-form-field class=\"full-width\">\n <mat-label>{{ 'igo.auth.password' | translate }}</mat-label>\n <input\n matInput\n required\n type=\"password\"\n placeholder=\"{{ 'igo.auth.password' | translate }}\"\n formControlName=\"password\"\n />\n </mat-form-field>\n </div>\n\n <button matButton=\"elevated\" type=\"submit\">\n {{ 'igo.auth.login' | translate }}\n </button>\n @if (allowAnonymous) {\n <button\n matButton=\"elevated\"\n class=\"anonymous\"\n type=\"button\"\n (click)=\"loginAnonymous()\"\n >\n {{ 'igo.auth.accessAnonymous' | translate }}\n </button>\n }\n @if (error) {\n <div>\n <br />\n <font size=\"3\" color=\"red\">{{ error }}</font>\n </div>\n }\n</form>\n\n@if (loading) {\n <div class=\"loading-container\">\n <mat-spinner [diameter]=\"40\" />\n </div>\n}\n", styles: [".full-width{width:100%}.anonymous{margin-left:10px}.loading-container{position:absolute;width:100%;height:100%;display:flex;justify-content:center;align-items:center;z-index:1000;top:0;left:0;padding:24px;box-sizing:border-box}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: IgoLanguageModule }, { kind: "pipe", type: i5.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Default });
|
|
62
62
|
}
|
|
63
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthInternComponent, decorators: [{
|
|
64
64
|
type: Component,
|
|
65
65
|
args: [{ selector: 'igo-auth-intern', changeDetection: ChangeDetectionStrategy.Default, imports: [
|
|
66
66
|
FormsModule,
|
|
@@ -1,91 +1,52 @@
|
|
|
1
1
|
import { AuthService, AuthFeatureKind } from '@igo2/auth';
|
|
2
2
|
import { ConfigService } from '@igo2/core/config';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { MSAL_INSTANCE, MSAL_GUARD_CONFIG, MsalService } from '@azure/msal-angular';
|
|
4
|
+
import { WrapperSKU, InteractionStatus, EventMessageUtils, PublicClientApplication, InteractionRequiredAuthError, LogLevel, BrowserCacheLocation, InteractionType } from '@azure/msal-browser';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
6
|
import { inject, ApplicationRef, output, ChangeDetectionStrategy, Component, Injectable } from '@angular/core';
|
|
7
7
|
import * as i1 from '@angular/material/button';
|
|
8
8
|
import { MatButtonModule } from '@angular/material/button';
|
|
9
|
-
import {
|
|
9
|
+
import { MatError } from '@angular/material/form-field';
|
|
10
|
+
import * as i2 from '@angular/material/icon';
|
|
11
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
10
12
|
import { IgoLanguageModule } from '@igo2/core/language';
|
|
11
|
-
import
|
|
13
|
+
import * as i3 from '@ngx-translate/core';
|
|
14
|
+
import { from, Subject, BehaviorSubject, switchMap, tap, finalize } from 'rxjs';
|
|
12
15
|
import { filter, takeUntil } from 'rxjs/operators';
|
|
13
|
-
import * as i2 from '@ngx-translate/core';
|
|
14
16
|
import { Location } from '@angular/common';
|
|
15
17
|
|
|
16
18
|
class AuthMicrosoftComponent {
|
|
17
|
-
|
|
18
|
-
config = inject(ConfigService);
|
|
19
|
+
auth = inject(AuthService);
|
|
19
20
|
appRef = inject(ApplicationRef);
|
|
20
|
-
msalService = inject(MsalService);
|
|
21
|
-
msalGuardConfig = inject(MSAL_GUARD_CONFIG);
|
|
22
|
-
options;
|
|
23
|
-
_destroying$ = new Subject();
|
|
24
21
|
login = output();
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.msalService.instance = new PublicClientApplication({
|
|
30
|
-
auth: this.options,
|
|
31
|
-
cache: {
|
|
32
|
-
cacheLocation: 'sessionStorage'
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
this.broadcastService = new MsalBroadcastService(this.msalService.instance);
|
|
36
|
-
if (this.options?.clientId) {
|
|
37
|
-
this.broadcastService.inProgress$
|
|
38
|
-
.pipe(filter((status) => status === InteractionStatus.None), takeUntil(this._destroying$))
|
|
39
|
-
.subscribe(() => {
|
|
40
|
-
this.checkAccount();
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
console.warn('Microsoft authentification needs "clientId" option');
|
|
22
|
+
error = '';
|
|
23
|
+
ngOnInit() {
|
|
24
|
+
if (this.auth.autoLogin) {
|
|
25
|
+
this.loginUser();
|
|
45
26
|
}
|
|
46
27
|
}
|
|
47
|
-
|
|
48
|
-
this.
|
|
49
|
-
|
|
50
|
-
.subscribe((response) => {
|
|
51
|
-
this.msalService.instance.setActiveAccount(response.account);
|
|
52
|
-
this.checkAccount();
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
checkAccount() {
|
|
56
|
-
this.msalService.instance
|
|
57
|
-
.acquireTokenSilent(this.getConf().authRequest)
|
|
58
|
-
.then((response) => {
|
|
59
|
-
const tokenAccess = response.accessToken;
|
|
60
|
-
const tokenId = response.idToken;
|
|
61
|
-
this.authService
|
|
62
|
-
.loginWithToken(tokenAccess, 'microsoft', { tokenId })
|
|
63
|
-
.subscribe(() => {
|
|
28
|
+
loginUser() {
|
|
29
|
+
this.auth.login().subscribe({
|
|
30
|
+
next: () => {
|
|
64
31
|
this.appRef.tick();
|
|
65
32
|
this.login.emit(true);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
33
|
+
},
|
|
34
|
+
error: (err) => {
|
|
35
|
+
this.auth
|
|
36
|
+
.translateError('igo.auth.error.microsoft.', err)
|
|
37
|
+
.subscribe((translatedErrorMsg) => {
|
|
38
|
+
this.error = translatedErrorMsg;
|
|
39
|
+
});
|
|
72
40
|
}
|
|
73
|
-
console.log(error);
|
|
74
|
-
})
|
|
75
|
-
.catch(() => {
|
|
76
|
-
console.log('Silent token fails');
|
|
77
41
|
});
|
|
78
42
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AuthMicrosoftComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
83
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: AuthMicrosoftComponent, isStandalone: true, selector: "igo-auth-microsoft", outputs: { login: "login" }, ngImport: i0, template: "<button\n class=\"microsoft-login-button\"\n matButton=\"elevated\"\n (click)=\"loginMicrosoft()\"\n>\n <igo-icon [icon]=\"svgIcon\" />\n {{ 'igo.auth.microsoft.login' | translate }}\n</button>\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}:host>button{height:40px;width:265px}mat-icon{margin-right:10px}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: IgoLanguageModule }, { kind: "component", type: IgoIconComponent, selector: "igo-icon", inputs: ["color", "icon"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
43
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthMicrosoftComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
44
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.19", type: AuthMicrosoftComponent, isStandalone: true, selector: "igo-auth-microsoft", outputs: { login: "login" }, ngImport: i0, template: "<button class=\"microsoft-login-button\" matButton=\"filled\" (click)=\"loginUser()\">\n <mat-icon\n ><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n <title>Microsoft</title>\n <path\n d=\"M2,3H11V12H2V3M11,22H2V13H11V22M21,3V12H12V3H21M21,22H12V13H21V22Z\"\n />\n </svg>\n </mat-icon>\n {{ 'igo.auth.microsoft.login' | translate }}\n</button>\n@if (error) {\n <mat-error>{{ error }}</mat-error>\n}\n", styles: [":host{padding:12px 0 0;display:flex;flex-direction:column;gap:16px}mat-icon{margin-right:8px}.auth-microsoft-btn-content{display:flex;align-items:center}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: IgoLanguageModule }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
84
45
|
}
|
|
85
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthMicrosoftComponent, decorators: [{
|
|
86
47
|
type: Component,
|
|
87
|
-
args: [{ selector: 'igo-auth-microsoft', changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatButtonModule,
|
|
88
|
-
}],
|
|
48
|
+
args: [{ selector: 'igo-auth-microsoft', changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatButtonModule, MatError, MatIconModule, IgoLanguageModule], template: "<button class=\"microsoft-login-button\" matButton=\"filled\" (click)=\"loginUser()\">\n <mat-icon\n ><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n <title>Microsoft</title>\n <path\n d=\"M2,3H11V12H2V3M11,22H2V13H11V22M21,3V12H12V3H21M21,22H12V13H21V22Z\"\n />\n </svg>\n </mat-icon>\n {{ 'igo.auth.microsoft.login' | translate }}\n</button>\n@if (error) {\n <mat-error>{{ error }}</mat-error>\n}\n", styles: [":host{padding:12px 0 0;display:flex;flex-direction:column;gap:16px}mat-icon{margin-right:8px}.auth-microsoft-btn-content{display:flex;align-items:center}\n"] }]
|
|
49
|
+
}], propDecorators: { login: [{ type: i0.Output, args: ["login"] }] } });
|
|
89
50
|
|
|
90
51
|
/*
|
|
91
52
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -153,10 +114,10 @@ class MsalServiceb2c {
|
|
|
153
114
|
this.logger = logger.clone(this.name, this.version);
|
|
154
115
|
this.instance.setLogger(logger);
|
|
155
116
|
}
|
|
156
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
157
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
117
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MsalServiceb2c, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
118
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MsalServiceb2c });
|
|
158
119
|
}
|
|
159
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
120
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MsalServiceb2c, decorators: [{
|
|
160
121
|
type: Injectable
|
|
161
122
|
}], ctorParameters: () => [] });
|
|
162
123
|
|
|
@@ -188,10 +149,10 @@ class MsalBroadcastServiceb2c {
|
|
|
188
149
|
}
|
|
189
150
|
});
|
|
190
151
|
}
|
|
191
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
192
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
152
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MsalBroadcastServiceb2c, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
153
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MsalBroadcastServiceb2c });
|
|
193
154
|
}
|
|
194
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
155
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MsalBroadcastServiceb2c, decorators: [{
|
|
195
156
|
type: Injectable
|
|
196
157
|
}], ctorParameters: () => [] });
|
|
197
158
|
|
|
@@ -205,7 +166,6 @@ class AuthMicrosoftb2cComponent {
|
|
|
205
166
|
_destroying$ = new Subject();
|
|
206
167
|
login = output();
|
|
207
168
|
broadcastService;
|
|
208
|
-
svgIcon = MICROSOFT_ICON;
|
|
209
169
|
constructor() {
|
|
210
170
|
this.options = this.config.getConfig('auth.microsoftb2c') || {};
|
|
211
171
|
this.msalService.instance = new PublicClientApplication({
|
|
@@ -257,14 +217,54 @@ class AuthMicrosoftb2cComponent {
|
|
|
257
217
|
getConf() {
|
|
258
218
|
return this.msalGuardConfig.filter((conf) => conf.type === 'b2c')[0];
|
|
259
219
|
}
|
|
260
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
261
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.
|
|
220
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthMicrosoftb2cComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
221
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: AuthMicrosoftb2cComponent, isStandalone: true, selector: "igo-auth-microsoftb2c", outputs: { login: "login" }, providers: [MsalServiceb2c], ngImport: i0, template: "<button\n class=\"microsoft-login-button\"\n matButton=\"elevated\"\n (click)=\"loginMicrosoftb2c()\"\n>\n <mat-icon>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n <title>microsoft</title>\n <path\n d=\"M2,3H11V12H2V3M11,22H2V13H11V22M21,3V12H12V3H21M21,22H12V13H21V22Z\"\n />\n </svg>\n </mat-icon>\n {{ 'igo.auth.microsoftb2c.login' | translate }}\n</button>\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}mat-icon{margin-right:12px}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: IgoLanguageModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
262
222
|
}
|
|
263
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
223
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthMicrosoftb2cComponent, decorators: [{
|
|
264
224
|
type: Component,
|
|
265
|
-
args: [{ selector: 'igo-auth-microsoftb2c', changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatButtonModule, IgoLanguageModule,
|
|
225
|
+
args: [{ selector: 'igo-auth-microsoftb2c', changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatButtonModule, IgoLanguageModule, MatIconModule], providers: [MsalServiceb2c], template: "<button\n class=\"microsoft-login-button\"\n matButton=\"elevated\"\n (click)=\"loginMicrosoftb2c()\"\n>\n <mat-icon>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n <title>microsoft</title>\n <path\n d=\"M2,3H11V12H2V3M11,22H2V13H11V22M21,3V12H12V3H21M21,22H12V13H21V22Z\"\n />\n </svg>\n </mat-icon>\n {{ 'igo.auth.microsoftb2c.login' | translate }}\n</button>\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}mat-icon{margin-right:12px}\n"] }]
|
|
266
226
|
}], ctorParameters: () => [], propDecorators: { login: [{ type: i0.Output, args: ["login"] }] } });
|
|
267
227
|
|
|
228
|
+
class AuthMsalService extends AuthService {
|
|
229
|
+
msalService = inject(MsalService);
|
|
230
|
+
msalGuardConfig = inject(MSAL_GUARD_CONFIG);
|
|
231
|
+
_isInitialized$;
|
|
232
|
+
autoLogin = false;
|
|
233
|
+
constructor() {
|
|
234
|
+
super();
|
|
235
|
+
this.autoLogin = this.authOptions.microsoft?.autoLogin === true;
|
|
236
|
+
this._isInitialized$ = this.msalService.initialize();
|
|
237
|
+
}
|
|
238
|
+
login() {
|
|
239
|
+
this.isLogging.set(true);
|
|
240
|
+
return this._isInitialized$.pipe(switchMap(() => this.msalService.loginPopup(this.getConf().authRequest)), tap(({ account }) => this.msalService.instance.setActiveAccount(account)), switchMap(({ idToken, accessToken }) => this.loginWithToken(accessToken, 'microsoft', { tokenId: idToken }, this.authOptions.microsoft.applicationId)), finalize(() => this.isLogging.set(false)));
|
|
241
|
+
}
|
|
242
|
+
logout() {
|
|
243
|
+
if (this.msalService?.instance?.getActiveAccount()) {
|
|
244
|
+
const logoutRequest = {
|
|
245
|
+
account: this.msalService.instance.getActiveAccount()
|
|
246
|
+
};
|
|
247
|
+
this._isInitialized$
|
|
248
|
+
.pipe(switchMap(() => this.msalService.logoutPopup(logoutRequest)))
|
|
249
|
+
.subscribe(() => super.logout());
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
super.logout();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
getConf() {
|
|
256
|
+
return this.msalGuardConfig.filter((conf) => conf.type === 'add')[0];
|
|
257
|
+
}
|
|
258
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthMsalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
259
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthMsalService, providedIn: 'root' });
|
|
260
|
+
}
|
|
261
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AuthMsalService, decorators: [{
|
|
262
|
+
type: Injectable,
|
|
263
|
+
args: [{
|
|
264
|
+
providedIn: 'root'
|
|
265
|
+
}]
|
|
266
|
+
}], ctorParameters: () => [] });
|
|
267
|
+
|
|
268
268
|
const AUTH_MICROSOFT_DIRECTIVES = [
|
|
269
269
|
AuthMicrosoftComponent,
|
|
270
270
|
AuthMicrosoftb2cComponent
|
|
@@ -277,14 +277,40 @@ function MSALConfigFactory(config) {
|
|
|
277
277
|
msConf.redirectUri = msConf?.redirectUri || window.location.href;
|
|
278
278
|
msConf.authority =
|
|
279
279
|
msConf?.authority || 'https://login.microsoftonline.com/organizations';
|
|
280
|
-
const
|
|
280
|
+
const msalInstance = new PublicClientApplication({
|
|
281
281
|
auth: msConf,
|
|
282
282
|
cache: {
|
|
283
|
-
cacheLocation:
|
|
283
|
+
cacheLocation: BrowserCacheLocation.LocalStorage
|
|
284
|
+
},
|
|
285
|
+
system: {
|
|
286
|
+
loggerOptions: {
|
|
287
|
+
loggerCallback,
|
|
288
|
+
piiLoggingEnabled: false,
|
|
289
|
+
logLevel: LogLevel.Warning
|
|
290
|
+
}
|
|
284
291
|
}
|
|
285
292
|
});
|
|
286
|
-
return
|
|
293
|
+
return msalInstance;
|
|
287
294
|
}
|
|
295
|
+
const loggerCallback = (level, message, containsPii) => {
|
|
296
|
+
if (containsPii) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
switch (level) {
|
|
300
|
+
case LogLevel.Error:
|
|
301
|
+
console.error(message);
|
|
302
|
+
break;
|
|
303
|
+
case LogLevel.Info:
|
|
304
|
+
console.info(message);
|
|
305
|
+
break;
|
|
306
|
+
case LogLevel.Verbose:
|
|
307
|
+
console.debug(message);
|
|
308
|
+
break;
|
|
309
|
+
case LogLevel.Warning:
|
|
310
|
+
console.warn(message);
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
};
|
|
288
314
|
function MSALConfigFactoryb2c(config) {
|
|
289
315
|
const msConf = config.getConfig('auth.microsoftb2c.browserAuthOptions');
|
|
290
316
|
if (!msConf) {
|
|
@@ -301,12 +327,13 @@ function MSALConfigFactoryb2c(config) {
|
|
|
301
327
|
});
|
|
302
328
|
return myMsalObj;
|
|
303
329
|
}
|
|
304
|
-
function MSALAngularConfigFactory() {
|
|
330
|
+
function MSALAngularConfigFactory(config) {
|
|
331
|
+
const msConf = config.getConfig('auth.microsoft');
|
|
305
332
|
return {
|
|
306
333
|
interactionType: InteractionType.Popup,
|
|
307
334
|
authRequest: {
|
|
308
335
|
scopes: ['user.read'],
|
|
309
|
-
|
|
336
|
+
domainHint: msConf?.domainHint || ''
|
|
310
337
|
},
|
|
311
338
|
type: 'add'
|
|
312
339
|
};
|
|
@@ -321,7 +348,7 @@ function MSALAngularConfigFactoryb2c(config) {
|
|
|
321
348
|
type: 'b2c'
|
|
322
349
|
};
|
|
323
350
|
}
|
|
324
|
-
function withMicrosoftSupport(type) {
|
|
351
|
+
function withMicrosoftSupport(type, serviceFactory = msalServiceFactory) {
|
|
325
352
|
if (type === 'b2c') {
|
|
326
353
|
return {
|
|
327
354
|
kind: AuthFeatureKind.Microsoft,
|
|
@@ -356,15 +383,27 @@ function withMicrosoftSupport(type) {
|
|
|
356
383
|
deps: [ConfigService],
|
|
357
384
|
multi: true
|
|
358
385
|
},
|
|
359
|
-
MsalService
|
|
386
|
+
MsalService,
|
|
387
|
+
{
|
|
388
|
+
provide: AuthService,
|
|
389
|
+
useFactory: serviceFactory,
|
|
390
|
+
deps: [ConfigService]
|
|
391
|
+
}
|
|
360
392
|
]
|
|
361
393
|
};
|
|
362
394
|
}
|
|
363
395
|
}
|
|
396
|
+
const msalServiceFactory = (config) => {
|
|
397
|
+
const msConf = config.getConfig('auth.microsoft');
|
|
398
|
+
if (!msConf) {
|
|
399
|
+
return new AuthService();
|
|
400
|
+
}
|
|
401
|
+
return new AuthMsalService();
|
|
402
|
+
};
|
|
364
403
|
|
|
365
404
|
/**
|
|
366
405
|
* Generated bundle index. Do not edit.
|
|
367
406
|
*/
|
|
368
407
|
|
|
369
|
-
export { AUTH_MICROSOFT_DIRECTIVES, AuthMicrosoftComponent, AuthMicrosoftb2cComponent, MSALAngularConfigFactory, MSALAngularConfigFactoryb2c, MSALConfigFactory, MSALConfigFactoryb2c, withMicrosoftSupport };
|
|
408
|
+
export { AUTH_MICROSOFT_DIRECTIVES, AuthMicrosoftComponent, AuthMicrosoftb2cComponent, AuthMsalService, MSALAngularConfigFactory, MSALAngularConfigFactoryb2c, MSALConfigFactory, MSALConfigFactoryb2c, withMicrosoftSupport };
|
|
370
409
|
//# sourceMappingURL=igo2-auth-microsoft.mjs.map
|