forked from sourcefuse/loopback4-authentication
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomponent.ts
66 lines (61 loc) · 2.46 KB
/
component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import {Component, ProviderMap} from '@loopback/core';
import {AuthenticationBindings} from './keys';
import {
AuthenticateActionProvider,
AuthMetadataProvider,
ClientAuthenticateActionProvider,
ClientAuthMetadataProvider,
} from './providers';
import {
AuthStrategyProvider,
ClientAuthStrategyProvider,
ClientPasswordVerifyProvider,
LocalPasswordVerifyProvider,
BearerTokenVerifyProvider,
ResourceOwnerVerifyProvider,
LocalPasswordStrategyFactoryProvider,
ClientPasswordStrategyFactoryProvider,
BearerStrategyFactoryProvider,
ResourceOwnerPasswordStrategyFactoryProvider,
} from './strategies';
import {Strategies} from './strategies/keys';
import {
GoogleAuthStrategyFactoryProvider,
GoogleAuthVerifyProvider,
} from './strategies/passport/passport-google-oauth2';
export class AuthenticationComponent implements Component {
constructor() {
this.providers = {
[AuthenticationBindings.USER_AUTH_ACTION.key]: AuthenticateActionProvider,
[AuthenticationBindings.CLIENT_AUTH_ACTION
.key]: ClientAuthenticateActionProvider,
[AuthenticationBindings.USER_METADATA.key]: AuthMetadataProvider,
[AuthenticationBindings.CLIENT_METADATA.key]: ClientAuthMetadataProvider,
[AuthenticationBindings.USER_STRATEGY.key]: AuthStrategyProvider,
[AuthenticationBindings.CLIENT_STRATEGY.key]: ClientAuthStrategyProvider,
// Strategy function factories
[Strategies.Passport.LOCAL_STRATEGY_FACTORY
.key]: LocalPasswordStrategyFactoryProvider,
[Strategies.Passport.CLIENT_PASSWORD_STRATEGY_FACTORY
.key]: ClientPasswordStrategyFactoryProvider,
[Strategies.Passport.BEARER_STRATEGY_FACTORY
.key]: BearerStrategyFactoryProvider,
[Strategies.Passport.RESOURCE_OWNER_STRATEGY_FACTORY
.key]: ResourceOwnerPasswordStrategyFactoryProvider,
[Strategies.Passport.GOOGLE_OAUTH2_STRATEGY_FACTORY
.key]: GoogleAuthStrategyFactoryProvider,
// Verifier functions
[Strategies.Passport.OAUTH2_CLIENT_PASSWORD_VERIFIER
.key]: ClientPasswordVerifyProvider,
[Strategies.Passport.LOCAL_PASSWORD_VERIFIER
.key]: LocalPasswordVerifyProvider,
[Strategies.Passport.BEARER_TOKEN_VERIFIER
.key]: BearerTokenVerifyProvider,
[Strategies.Passport.RESOURCE_OWNER_PASSWORD_VERIFIER
.key]: ResourceOwnerVerifyProvider,
[Strategies.Passport.GOOGLE_OAUTH2_VERIFIER
.key]: GoogleAuthVerifyProvider,
};
}
providers?: ProviderMap;
}