@xxmachina/common 20.69.4 → 20.73.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/package.json +12 -44
- package/fesm2022/xxmachina-common-_shared-auth.mjs +0 -24
- package/fesm2022/xxmachina-common-_shared-meta.mjs +0 -24
- package/fesm2022/xxmachina-common-auth-azure.mjs +0 -159
- package/fesm2022/xxmachina-common-auth-passports-anonymous.mjs +0 -19
- package/fesm2022/xxmachina-common-auth-passports-firebase.mjs +0 -40
- package/fesm2022/xxmachina-common-auth-passports-internal.mjs +0 -33
- package/fesm2022/xxmachina-common-auth-passports-msal.mjs +0 -48
- package/fesm2022/xxmachina-common-auth-passports.mjs +0 -112
- package/types/xxmachina-common-_shared-auth.d.ts +0 -8
- package/types/xxmachina-common-_shared-meta.d.ts +0 -8
- package/types/xxmachina-common-auth-azure.d.ts +0 -41
- package/types/xxmachina-common-auth-passports-anonymous.d.ts +0 -8
- package/types/xxmachina-common-auth-passports-firebase.d.ts +0 -19
- package/types/xxmachina-common-auth-passports-internal.d.ts +0 -17
- package/types/xxmachina-common-auth-passports-msal.d.ts +0 -26
- package/types/xxmachina-common-auth-passports.d.ts +0 -60
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xxmachina/common",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.73.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"@nestjs/common": "10.2.8",
|
|
14
14
|
"@nestjs/graphql": "^11.0.0",
|
|
15
15
|
"@nestjs/passport": "^9.0.3",
|
|
16
|
-
"@ng-atomic/common": "20.
|
|
17
|
-
"@ng-atomic/components": "20.
|
|
18
|
-
"@ng-atomic/core": "20.
|
|
19
|
-
"@nx-ddd/common": "20.
|
|
20
|
-
"@nx-ddd/core": "20.
|
|
16
|
+
"@ng-atomic/common": "20.73.0",
|
|
17
|
+
"@ng-atomic/components": "20.73.0",
|
|
18
|
+
"@ng-atomic/core": "20.73.0",
|
|
19
|
+
"@nx-ddd/common": "20.73.0",
|
|
20
|
+
"@nx-ddd/core": "20.73.0",
|
|
21
21
|
"@tfarras/nestjs-firebase-auth": "^2.0.0",
|
|
22
22
|
"apollo-angular": "^7.0.2",
|
|
23
23
|
"class-transformer": "^0.5.1",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"class-validator-extended": "^3.2.0",
|
|
26
26
|
"dayjs": "1.11.13",
|
|
27
27
|
"express": "4.21.2",
|
|
28
|
-
"firebase-admin": "^12.6.0",
|
|
28
|
+
"firebase-admin": "^12.6.0 || ^13.0.0 || ^14.0.0",
|
|
29
29
|
"flat": "^6.0.0",
|
|
30
30
|
"genson-js": "^0.0.8",
|
|
31
31
|
"graphql": "^16.8.1",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"validate-azure-ad-token": "^2.2.0"
|
|
44
44
|
},
|
|
45
45
|
"optionalDependencies": {
|
|
46
|
-
"@nx-ddd/any-func": "20.
|
|
47
|
-
"@nx-ddd/firestore": "20.
|
|
48
|
-
"@nx-ddd/google": "20.
|
|
49
|
-
"@nx-ddd/hasura": "20.
|
|
50
|
-
"@nx-ddd/notion": "20.
|
|
46
|
+
"@nx-ddd/any-func": "20.73.0",
|
|
47
|
+
"@nx-ddd/firestore": "20.73.0",
|
|
48
|
+
"@nx-ddd/google": "20.73.0",
|
|
49
|
+
"@nx-ddd/hasura": "20.73.0",
|
|
50
|
+
"@nx-ddd/notion": "20.73.0",
|
|
51
51
|
"@notionhq/client": "^2.2.15"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
@@ -67,14 +67,6 @@
|
|
|
67
67
|
"types": "./types/xxmachina-common-_shared-ansi.d.ts",
|
|
68
68
|
"default": "./fesm2022/xxmachina-common-_shared-ansi.mjs"
|
|
69
69
|
},
|
|
70
|
-
"./_shared/auth": {
|
|
71
|
-
"types": "./types/xxmachina-common-_shared-auth.d.ts",
|
|
72
|
-
"default": "./fesm2022/xxmachina-common-_shared-auth.mjs"
|
|
73
|
-
},
|
|
74
|
-
"./_shared/meta": {
|
|
75
|
-
"types": "./types/xxmachina-common-_shared-meta.d.ts",
|
|
76
|
-
"default": "./fesm2022/xxmachina-common-_shared-meta.mjs"
|
|
77
|
-
},
|
|
78
70
|
"./_shared/meta/redis": {
|
|
79
71
|
"types": "./types/xxmachina-common-_shared-meta-redis.d.ts",
|
|
80
72
|
"default": "./fesm2022/xxmachina-common-_shared-meta-redis.mjs"
|
|
@@ -83,10 +75,6 @@
|
|
|
83
75
|
"types": "./types/xxmachina-common-auth.d.ts",
|
|
84
76
|
"default": "./fesm2022/xxmachina-common-auth.mjs"
|
|
85
77
|
},
|
|
86
|
-
"./auth/azure": {
|
|
87
|
-
"types": "./types/xxmachina-common-auth-azure.d.ts",
|
|
88
|
-
"default": "./fesm2022/xxmachina-common-auth-azure.mjs"
|
|
89
|
-
},
|
|
90
78
|
"./auth/core": {
|
|
91
79
|
"types": "./types/xxmachina-common-auth-core.d.ts",
|
|
92
80
|
"default": "./fesm2022/xxmachina-common-auth-core.mjs"
|
|
@@ -95,26 +83,6 @@
|
|
|
95
83
|
"types": "./types/xxmachina-common-auth-firebase.d.ts",
|
|
96
84
|
"default": "./fesm2022/xxmachina-common-auth-firebase.mjs"
|
|
97
85
|
},
|
|
98
|
-
"./auth/passports": {
|
|
99
|
-
"types": "./types/xxmachina-common-auth-passports.d.ts",
|
|
100
|
-
"default": "./fesm2022/xxmachina-common-auth-passports.mjs"
|
|
101
|
-
},
|
|
102
|
-
"./auth/passports/anonymous": {
|
|
103
|
-
"types": "./types/xxmachina-common-auth-passports-anonymous.d.ts",
|
|
104
|
-
"default": "./fesm2022/xxmachina-common-auth-passports-anonymous.mjs"
|
|
105
|
-
},
|
|
106
|
-
"./auth/passports/firebase": {
|
|
107
|
-
"types": "./types/xxmachina-common-auth-passports-firebase.d.ts",
|
|
108
|
-
"default": "./fesm2022/xxmachina-common-auth-passports-firebase.mjs"
|
|
109
|
-
},
|
|
110
|
-
"./auth/passports/internal": {
|
|
111
|
-
"types": "./types/xxmachina-common-auth-passports-internal.d.ts",
|
|
112
|
-
"default": "./fesm2022/xxmachina-common-auth-passports-internal.mjs"
|
|
113
|
-
},
|
|
114
|
-
"./auth/passports/msal": {
|
|
115
|
-
"types": "./types/xxmachina-common-auth-passports-msal.d.ts",
|
|
116
|
-
"default": "./fesm2022/xxmachina-common-auth-passports-msal.mjs"
|
|
117
|
-
},
|
|
118
86
|
"./domain": {
|
|
119
87
|
"types": "./types/xxmachina-common-domain.d.ts",
|
|
120
88
|
"default": "./fesm2022/xxmachina-common-domain.mjs"
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { __decorate } from 'tslib';
|
|
2
|
-
import { Module } from '@nestjs/common';
|
|
3
|
-
import { PassportModule } from '@nestjs/passport';
|
|
4
|
-
|
|
5
|
-
var AuthModule_1;
|
|
6
|
-
let AuthModule = AuthModule_1 = class AuthModule {
|
|
7
|
-
static forRoot() {
|
|
8
|
-
return { module: AuthModule_1, providers: [] };
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
AuthModule = AuthModule_1 = __decorate([
|
|
12
|
-
Module({
|
|
13
|
-
imports: [PassportModule],
|
|
14
|
-
providers: [],
|
|
15
|
-
exports: [],
|
|
16
|
-
controllers: [],
|
|
17
|
-
})
|
|
18
|
-
], AuthModule);
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Generated bundle index. Do not edit.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
export { AuthModule };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
let ObjectType, Field, ID;
|
|
2
|
-
const _decorators = {
|
|
3
|
-
ObjectType: function () {
|
|
4
|
-
return function (target) {
|
|
5
|
-
void 0;
|
|
6
|
-
};
|
|
7
|
-
},
|
|
8
|
-
Field: function () {
|
|
9
|
-
return function (target, propertyKey) {
|
|
10
|
-
void 0;
|
|
11
|
-
};
|
|
12
|
-
},
|
|
13
|
-
ID: null,
|
|
14
|
-
};
|
|
15
|
-
({ ObjectType, Field, ID } = _decorators);
|
|
16
|
-
function provideNestjsGraphql(_decorators) {
|
|
17
|
-
({ ObjectType, Field, ID } = _decorators);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Generated bundle index. Do not edit.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
export { Field, ID, ObjectType, provideNestjsGraphql };
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, signal, Injectable, makeEnvironmentProviders, ENVIRONMENT_INITIALIZER, importProvidersFrom } from '@angular/core';
|
|
3
|
-
import * as i1 from '@azure/msal-angular';
|
|
4
|
-
import { MsalModule } from '@azure/msal-angular';
|
|
5
|
-
import { PublicClientApplication, InteractionType } from '@azure/msal-browser';
|
|
6
|
-
import { provideEffect } from '@ng-atomic/core';
|
|
7
|
-
import { AppFrameStore } from '@ng-atomic/components/frames/app';
|
|
8
|
-
import { AuthService as AuthService$1 } from '@xxmachina/common/auth';
|
|
9
|
-
import { toSignal, toObservable } from '@angular/core/rxjs-interop';
|
|
10
|
-
import { ReplaySubject, interval, startWith, switchMap, filter, take, lastValueFrom } from 'rxjs';
|
|
11
|
-
import { HttpClient } from '@angular/common/http';
|
|
12
|
-
|
|
13
|
-
class AuthService {
|
|
14
|
-
}
|
|
15
|
-
const AZURE_AUTH_CONFIG = new InjectionToken('[@xxmachina/common] AZURE_AUTH_CONFIG');
|
|
16
|
-
class AzureAuthService extends AuthService {
|
|
17
|
-
msal;
|
|
18
|
-
config = inject(AZURE_AUTH_CONFIG);
|
|
19
|
-
auth$ = new ReplaySubject(1);
|
|
20
|
-
auth = toSignal(this.auth$);
|
|
21
|
-
accessToken = signal(null, ...(ngDevMode ? [{ debugName: "accessToken" }] : /* istanbul ignore next */ []));
|
|
22
|
-
accessToken$ = toObservable(this.accessToken);
|
|
23
|
-
http = inject(HttpClient);
|
|
24
|
-
constructor(msal) {
|
|
25
|
-
super();
|
|
26
|
-
this.msal = msal;
|
|
27
|
-
this.initialize().then(() => {
|
|
28
|
-
const account = this.msal.instance.getActiveAccount();
|
|
29
|
-
if (account) {
|
|
30
|
-
this.auth$.next(account);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
this.auth$.next(null);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
interval(1_000 * 60 * 5).pipe(startWith(null), switchMap(() => this.auth$.pipe(filter((auth) => !!auth), take(1))), filter(() => !!this.auth())).subscribe(() => {
|
|
37
|
-
this.updateAccessToken();
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
async initialize() {
|
|
41
|
-
await lastValueFrom(this.msal.initialize()).then(() => {
|
|
42
|
-
return this.msal.instance.handleRedirectPromise().then((response) => {
|
|
43
|
-
if (response !== null) {
|
|
44
|
-
this.msal.instance.setActiveAccount(response.account);
|
|
45
|
-
}
|
|
46
|
-
}).catch((error) => {
|
|
47
|
-
console.error('リダイレクト処理エラー:', error);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
async signIn() {
|
|
52
|
-
try {
|
|
53
|
-
const result = await lastValueFrom(this.msal.loginPopup({
|
|
54
|
-
scopes: this.config.scopes,
|
|
55
|
-
}));
|
|
56
|
-
this.msal.instance.setActiveAccount(result.account);
|
|
57
|
-
this.auth$.next(result.account);
|
|
58
|
-
console.debug('Sign-in result:', result);
|
|
59
|
-
await this.acquireAccessToken();
|
|
60
|
-
return result.account;
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
console.error('Sign-in failed:', error);
|
|
64
|
-
throw error;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
async signOut() {
|
|
68
|
-
try {
|
|
69
|
-
this.msal.instance.setActiveAccount(null);
|
|
70
|
-
this.auth$.next(null);
|
|
71
|
-
this.accessToken.set(null);
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
console.error('Sign-out failed:', error);
|
|
75
|
-
throw error;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
async updateAccessToken(scopes = this.config.scopes) {
|
|
79
|
-
try {
|
|
80
|
-
const accessToken = await this.acquireAccessToken(scopes);
|
|
81
|
-
this.accessToken.set(accessToken);
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
console.error('Failed to acquire access token:', error);
|
|
85
|
-
this.accessToken.set(null);
|
|
86
|
-
throw error;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
async acquireAccessToken(scopes = this.config.scopes) {
|
|
90
|
-
const account = this.msal.instance.getActiveAccount();
|
|
91
|
-
if (!account)
|
|
92
|
-
throw new Error('No active account found.');
|
|
93
|
-
return lastValueFrom(this.msal.acquireTokenSilent({
|
|
94
|
-
account,
|
|
95
|
-
scopes,
|
|
96
|
-
forceRefresh: true,
|
|
97
|
-
})).then((response) => {
|
|
98
|
-
this.auth$.next(response.account);
|
|
99
|
-
console.debug('[AzureAuthService] response:', response);
|
|
100
|
-
return response.accessToken;
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AzureAuthService, deps: [{ token: i1.MsalService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
104
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AzureAuthService, providedIn: 'root' });
|
|
105
|
-
}
|
|
106
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: AzureAuthService, decorators: [{
|
|
107
|
-
type: Injectable,
|
|
108
|
-
args: [{ providedIn: 'root' }]
|
|
109
|
-
}], ctorParameters: () => [{ type: i1.MsalService }] });
|
|
110
|
-
|
|
111
|
-
function provideAppInitializer(useValue) {
|
|
112
|
-
return makeEnvironmentProviders([
|
|
113
|
-
{
|
|
114
|
-
provide: ENVIRONMENT_INITIALIZER,
|
|
115
|
-
useValue,
|
|
116
|
-
multi: true,
|
|
117
|
-
},
|
|
118
|
-
]);
|
|
119
|
-
}
|
|
120
|
-
function provideAzureAuth(config) {
|
|
121
|
-
return makeEnvironmentProviders([
|
|
122
|
-
importProvidersFrom(MsalModule.forRoot(new PublicClientApplication(config?.configuration), {
|
|
123
|
-
interactionType: InteractionType.Redirect,
|
|
124
|
-
authRequest: {
|
|
125
|
-
scopes: config.scopes,
|
|
126
|
-
},
|
|
127
|
-
}, {
|
|
128
|
-
interactionType: InteractionType.Redirect,
|
|
129
|
-
protectedResourceMap: new Map([
|
|
130
|
-
['https://graph.microsoft.com/v1.0/me', config.scopes],
|
|
131
|
-
]),
|
|
132
|
-
})),
|
|
133
|
-
{ provide: AZURE_AUTH_CONFIG, useValue: config },
|
|
134
|
-
{ provide: AuthService$1, useClass: AzureAuthService },
|
|
135
|
-
provideAppInitializer(() => { inject(AuthService$1); }),
|
|
136
|
-
provideEffect(AppFrameStore.ActionId.SIGN_IN_WITH_MICROSOFT, () => {
|
|
137
|
-
const auth = inject(AuthService$1);
|
|
138
|
-
return () => {
|
|
139
|
-
console.debug('auth:', auth);
|
|
140
|
-
if (!auth.auth()) {
|
|
141
|
-
auth.signIn();
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
console.log('既にログイン済みです。');
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
}),
|
|
148
|
-
provideEffect(AppFrameStore.ActionId.SIGN_OUT, () => {
|
|
149
|
-
const auth = inject(AuthService$1);
|
|
150
|
-
return () => auth.signOut();
|
|
151
|
-
}),
|
|
152
|
-
]);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Generated bundle index. Do not edit.
|
|
157
|
-
*/
|
|
158
|
-
|
|
159
|
-
export { AZURE_AUTH_CONFIG, AzureAuthService, provideAppInitializer, provideAzureAuth };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { __decorate } from 'tslib';
|
|
2
|
-
import { Injectable } from '@nestjs/common';
|
|
3
|
-
import { PassportStrategy } from '@nestjs/passport';
|
|
4
|
-
import { Strategy } from 'passport-custom';
|
|
5
|
-
|
|
6
|
-
let AnonymousStrategy = class AnonymousStrategy extends PassportStrategy(Strategy, 'anonymous') {
|
|
7
|
-
async validate(request) {
|
|
8
|
-
return {};
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
AnonymousStrategy = __decorate([
|
|
12
|
-
Injectable()
|
|
13
|
-
], AnonymousStrategy);
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Generated bundle index. Do not edit.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
export { AnonymousStrategy };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from 'tslib';
|
|
2
|
-
import { Injectable } from '@nestjs/common';
|
|
3
|
-
import { AuthGuard, PassportStrategy } from '@nestjs/passport';
|
|
4
|
-
import { GqlExecutionContext } from '@nestjs/graphql';
|
|
5
|
-
import { FirebaseAuthStrategy } from '@tfarras/nestjs-firebase-auth';
|
|
6
|
-
import { ExtractJwt } from 'passport-jwt';
|
|
7
|
-
|
|
8
|
-
let FirebaseAuthGuard = class FirebaseAuthGuard extends AuthGuard('firebase') {
|
|
9
|
-
getRequest(context) {
|
|
10
|
-
const ctx = GqlExecutionContext.create(context);
|
|
11
|
-
const gqlReq = ctx.getContext().req;
|
|
12
|
-
if (gqlReq) {
|
|
13
|
-
gqlReq.body = ctx.getArgs();
|
|
14
|
-
return gqlReq;
|
|
15
|
-
}
|
|
16
|
-
return context.switchToHttp().getRequest();
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
FirebaseAuthGuard = __decorate([
|
|
20
|
-
Injectable()
|
|
21
|
-
], FirebaseAuthGuard);
|
|
22
|
-
|
|
23
|
-
let FirebaseStrategy = class FirebaseStrategy extends PassportStrategy(FirebaseAuthStrategy, 'firebase') {
|
|
24
|
-
constructor() {
|
|
25
|
-
super({ extractor: ExtractJwt.fromAuthHeaderAsBearerToken() });
|
|
26
|
-
}
|
|
27
|
-
authenticate(req) {
|
|
28
|
-
return super.authenticate(req);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
FirebaseStrategy = __decorate([
|
|
32
|
-
Injectable(),
|
|
33
|
-
__metadata("design:paramtypes", [])
|
|
34
|
-
], FirebaseStrategy);
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Generated bundle index. Do not edit.
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
export { FirebaseAuthGuard, FirebaseStrategy };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
-
import { Injectable, Inject } from '@nestjs/common';
|
|
3
|
-
import { PassportStrategy } from '@nestjs/passport';
|
|
4
|
-
import { Strategy } from 'passport-http-bearer';
|
|
5
|
-
|
|
6
|
-
const INTERNAL_STRATEGY_TOKEN = 'INTERNAL_STRATEGY_TOKEN';
|
|
7
|
-
function provideInternalStrategyToken(token) {
|
|
8
|
-
return {
|
|
9
|
-
provide: INTERNAL_STRATEGY_TOKEN,
|
|
10
|
-
useValue: token,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
let InternalStrategy = class InternalStrategy extends PassportStrategy(Strategy, 'internal') {
|
|
14
|
-
token;
|
|
15
|
-
constructor(token) {
|
|
16
|
-
super();
|
|
17
|
-
this.token = token;
|
|
18
|
-
}
|
|
19
|
-
async validate(token) {
|
|
20
|
-
return token === this.token;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
InternalStrategy = __decorate([
|
|
24
|
-
Injectable(),
|
|
25
|
-
__param(0, Inject(INTERNAL_STRATEGY_TOKEN)),
|
|
26
|
-
__metadata("design:paramtypes", [String])
|
|
27
|
-
], InternalStrategy);
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Generated bundle index. Do not edit.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
export { INTERNAL_STRATEGY_TOKEN, InternalStrategy, provideInternalStrategyToken };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
-
import { Injectable, UnauthorizedException, Inject } from '@nestjs/common';
|
|
3
|
-
import { AuthGuard, PassportStrategy } from '@nestjs/passport';
|
|
4
|
-
import { Strategy } from 'passport-custom';
|
|
5
|
-
import validate from 'validate-azure-ad-token';
|
|
6
|
-
|
|
7
|
-
let MsalAuthGuard = class MsalAuthGuard extends AuthGuard('msal') {
|
|
8
|
-
};
|
|
9
|
-
MsalAuthGuard = __decorate([
|
|
10
|
-
Injectable()
|
|
11
|
-
], MsalAuthGuard);
|
|
12
|
-
|
|
13
|
-
const MSAL_CONFIG = 'MSAL_CONFIG';
|
|
14
|
-
function provideMsalAuth(useFactory) {
|
|
15
|
-
return [
|
|
16
|
-
{ provide: MSAL_CONFIG, useFactory },
|
|
17
|
-
MsalStrategy,
|
|
18
|
-
];
|
|
19
|
-
}
|
|
20
|
-
let MsalStrategy = class MsalStrategy extends PassportStrategy(Strategy, 'msal') {
|
|
21
|
-
config;
|
|
22
|
-
constructor(config) {
|
|
23
|
-
super();
|
|
24
|
-
this.config = config;
|
|
25
|
-
}
|
|
26
|
-
async validate(req) {
|
|
27
|
-
const token = req.headers.authorization?.split(' ')[1];
|
|
28
|
-
try {
|
|
29
|
-
const decoded = await validate(token, this.config);
|
|
30
|
-
return decoded.payload;
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
console.error('err:', err);
|
|
34
|
-
throw new UnauthorizedException();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
MsalStrategy = __decorate([
|
|
39
|
-
Injectable(),
|
|
40
|
-
__param(0, Inject(MSAL_CONFIG)),
|
|
41
|
-
__metadata("design:paramtypes", [Object])
|
|
42
|
-
], MsalStrategy);
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Generated bundle index. Do not edit.
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
export { MSAL_CONFIG, MsalAuthGuard, MsalStrategy, provideMsalAuth };
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param, __metadata } from 'tslib';
|
|
2
|
-
import { Injectable, Inject, UnauthorizedException } from '@nestjs/common';
|
|
3
|
-
import { PassportStrategy, AuthGuard } from '@nestjs/passport';
|
|
4
|
-
import { Strategy } from 'passport-custom';
|
|
5
|
-
import { Strategy as Strategy$1 } from 'passport-http-bearer';
|
|
6
|
-
import validate from 'validate-azure-ad-token';
|
|
7
|
-
import { GqlExecutionContext } from '@nestjs/graphql';
|
|
8
|
-
import { FirebaseAuthStrategy } from '@tfarras/nestjs-firebase-auth';
|
|
9
|
-
import { ExtractJwt } from 'passport-jwt';
|
|
10
|
-
|
|
11
|
-
let AnonymousStrategy = class AnonymousStrategy extends PassportStrategy(Strategy, 'anonymous') {
|
|
12
|
-
async validate(request) {
|
|
13
|
-
return {};
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
AnonymousStrategy = __decorate([
|
|
17
|
-
Injectable()
|
|
18
|
-
], AnonymousStrategy);
|
|
19
|
-
|
|
20
|
-
const INTERNAL_STRATEGY_TOKEN = 'INTERNAL_STRATEGY_TOKEN';
|
|
21
|
-
function provideInternalStrategyToken(token) {
|
|
22
|
-
return {
|
|
23
|
-
provide: INTERNAL_STRATEGY_TOKEN,
|
|
24
|
-
useValue: token,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
let InternalStrategy = class InternalStrategy extends PassportStrategy(Strategy$1, 'internal') {
|
|
28
|
-
token;
|
|
29
|
-
constructor(token) {
|
|
30
|
-
super();
|
|
31
|
-
this.token = token;
|
|
32
|
-
}
|
|
33
|
-
async validate(token) {
|
|
34
|
-
return token === this.token;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
InternalStrategy = __decorate([
|
|
38
|
-
Injectable(),
|
|
39
|
-
__param(0, Inject(INTERNAL_STRATEGY_TOKEN)),
|
|
40
|
-
__metadata("design:paramtypes", [String])
|
|
41
|
-
], InternalStrategy);
|
|
42
|
-
|
|
43
|
-
let MsalAuthGuard = class MsalAuthGuard extends AuthGuard('msal') {
|
|
44
|
-
};
|
|
45
|
-
MsalAuthGuard = __decorate([
|
|
46
|
-
Injectable()
|
|
47
|
-
], MsalAuthGuard);
|
|
48
|
-
|
|
49
|
-
const MSAL_CONFIG = 'MSAL_CONFIG';
|
|
50
|
-
function provideMsalAuth(useFactory) {
|
|
51
|
-
return [
|
|
52
|
-
{ provide: MSAL_CONFIG, useFactory },
|
|
53
|
-
MsalStrategy,
|
|
54
|
-
];
|
|
55
|
-
}
|
|
56
|
-
let MsalStrategy = class MsalStrategy extends PassportStrategy(Strategy, 'msal') {
|
|
57
|
-
config;
|
|
58
|
-
constructor(config) {
|
|
59
|
-
super();
|
|
60
|
-
this.config = config;
|
|
61
|
-
}
|
|
62
|
-
async validate(req) {
|
|
63
|
-
const token = req.headers.authorization?.split(' ')[1];
|
|
64
|
-
try {
|
|
65
|
-
const decoded = await validate(token, this.config);
|
|
66
|
-
return decoded.payload;
|
|
67
|
-
}
|
|
68
|
-
catch (err) {
|
|
69
|
-
console.error('err:', err);
|
|
70
|
-
throw new UnauthorizedException();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
MsalStrategy = __decorate([
|
|
75
|
-
Injectable(),
|
|
76
|
-
__param(0, Inject(MSAL_CONFIG)),
|
|
77
|
-
__metadata("design:paramtypes", [Object])
|
|
78
|
-
], MsalStrategy);
|
|
79
|
-
|
|
80
|
-
let FirebaseAuthGuard = class FirebaseAuthGuard extends AuthGuard('firebase') {
|
|
81
|
-
getRequest(context) {
|
|
82
|
-
const ctx = GqlExecutionContext.create(context);
|
|
83
|
-
const gqlReq = ctx.getContext().req;
|
|
84
|
-
if (gqlReq) {
|
|
85
|
-
gqlReq.body = ctx.getArgs();
|
|
86
|
-
return gqlReq;
|
|
87
|
-
}
|
|
88
|
-
return context.switchToHttp().getRequest();
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
FirebaseAuthGuard = __decorate([
|
|
92
|
-
Injectable()
|
|
93
|
-
], FirebaseAuthGuard);
|
|
94
|
-
|
|
95
|
-
let FirebaseStrategy = class FirebaseStrategy extends PassportStrategy(FirebaseAuthStrategy, 'firebase') {
|
|
96
|
-
constructor() {
|
|
97
|
-
super({ extractor: ExtractJwt.fromAuthHeaderAsBearerToken() });
|
|
98
|
-
}
|
|
99
|
-
authenticate(req) {
|
|
100
|
-
return super.authenticate(req);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
FirebaseStrategy = __decorate([
|
|
104
|
-
Injectable(),
|
|
105
|
-
__metadata("design:paramtypes", [])
|
|
106
|
-
], FirebaseStrategy);
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Generated bundle index. Do not edit.
|
|
110
|
-
*/
|
|
111
|
-
|
|
112
|
-
export { AnonymousStrategy, FirebaseAuthGuard, FirebaseStrategy, INTERNAL_STRATEGY_TOKEN, InternalStrategy, MSAL_CONFIG, MsalAuthGuard, MsalStrategy, provideInternalStrategyToken, provideMsalAuth };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { InjectionToken, EnvironmentProviders } from '@angular/core';
|
|
3
|
-
import { Observable, ReplaySubject } from 'rxjs';
|
|
4
|
-
import { MsalService } from '@azure/msal-angular';
|
|
5
|
-
import { Configuration, AccountInfo } from '@azure/msal-browser';
|
|
6
|
-
import { HttpClient } from '@angular/common/http';
|
|
7
|
-
|
|
8
|
-
declare abstract class AuthService {
|
|
9
|
-
abstract readonly auth$: Observable<any>;
|
|
10
|
-
abstract readonly accessToken$: Observable<string>;
|
|
11
|
-
abstract signIn(): Promise<any>;
|
|
12
|
-
abstract signOut(): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
interface AzureAuthConfig {
|
|
15
|
-
configuration: Configuration;
|
|
16
|
-
scopes: string[];
|
|
17
|
-
}
|
|
18
|
-
declare const AZURE_AUTH_CONFIG: InjectionToken<AzureAuthConfig>;
|
|
19
|
-
declare class AzureAuthService extends AuthService {
|
|
20
|
-
msal: MsalService;
|
|
21
|
-
protected readonly config: AzureAuthConfig;
|
|
22
|
-
readonly auth$: ReplaySubject<AccountInfo>;
|
|
23
|
-
readonly auth: _angular_core.Signal<AccountInfo | undefined>;
|
|
24
|
-
readonly accessToken: _angular_core.WritableSignal<string | null>;
|
|
25
|
-
readonly accessToken$: Observable<string>;
|
|
26
|
-
readonly http: HttpClient;
|
|
27
|
-
constructor(msal: MsalService);
|
|
28
|
-
initialize(): Promise<void>;
|
|
29
|
-
signIn(): Promise<any>;
|
|
30
|
-
signOut(): Promise<void>;
|
|
31
|
-
protected updateAccessToken(scopes?: string[]): Promise<void>;
|
|
32
|
-
acquireAccessToken(scopes?: string[]): Promise<string>;
|
|
33
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<AzureAuthService, never>;
|
|
34
|
-
static ɵprov: _angular_core.ɵɵInjectableDeclaration<AzureAuthService>;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
declare function provideAppInitializer(useValue: () => void): EnvironmentProviders;
|
|
38
|
-
declare function provideAzureAuth(config: AzureAuthConfig): EnvironmentProviders;
|
|
39
|
-
|
|
40
|
-
export { AZURE_AUTH_CONFIG, AzureAuthService, provideAppInitializer, provideAzureAuth };
|
|
41
|
-
export type { AzureAuthConfig };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Strategy } from 'passport-custom';
|
|
2
|
-
|
|
3
|
-
declare const AnonymousStrategy_base: new (...args: any[]) => Strategy;
|
|
4
|
-
declare class AnonymousStrategy extends AnonymousStrategy_base {
|
|
5
|
-
validate(request: Request): Promise<any>;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export { AnonymousStrategy };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as _nestjs_passport from '@nestjs/passport';
|
|
2
|
-
import { ExecutionContext } from '@nestjs/common';
|
|
3
|
-
import { FirebaseAuthStrategy } from '@tfarras/nestjs-firebase-auth';
|
|
4
|
-
import { Request } from 'express';
|
|
5
|
-
import { ParamsDictionary } from 'express-serve-static-core';
|
|
6
|
-
import { ParsedQs } from 'qs';
|
|
7
|
-
|
|
8
|
-
declare const FirebaseAuthGuard_base: _nestjs_passport.Type<_nestjs_passport.IAuthGuard>;
|
|
9
|
-
declare class FirebaseAuthGuard extends FirebaseAuthGuard_base {
|
|
10
|
-
getRequest(context: ExecutionContext): any;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
declare const FirebaseStrategy_base: new (...args: any[]) => FirebaseAuthStrategy;
|
|
14
|
-
declare class FirebaseStrategy extends FirebaseStrategy_base {
|
|
15
|
-
constructor();
|
|
16
|
-
authenticate(req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>): void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { FirebaseAuthGuard, FirebaseStrategy };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as passport_http_bearer from 'passport-http-bearer';
|
|
2
|
-
import { Strategy } from 'passport-http-bearer';
|
|
3
|
-
import { InjectionToken } from '@nestjs/common';
|
|
4
|
-
|
|
5
|
-
declare const INTERNAL_STRATEGY_TOKEN: InjectionToken;
|
|
6
|
-
declare function provideInternalStrategyToken(token: string): {
|
|
7
|
-
provide: InjectionToken;
|
|
8
|
-
useValue: string;
|
|
9
|
-
};
|
|
10
|
-
declare const InternalStrategy_base: new (...args: any[]) => Strategy<passport_http_bearer.VerifyFunctions>;
|
|
11
|
-
declare class InternalStrategy extends InternalStrategy_base {
|
|
12
|
-
private token;
|
|
13
|
-
constructor(token: string);
|
|
14
|
-
validate(token: string): Promise<boolean>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { INTERNAL_STRATEGY_TOKEN, InternalStrategy, provideInternalStrategyToken };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as _nestjs_passport from '@nestjs/passport';
|
|
2
|
-
import { Provider } from '@nestjs/common';
|
|
3
|
-
import { Strategy } from 'passport-custom';
|
|
4
|
-
import { JwtPayload } from 'jsonwebtoken';
|
|
5
|
-
|
|
6
|
-
declare const MsalAuthGuard_base: _nestjs_passport.Type<_nestjs_passport.IAuthGuard>;
|
|
7
|
-
declare class MsalAuthGuard extends MsalAuthGuard_base {
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
declare const MSAL_CONFIG = "MSAL_CONFIG";
|
|
11
|
-
interface MsalConfig {
|
|
12
|
-
tenantId: string;
|
|
13
|
-
audience: string;
|
|
14
|
-
applicationId: string;
|
|
15
|
-
scopes: string[];
|
|
16
|
-
}
|
|
17
|
-
declare function provideMsalAuth(useFactory: () => MsalConfig): Provider[];
|
|
18
|
-
declare const MsalStrategy_base: new (...args: any[]) => Strategy;
|
|
19
|
-
declare class MsalStrategy extends MsalStrategy_base {
|
|
20
|
-
private readonly config;
|
|
21
|
-
constructor(config: MsalConfig);
|
|
22
|
-
validate(req: any): Promise<JwtPayload | string>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { MSAL_CONFIG, MsalAuthGuard, MsalStrategy, provideMsalAuth };
|
|
26
|
-
export type { MsalConfig };
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Strategy } from 'passport-custom';
|
|
2
|
-
import * as passport_http_bearer from 'passport-http-bearer';
|
|
3
|
-
import { Strategy as Strategy$1 } from 'passport-http-bearer';
|
|
4
|
-
import { InjectionToken, Provider, ExecutionContext } from '@nestjs/common';
|
|
5
|
-
import * as _nestjs_passport from '@nestjs/passport';
|
|
6
|
-
import { JwtPayload } from 'jsonwebtoken';
|
|
7
|
-
import { FirebaseAuthStrategy } from '@tfarras/nestjs-firebase-auth';
|
|
8
|
-
import { Request as Request$1 } from 'express';
|
|
9
|
-
import { ParamsDictionary } from 'express-serve-static-core';
|
|
10
|
-
import { ParsedQs } from 'qs';
|
|
11
|
-
|
|
12
|
-
declare const AnonymousStrategy_base: new (...args: any[]) => Strategy;
|
|
13
|
-
declare class AnonymousStrategy extends AnonymousStrategy_base {
|
|
14
|
-
validate(request: Request): Promise<any>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
declare const INTERNAL_STRATEGY_TOKEN: InjectionToken;
|
|
18
|
-
declare function provideInternalStrategyToken(token: string): {
|
|
19
|
-
provide: InjectionToken;
|
|
20
|
-
useValue: string;
|
|
21
|
-
};
|
|
22
|
-
declare const InternalStrategy_base: new (...args: any[]) => Strategy$1<passport_http_bearer.VerifyFunctions>;
|
|
23
|
-
declare class InternalStrategy extends InternalStrategy_base {
|
|
24
|
-
private token;
|
|
25
|
-
constructor(token: string);
|
|
26
|
-
validate(token: string): Promise<boolean>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
declare const MsalAuthGuard_base: _nestjs_passport.Type<_nestjs_passport.IAuthGuard>;
|
|
30
|
-
declare class MsalAuthGuard extends MsalAuthGuard_base {
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
declare const MSAL_CONFIG = "MSAL_CONFIG";
|
|
34
|
-
interface MsalConfig {
|
|
35
|
-
tenantId: string;
|
|
36
|
-
audience: string;
|
|
37
|
-
applicationId: string;
|
|
38
|
-
scopes: string[];
|
|
39
|
-
}
|
|
40
|
-
declare function provideMsalAuth(useFactory: () => MsalConfig): Provider[];
|
|
41
|
-
declare const MsalStrategy_base: new (...args: any[]) => Strategy;
|
|
42
|
-
declare class MsalStrategy extends MsalStrategy_base {
|
|
43
|
-
private readonly config;
|
|
44
|
-
constructor(config: MsalConfig);
|
|
45
|
-
validate(req: any): Promise<JwtPayload | string>;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
declare const FirebaseAuthGuard_base: _nestjs_passport.Type<_nestjs_passport.IAuthGuard>;
|
|
49
|
-
declare class FirebaseAuthGuard extends FirebaseAuthGuard_base {
|
|
50
|
-
getRequest(context: ExecutionContext): any;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
declare const FirebaseStrategy_base: new (...args: any[]) => FirebaseAuthStrategy;
|
|
54
|
-
declare class FirebaseStrategy extends FirebaseStrategy_base {
|
|
55
|
-
constructor();
|
|
56
|
-
authenticate(req: Request$1<ParamsDictionary, any, any, ParsedQs, Record<string, any>>): void;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export { AnonymousStrategy, FirebaseAuthGuard, FirebaseStrategy, INTERNAL_STRATEGY_TOKEN, InternalStrategy, MSAL_CONFIG, MsalAuthGuard, MsalStrategy, provideInternalStrategyToken, provideMsalAuth };
|
|
60
|
-
export type { MsalConfig };
|