@node-c/domain-iam 1.0.0-beta6 → 1.0.0-beta8
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/dist/common/definitions/common.constants.d.ts +13 -9
- package/dist/common/definitions/common.constants.js +13 -10
- package/dist/common/definitions/common.constants.js.map +1 -1
- package/dist/services/authentication/iam.authentication.definitions.d.ts +11 -2
- package/dist/services/authentication/iam.authentication.definitions.js +1 -1
- package/dist/services/authentication/iam.authentication.service.d.ts +9 -4
- package/dist/services/authentication/iam.authentication.service.js +95 -4
- package/dist/services/authentication/iam.authentication.service.js.map +1 -1
- package/dist/services/authenticationConsumer/iam.authenticationConsumer.definitions.d.ts +15 -0
- package/dist/services/authenticationConsumer/iam.authenticationConsumer.definitions.js +3 -0
- package/dist/services/authenticationConsumer/iam.authenticationConsumer.definitions.js.map +1 -0
- package/dist/services/authenticationConsumer/iam.authenticationConsumer.service.d.ts +12 -0
- package/dist/services/authenticationConsumer/iam.authenticationConsumer.service.js +135 -0
- package/dist/services/authenticationConsumer/iam.authenticationConsumer.service.js.map +1 -0
- package/dist/services/authenticationConsumer/index.d.ts +2 -0
- package/dist/services/authenticationConsumer/index.js +19 -0
- package/dist/services/authenticationConsumer/index.js.map +1 -0
- package/dist/services/{userManager/iam.userManager.definitions.d.ts → authenticationManager/iam.authenticationManager.definitions.d.ts} +11 -15
- package/dist/services/authenticationManager/iam.authenticationManager.definitions.js +8 -0
- package/dist/services/authenticationManager/iam.authenticationManager.definitions.js.map +1 -0
- package/dist/services/authenticationManager/iam.authenticationManager.service.d.ts +33 -0
- package/dist/services/{userManager/iam.userManager.service.js → authenticationManager/iam.authenticationManager.service.js} +140 -72
- package/dist/services/authenticationManager/iam.authenticationManager.service.js.map +1 -0
- package/dist/services/authenticationManager/index.d.ts +2 -0
- package/dist/services/authenticationManager/index.js +19 -0
- package/dist/services/authenticationManager/index.js.map +1 -0
- package/dist/services/authenticationOAuth2/iam.authenticationOAuth2.definitions.d.ts +5 -2
- package/dist/services/authenticationOAuth2/iam.authenticationOAuth2.service.d.ts +2 -14
- package/dist/services/authenticationOAuth2/iam.authenticationOAuth2.service.js +53 -95
- package/dist/services/authenticationOAuth2/iam.authenticationOAuth2.service.js.map +1 -1
- package/dist/services/authenticationOAuth2Consumer/iam.authenticationOAuth2Consumer.definitions.d.ts +19 -0
- package/dist/services/authenticationOAuth2Consumer/iam.authenticationOAuth2Consumer.definitions.js +3 -0
- package/dist/services/authenticationOAuth2Consumer/iam.authenticationOAuth2Consumer.definitions.js.map +1 -0
- package/dist/services/authenticationOAuth2Consumer/iam.authenticationOAuth2Consumer.service.d.ts +11 -0
- package/dist/services/authenticationOAuth2Consumer/iam.authenticationOAuth2Consumer.service.js +69 -0
- package/dist/services/authenticationOAuth2Consumer/iam.authenticationOAuth2Consumer.service.js.map +1 -0
- package/dist/services/authenticationOAuth2Consumer/index.d.ts +2 -0
- package/dist/services/authenticationOAuth2Consumer/index.js +19 -0
- package/dist/services/authenticationOAuth2Consumer/index.js.map +1 -0
- package/dist/services/authenticationPassthrough/iam.authenticationPassthrough.definitions.d.ts +14 -0
- package/dist/services/authenticationPassthrough/iam.authenticationPassthrough.definitions.js +3 -0
- package/dist/services/authenticationPassthrough/iam.authenticationPassthrough.definitions.js.map +1 -0
- package/dist/services/authenticationPassthrough/iam.authenticationPassthrough.service.d.ts +9 -0
- package/dist/services/authenticationPassthrough/iam.authenticationPassthrough.service.js +70 -0
- package/dist/services/authenticationPassthrough/iam.authenticationPassthrough.service.js.map +1 -0
- package/dist/services/authenticationPassthrough/index.d.ts +2 -0
- package/dist/services/authenticationPassthrough/index.js +19 -0
- package/dist/services/authenticationPassthrough/index.js.map +1 -0
- package/dist/services/authenticationPassthroughConsumer/iam.authenticationPassthroughConsumer.definitions.d.ts +18 -0
- package/dist/services/authenticationPassthroughConsumer/iam.authenticationPassthroughConsumer.definitions.js +3 -0
- package/dist/services/authenticationPassthroughConsumer/iam.authenticationPassthroughConsumer.definitions.js.map +1 -0
- package/dist/services/authenticationPassthroughConsumer/iam.authenticationPassthroughConsumer.service.d.ts +10 -0
- package/dist/services/authenticationPassthroughConsumer/iam.authenticationPassthroughConsumer.service.js +68 -0
- package/dist/services/authenticationPassthroughConsumer/iam.authenticationPassthroughConsumer.service.js.map +1 -0
- package/dist/services/authenticationPassthroughConsumer/index.d.ts +2 -0
- package/dist/services/authenticationPassthroughConsumer/index.js +19 -0
- package/dist/services/authenticationPassthroughConsumer/index.js.map +1 -0
- package/dist/services/authenticationUserLocal/iam.authenticationUserLocal.definitions.d.ts +2 -2
- package/dist/services/authenticationUserLocal/iam.authenticationUserLocal.service.d.ts +2 -6
- package/dist/services/authenticationUserLocal/iam.authenticationUserLocal.service.js +4 -8
- package/dist/services/authenticationUserLocal/iam.authenticationUserLocal.service.js.map +1 -1
- package/dist/services/authenticationUserLocalConsumer/iam.authenticationUserLocalConsumer.definitions.d.ts +8 -0
- package/dist/services/authenticationUserLocalConsumer/iam.authenticationUserLocalConsumer.definitions.js +3 -0
- package/dist/services/authenticationUserLocalConsumer/iam.authenticationUserLocalConsumer.definitions.js.map +1 -0
- package/dist/services/authenticationUserLocalConsumer/iam.authenticationUserLocalConsumer.service.d.ts +8 -0
- package/dist/services/authenticationUserLocalConsumer/iam.authenticationUserLocalConsumer.service.js +36 -0
- package/dist/services/authenticationUserLocalConsumer/iam.authenticationUserLocalConsumer.service.js.map +1 -0
- package/dist/services/authenticationUserLocalConsumer/index.d.ts +2 -0
- package/dist/services/authenticationUserLocalConsumer/index.js +19 -0
- package/dist/services/authenticationUserLocalConsumer/index.js.map +1 -0
- package/dist/services/authorization/iam.authorization.definitions.d.ts +24 -24
- package/dist/services/authorization/iam.authorization.definitions.js +7 -7
- package/dist/services/authorization/iam.authorization.definitions.js.map +1 -1
- package/dist/services/authorization/iam.authorization.service.d.ts +8 -11
- package/dist/services/authorization/iam.authorization.service.js +26 -30
- package/dist/services/authorization/iam.authorization.service.js.map +1 -1
- package/dist/services/index.d.ts +7 -1
- package/dist/services/index.js +7 -1
- package/dist/services/index.js.map +1 -1
- package/dist/services/tokenManager/iam.tokenManager.definitions.d.ts +4 -1
- package/dist/services/tokenManager/iam.tokenManager.definitions.js.map +1 -1
- package/dist/services/tokenManager/iam.tokenManager.service.d.ts +2 -2
- package/dist/services/tokenManager/iam.tokenManager.service.js +73 -35
- package/dist/services/tokenManager/iam.tokenManager.service.js.map +1 -1
- package/dist/services/users/index.d.ts +2 -0
- package/dist/services/{userManager → users}/index.js +2 -2
- package/dist/services/users/index.js.map +1 -0
- package/dist/services/users/users.definitions.d.ts +7 -0
- package/dist/services/users/users.definitions.js +3 -0
- package/dist/services/users/users.definitions.js.map +1 -0
- package/dist/services/users/users.service.d.ts +6 -0
- package/dist/services/users/users.service.js +39 -0
- package/dist/services/users/users.service.js.map +1 -0
- package/package.json +2 -2
- package/src/common/definitions/common.constants.ts +13 -16
- package/src/services/authentication/iam.authentication.definitions.ts +11 -4
- package/src/services/authentication/iam.authentication.service.ts +79 -15
- package/src/services/authenticationConsumer/iam.authenticationConsumer.definitions.ts +43 -0
- package/src/services/authenticationConsumer/iam.authenticationConsumer.service.ts +192 -0
- package/src/services/authenticationConsumer/index.ts +2 -0
- package/src/services/{userManager/iam.userManager.definitions.ts → authenticationManager/iam.authenticationManager.definitions.ts} +11 -19
- package/src/services/{userManager/iam.userManager.service.ts → authenticationManager/iam.authenticationManager.service.ts} +174 -111
- package/src/services/authenticationManager/index.ts +2 -0
- package/src/services/authenticationOAuth2/iam.authenticationOAuth2.definitions.ts +6 -3
- package/src/services/authenticationOAuth2/iam.authenticationOAuth2.service.ts +97 -85
- package/src/services/authenticationOAuth2Consumer/iam.authenticationOAuth2Consumer.definitions.ts +56 -0
- package/src/services/authenticationOAuth2Consumer/iam.authenticationOAuth2Consumer.service.ts +93 -0
- package/src/services/authenticationOAuth2Consumer/index.ts +2 -0
- package/src/services/authenticationPassthrough/iam.authenticationPassthrough.definitions.ts +32 -0
- package/src/services/authenticationPassthrough/iam.authenticationPassthrough.service.ts +100 -0
- package/src/services/authenticationPassthrough/index.ts +2 -0
- package/src/services/authenticationPassthroughConsumer/iam.authenticationPassthroughConsumer.definitions.ts +52 -0
- package/src/services/authenticationPassthroughConsumer/iam.authenticationPassthroughConsumer.service.ts +96 -0
- package/src/services/authenticationPassthroughConsumer/index.ts +2 -0
- package/src/services/authenticationUserLocal/iam.authenticationUserLocal.definitions.ts +3 -3
- package/src/services/authenticationUserLocal/iam.authenticationUserLocal.service.ts +17 -12
- package/src/services/authenticationUserLocalConsumer/iam.authenticationUserLocalConsumer.definitions.ts +29 -0
- package/src/services/authenticationUserLocalConsumer/iam.authenticationUserLocalConsumer.service.ts +40 -0
- package/src/services/authenticationUserLocalConsumer/index.ts +2 -0
- package/src/services/authorization/iam.authorization.definitions.ts +26 -27
- package/src/services/authorization/iam.authorization.service.ts +40 -65
- package/src/services/index.ts +7 -1
- package/src/services/tokenManager/iam.tokenManager.definitions.ts +4 -1
- package/src/services/tokenManager/iam.tokenManager.service.ts +98 -45
- package/src/services/users/index.ts +2 -0
- package/src/services/users/users.definitions.ts +11 -0
- package/src/services/users/users.service.ts +46 -0
- package/dist/services/userManager/iam.userManager.definitions.js +0 -8
- package/dist/services/userManager/iam.userManager.definitions.js.map +0 -1
- package/dist/services/userManager/iam.userManager.service.d.ts +0 -33
- package/dist/services/userManager/iam.userManager.service.js.map +0 -1
- package/dist/services/userManager/index.d.ts +0 -2
- package/dist/services/userManager/index.js.map +0 -1
- package/src/services/userManager/index.ts +0 -2
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
httpRequest
|
|
12
12
|
} from '@node-c/core';
|
|
13
13
|
|
|
14
|
-
import * as jwt from 'jsonwebtoken';
|
|
15
14
|
import ld from 'lodash';
|
|
16
15
|
|
|
17
16
|
import {
|
|
@@ -21,7 +20,7 @@ import {
|
|
|
21
20
|
IAMAuthenticationOAuth2CompleteResult,
|
|
22
21
|
IAMAuthenticationOAuth2GetPayloadsFromExternalTokensData,
|
|
23
22
|
IAMAuthenticationOAuth2GetPayloadsFromExternalTokensResult,
|
|
24
|
-
|
|
23
|
+
IAMAuthenticationOAuth2GetUserAuthenticationConfigResult,
|
|
25
24
|
IAMAuthenticationOAuth2InitiateData,
|
|
26
25
|
IAMAuthenticationOAuth2InitiateOptions,
|
|
27
26
|
IAMAuthenticationOAuth2InitiateResult,
|
|
@@ -32,44 +31,53 @@ import {
|
|
|
32
31
|
import { Constants } from '../../common/definitions';
|
|
33
32
|
import { IAMAuthenticationService } from '../authentication';
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
// TODO: provider param name mapping, in case a specific provider has custom parameter names
|
|
35
|
+
// TODO: validate access_token flow - endpont
|
|
36
|
+
// TODO: refresh access_token flow - local (JWT), endpont
|
|
37
|
+
// TODO: move the verifyToken method to the base authentication service.
|
|
38
|
+
/**
|
|
39
|
+
* This service is meant to support the OAuth2.0 flow w/ a PKCE challenge. The default, non-PKCE flow is intentionally not supported, in preparation for the upcoming OAuth2.0 spec.
|
|
40
|
+
*
|
|
37
41
|
* The default case assumes the user is found based on the decoded access token content after the complete method, but these settings can be overwritten in the config for the authService.
|
|
42
|
+
*
|
|
43
|
+
* This service is intended for use by the provider environment.
|
|
44
|
+
*
|
|
38
45
|
* 1. IAMAuthenticationOAuth2Service.initiate
|
|
46
|
+
*
|
|
39
47
|
* 2. (outside of this service) Save the challenge, verifier and state in the data, linking it to the provided user.
|
|
48
|
+
*
|
|
40
49
|
* 3. (outside of this service) Send an authorization code request on the prvodied URL to the OAuth2.0 provider.
|
|
50
|
+
*
|
|
41
51
|
* 4. (outside of this service) Receive a response with the state and an authorization code.
|
|
52
|
+
*
|
|
42
53
|
* 5. (outside of this service) Find the previously saved data for the user based on the state and send it to this service, along with the repsonse data.
|
|
54
|
+
*
|
|
43
55
|
* 6. IAMAuthenticationOAuth2Service.complete
|
|
56
|
+
*
|
|
44
57
|
* 7. (outside this service) Generate a local access & refresh JWT pair with the same expiry time as the provider tokens.
|
|
58
|
+
*
|
|
45
59
|
* 8. (outside this service) Save the provider's access token and (refersh or ID) tokens in the data along with the JWTs, linking them to the user.
|
|
46
|
-
* *
|
|
47
|
-
* TODO: provider param name mapping, in case a specific provider has custom parameter names
|
|
48
|
-
* TODO: validate access_token flow - endpont
|
|
49
|
-
* TODO: refresh access_token flow - local (JWT), endpont
|
|
50
60
|
*/
|
|
51
61
|
export class IAMAuthenticationOAuth2Service<
|
|
52
62
|
CompleteContext extends object,
|
|
53
63
|
InitiateContext extends object
|
|
54
64
|
> extends IAMAuthenticationService<CompleteContext, InitiateContext> {
|
|
55
|
-
constructor(
|
|
56
|
-
|
|
57
|
-
protected logger: LoggerService,
|
|
58
|
-
protected moduleName: string,
|
|
59
|
-
// eslint-disable-next-line no-unused-vars
|
|
60
|
-
protected serviceName: string
|
|
61
|
-
) {
|
|
62
|
-
super(configProvider, logger, moduleName);
|
|
65
|
+
constructor(configProvider: ConfigProviderService, logger: LoggerService, moduleName: string, serviceName: string) {
|
|
66
|
+
super(configProvider, logger, moduleName, serviceName);
|
|
63
67
|
this.isLocal = false;
|
|
64
68
|
}
|
|
65
69
|
|
|
66
|
-
|
|
70
|
+
// TODO: the custom param mapping will potentially be needed here.
|
|
71
|
+
/**
|
|
67
72
|
* 6. IAMAuthenticationOAuth2Service.complete:
|
|
73
|
+
*
|
|
68
74
|
* Incoming for the http redirect - state & code
|
|
75
|
+
*
|
|
69
76
|
* 6.1. Send an access token request to the provider using the following params: grant_type=authorization_code, client_id, client_secret, redirect_uri, code, code_verifier.
|
|
77
|
+
*
|
|
70
78
|
* 6.2. Receive the access and refresh tokens - expires_in, access_token, scope, refresh_token OR id_token (OIDC only).
|
|
79
|
+
*
|
|
71
80
|
* 6.3. Return the access and (refresh or ID) tokens.
|
|
72
|
-
* TODO: the custom param mapping will potentially be needed here.
|
|
73
81
|
*/
|
|
74
82
|
async complete(
|
|
75
83
|
data: IAMAuthenticationOAuth2CompleteData,
|
|
@@ -78,17 +86,37 @@ export class IAMAuthenticationOAuth2Service<
|
|
|
78
86
|
): Promise<IAMAuthenticationOAuth2CompleteResult> {
|
|
79
87
|
const { configProvider, logger, moduleName, serviceName } = this;
|
|
80
88
|
const moduleConfig = configProvider.config.domain[moduleName] as AppConfigDomainIAM;
|
|
81
|
-
const {
|
|
82
|
-
|
|
89
|
+
const {
|
|
90
|
+
accessTokenGrantUrl,
|
|
91
|
+
allowedIncomingRedirectUris,
|
|
92
|
+
clientId,
|
|
93
|
+
clientSecret,
|
|
94
|
+
redirectUri: configRedirectUri
|
|
95
|
+
} = moduleConfig.authServiceSettings![serviceName].oauth2!;
|
|
96
|
+
const logsPrefix = `[${moduleName}][${serviceName}][complete]`;
|
|
83
97
|
if (!accessTokenGrantUrl) {
|
|
84
|
-
logger.error(
|
|
98
|
+
logger.error(`${logsPrefix}: Access token grant URL not configured.`);
|
|
85
99
|
throw new ApplicationError('Authentication failed.');
|
|
86
100
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
101
|
+
const { code, codeVerifier, redirectUri: incomingRedirectUri } = data;
|
|
102
|
+
let redirectUri: string | undefined;
|
|
103
|
+
if (incomingRedirectUri) {
|
|
104
|
+
if (!allowedIncomingRedirectUris) {
|
|
105
|
+
logger.error(`${logsPrefix}: Allowed incoming Redirect URIs not configured.`);
|
|
106
|
+
throw new ApplicationError('Authentication failed.');
|
|
107
|
+
}
|
|
108
|
+
if (!allowedIncomingRedirectUris.includes(incomingRedirectUri)) {
|
|
109
|
+
logger.error(`${logsPrefix}: Incoming redirect URI ${incomingRedirectUri} is not allowed.`);
|
|
110
|
+
throw new ApplicationError('Authentication failed.');
|
|
111
|
+
}
|
|
112
|
+
redirectUri = incomingRedirectUri;
|
|
113
|
+
} else {
|
|
114
|
+
if (!configRedirectUri) {
|
|
115
|
+
logger.error(`${logsPrefix}: Redirect URI not configured.`);
|
|
116
|
+
throw new ApplicationError('Authentication failed.');
|
|
117
|
+
}
|
|
118
|
+
redirectUri = configRedirectUri;
|
|
90
119
|
}
|
|
91
|
-
const { code, codeVerifier } = data;
|
|
92
120
|
const { data: providerResponseData, hasError } =
|
|
93
121
|
await httpRequest<IAMAuthenticationOAuth2AccessTokenProviderResponseData>(accessTokenGrantUrl, {
|
|
94
122
|
body: {
|
|
@@ -103,10 +131,7 @@ export class IAMAuthenticationOAuth2Service<
|
|
|
103
131
|
method: HttpMethod.POST
|
|
104
132
|
});
|
|
105
133
|
if (hasError || !providerResponseData) {
|
|
106
|
-
logger.error(
|
|
107
|
-
`[${moduleName}][${serviceName}]: Auhorization grant attempt failed for code "${code}".`,
|
|
108
|
-
providerResponseData
|
|
109
|
-
);
|
|
134
|
+
logger.error(`${logsPrefix}: Auhorization grant attempt failed for code "${code}".`, providerResponseData);
|
|
110
135
|
throw new ApplicationError('Authentication failed.');
|
|
111
136
|
}
|
|
112
137
|
return {
|
|
@@ -163,11 +188,11 @@ export class IAMAuthenticationOAuth2Service<
|
|
|
163
188
|
}
|
|
164
189
|
|
|
165
190
|
// Default config - plain OAuth2 without OIDC
|
|
166
|
-
|
|
191
|
+
getUserAuthenticationConfig(): IAMAuthenticationOAuth2GetUserAuthenticationConfigResult {
|
|
167
192
|
const { configProvider, moduleName, serviceName } = this;
|
|
168
193
|
const moduleConfig = configProvider.config.domain[moduleName] as AppConfigDomainIAM;
|
|
169
194
|
const { steps } = moduleConfig.authServiceSettings![serviceName];
|
|
170
|
-
const defaultConfig:
|
|
195
|
+
const defaultConfig: IAMAuthenticationOAuth2GetUserAuthenticationConfigResult = {
|
|
171
196
|
[AppConfigDomainIAMAuthenticationStep.Complete]: {
|
|
172
197
|
cache: {
|
|
173
198
|
settings: {
|
|
@@ -192,7 +217,10 @@ export class IAMAuthenticationOAuth2Service<
|
|
|
192
217
|
[AppConfigDomainIAMAuthenticationStep.Initiate]: {
|
|
193
218
|
cache: {
|
|
194
219
|
populate: {
|
|
195
|
-
data: [
|
|
220
|
+
data: [
|
|
221
|
+
{ cacheFieldName: 'codeVerifier', inputFieldName: 'result.codeVerifier' },
|
|
222
|
+
{ cacheFieldName: 'redirectUri', inputFieldName: 'result.redirectUri' }
|
|
223
|
+
]
|
|
196
224
|
},
|
|
197
225
|
settings: {
|
|
198
226
|
cacheFieldName: 'state',
|
|
@@ -207,15 +235,20 @@ export class IAMAuthenticationOAuth2Service<
|
|
|
207
235
|
return ld.merge(defaultConfig, steps || {});
|
|
208
236
|
}
|
|
209
237
|
|
|
210
|
-
|
|
238
|
+
// TODO: the custom param mapping will potentially be needed here.
|
|
239
|
+
/**
|
|
211
240
|
* OAuth2.0 flow w/ a PKCE challenge:
|
|
212
241
|
* 1. IAMAuthenticationOAuth2Service.initiate
|
|
242
|
+
*
|
|
213
243
|
* 1.1. Generate a PKCE code, code verifier for it and PKCE challenge based on them.
|
|
244
|
+
*
|
|
214
245
|
* 1.2. Generate a unique random "state" and a unique random "nonce" (for OIDC only, optional).
|
|
246
|
+
*
|
|
215
247
|
* 1.3. Generate an authorization code request URL. This URL contains the response_type=code, client_id, code_challenge, code_challenge_method, nonce, state, redirect_uri and scope. The code_challenge_method is usually S256.
|
|
248
|
+
*
|
|
216
249
|
* 1.4. Return the code, verifier, challenge, nonce, state and the URL.
|
|
250
|
+
*
|
|
217
251
|
* In this method, the only difference between the default OAuth2.0 flow and OIDC is that OIDC requires scope=oidc.
|
|
218
|
-
* TODO: the custom param mapping will potentially be needed here.
|
|
219
252
|
*/
|
|
220
253
|
async initiate(
|
|
221
254
|
data: IAMAuthenticationOAuth2InitiateData,
|
|
@@ -223,23 +256,42 @@ export class IAMAuthenticationOAuth2Service<
|
|
|
223
256
|
): Promise<IAMAuthenticationOAuth2InitiateResult> {
|
|
224
257
|
const { configProvider, logger, moduleName, serviceName } = this;
|
|
225
258
|
const moduleConfig = configProvider.config.domain[moduleName] as AppConfigDomainIAM;
|
|
226
|
-
const {
|
|
227
|
-
|
|
228
|
-
|
|
259
|
+
const {
|
|
260
|
+
allowedIncomingRedirectUris,
|
|
261
|
+
authorizationUrl,
|
|
262
|
+
clientId,
|
|
263
|
+
codeChallengeMethod,
|
|
264
|
+
defaultScope,
|
|
265
|
+
redirectUri: configRedirectUri
|
|
266
|
+
} = moduleConfig.authServiceSettings![serviceName].oauth2!;
|
|
267
|
+
const { redirectUri: incomingRedirectUri, scope } = data;
|
|
229
268
|
const { generateNonce, withPCKE } = options;
|
|
230
269
|
const finalScope = scope || defaultScope;
|
|
270
|
+
const logsPrefix = `[${moduleName}][${serviceName}][initiate]`;
|
|
271
|
+
let redirectUri: string | undefined;
|
|
231
272
|
if (!authorizationUrl) {
|
|
232
|
-
logger.error(
|
|
273
|
+
logger.error(`${logsPrefix}: Authorization URL not configured.`);
|
|
233
274
|
throw new ApplicationError('Authentication failed.');
|
|
234
275
|
}
|
|
235
|
-
if (
|
|
236
|
-
|
|
237
|
-
|
|
276
|
+
if (incomingRedirectUri) {
|
|
277
|
+
if (!allowedIncomingRedirectUris) {
|
|
278
|
+
logger.error(`${logsPrefix}: Allowed incoming Redirect URIs not configured.`);
|
|
279
|
+
throw new ApplicationError('Authentication failed.');
|
|
280
|
+
}
|
|
281
|
+
if (!allowedIncomingRedirectUris.includes(incomingRedirectUri)) {
|
|
282
|
+
logger.error(`${logsPrefix}: Incoming redirect URI ${incomingRedirectUri} is not allowed.`);
|
|
283
|
+
throw new ApplicationError('Authentication failed.');
|
|
284
|
+
}
|
|
285
|
+
redirectUri = incomingRedirectUri;
|
|
286
|
+
} else {
|
|
287
|
+
if (!configRedirectUri) {
|
|
288
|
+
logger.error(`${logsPrefix}: Redirect URI not configured.`);
|
|
289
|
+
throw new ApplicationError('Authentication failed.');
|
|
290
|
+
}
|
|
291
|
+
redirectUri = configRedirectUri;
|
|
238
292
|
}
|
|
239
293
|
if (!finalScope) {
|
|
240
|
-
logger.error(
|
|
241
|
-
`[${moduleName}][${serviceName}]: Either a scope in thwe input, or a configured default scope, is required..`
|
|
242
|
-
);
|
|
294
|
+
logger.error(`${logsPrefix}: Either a scope in thwe input, or a configured default scope, is required..`);
|
|
243
295
|
throw new ApplicationError('Authentication failed.');
|
|
244
296
|
}
|
|
245
297
|
const state = this.generateUrlEncodedString(16);
|
|
@@ -269,6 +321,7 @@ export class IAMAuthenticationOAuth2Service<
|
|
|
269
321
|
mfaUsed: true,
|
|
270
322
|
mfaValid: true,
|
|
271
323
|
nonce,
|
|
324
|
+
redirectUri,
|
|
272
325
|
state,
|
|
273
326
|
valid: true
|
|
274
327
|
};
|
|
@@ -308,45 +361,4 @@ export class IAMAuthenticationOAuth2Service<
|
|
|
308
361
|
`[${moduleName}][${serviceName}]: In method "verifyExternalAccessToken": verification via external endpoint not configured.`
|
|
309
362
|
);
|
|
310
363
|
}
|
|
311
|
-
|
|
312
|
-
protected async verifyToken<DecodedTokenContent = unknown>(
|
|
313
|
-
token: string,
|
|
314
|
-
options?: { audiences?: string[]; issuer?: string; secret?: string }
|
|
315
|
-
): Promise<{ content?: DecodedTokenContent; error?: unknown }> {
|
|
316
|
-
const { audiences, issuer, secret } = options || {};
|
|
317
|
-
let returnData: { content?: DecodedTokenContent; error?: unknown } = {};
|
|
318
|
-
if (secret) {
|
|
319
|
-
returnData = await new Promise<{ content?: DecodedTokenContent; error?: unknown }>(resolve => {
|
|
320
|
-
jwt.verify(token, secret, (err, decoded) => {
|
|
321
|
-
if (err) {
|
|
322
|
-
resolve({ content: decoded as DecodedTokenContent, error: err });
|
|
323
|
-
}
|
|
324
|
-
resolve({ content: decoded as DecodedTokenContent });
|
|
325
|
-
});
|
|
326
|
-
});
|
|
327
|
-
} else {
|
|
328
|
-
const tokenContent = jwt.decode(token) as DecodedTokenContent & { aud?: string; exp?: number; iss?: string };
|
|
329
|
-
if (tokenContent.exp) {
|
|
330
|
-
// tokenContent.exp < new Date().valueOf()
|
|
331
|
-
let currentTimeStamp = `${new Date().valueOf()}`;
|
|
332
|
-
let expString = `${tokenContent.exp}`;
|
|
333
|
-
if (expString.length < currentTimeStamp.length) {
|
|
334
|
-
currentTimeStamp = currentTimeStamp.substring(0, expString.length);
|
|
335
|
-
} else if (expString.length > currentTimeStamp.length) {
|
|
336
|
-
expString = expString.substring(0, currentTimeStamp.length);
|
|
337
|
-
}
|
|
338
|
-
if (parseInt(expString, 10) < parseInt(currentTimeStamp, 10)) {
|
|
339
|
-
returnData.error = Constants.TOKEN_EXPIRED_ERROR;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
if (tokenContent.aud && audiences && !audiences.includes(tokenContent.aud)) {
|
|
343
|
-
returnData.error = Constants.TOKEN_MISMATCHED_AUDIENCES_ERROR;
|
|
344
|
-
}
|
|
345
|
-
if (tokenContent.iss && issuer && issuer !== tokenContent.iss) {
|
|
346
|
-
returnData.error = Constants.TOKEN_MISMATCHED_ISSUER_ERROR;
|
|
347
|
-
}
|
|
348
|
-
returnData.content = tokenContent;
|
|
349
|
-
}
|
|
350
|
-
return returnData;
|
|
351
|
-
}
|
|
352
364
|
}
|
package/src/services/authenticationOAuth2Consumer/iam.authenticationOAuth2Consumer.definitions.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IAMAuthenticationRefreshExternalAccessTokenData,
|
|
3
|
+
IAMAuthenticationRefreshExternalAccessTokenResult
|
|
4
|
+
} from '../authentication';
|
|
5
|
+
import {
|
|
6
|
+
IAMAuthenticationConsumerCompleteResult,
|
|
7
|
+
IAMAuthenticationConsumerGetUserAuthenticationConfigResult,
|
|
8
|
+
IAMAuthenticationConsumerInitiateResult,
|
|
9
|
+
IAMAuthenticationConsumerRefreshExternalAccessTokenResult
|
|
10
|
+
} from '../authenticationConsumer';
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
IAMAuthenticationOAuth2CompleteData,
|
|
14
|
+
IAMAuthenticationOAuth2CompleteOptions,
|
|
15
|
+
IAMAuthenticationOAuth2CompleteResult,
|
|
16
|
+
IAMAuthenticationOAuth2InitiateData,
|
|
17
|
+
IAMAuthenticationOAuth2InitiateOptions,
|
|
18
|
+
IAMAuthenticationOAuth2InitiateResult,
|
|
19
|
+
IAMAuthenticationOAuth2VerifyExternalAccessTokenData,
|
|
20
|
+
IAMAuthenticationOAuth2VerifyExternalAccessTokenResult
|
|
21
|
+
} from '../authenticationOAuth2';
|
|
22
|
+
|
|
23
|
+
export type IAMAuthenticationOAuth2ConsumerCompleteData = IAMAuthenticationOAuth2CompleteData;
|
|
24
|
+
|
|
25
|
+
export type IAMAuthenticationOAuth2ConsumerCompleteOptions<Context extends object> =
|
|
26
|
+
IAMAuthenticationOAuth2CompleteOptions<Context>;
|
|
27
|
+
|
|
28
|
+
export type IAMAuthenticationOAuth2ConsumerCompleteResult = IAMAuthenticationOAuth2CompleteResult &
|
|
29
|
+
IAMAuthenticationConsumerCompleteResult & {
|
|
30
|
+
idToken?: string;
|
|
31
|
+
refreshToken?: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type IAMAuthenticationOAuth2ConsumerGetUserAuthenticationConfigResult =
|
|
35
|
+
IAMAuthenticationConsumerGetUserAuthenticationConfigResult;
|
|
36
|
+
|
|
37
|
+
export interface IAMAuthenticationOAuth2ConsumerInitiateData extends IAMAuthenticationOAuth2InitiateData {
|
|
38
|
+
scope: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type IAMAuthenticationOAuth2ConsumerInitiateOptions<Context extends object> =
|
|
42
|
+
IAMAuthenticationOAuth2InitiateOptions<Context>;
|
|
43
|
+
|
|
44
|
+
export type IAMAuthenticationOAuth2ConsumerInitiateResult = IAMAuthenticationOAuth2InitiateResult &
|
|
45
|
+
IAMAuthenticationConsumerInitiateResult;
|
|
46
|
+
|
|
47
|
+
export type IAMAuthenticationOAuth2ConsumerRefreshExternalAccessTokenData =
|
|
48
|
+
IAMAuthenticationRefreshExternalAccessTokenData;
|
|
49
|
+
export type IAMAuthenticationOAuth2ConsumerRefreshExternalAccessTokenResult =
|
|
50
|
+
IAMAuthenticationRefreshExternalAccessTokenResult & IAMAuthenticationConsumerRefreshExternalAccessTokenResult;
|
|
51
|
+
|
|
52
|
+
export type IAMAuthenticationOAuth2ConsumerVerifyExternalAccessTokenData =
|
|
53
|
+
IAMAuthenticationOAuth2VerifyExternalAccessTokenData;
|
|
54
|
+
|
|
55
|
+
export type IAMAuthenticationOAuth2ConsumerVerifyExternalAccessTokenResult =
|
|
56
|
+
IAMAuthenticationOAuth2VerifyExternalAccessTokenResult;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AppConfigDomainIAM,
|
|
3
|
+
AppConfigDomainIAMAuthenticationStep,
|
|
4
|
+
ConfigProviderService,
|
|
5
|
+
LoggerService
|
|
6
|
+
} from '@node-c/core';
|
|
7
|
+
|
|
8
|
+
import ld from 'lodash';
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
IAMAuthenticationOAuth2ConsumerCompleteData,
|
|
12
|
+
IAMAuthenticationOAuth2ConsumerCompleteOptions,
|
|
13
|
+
IAMAuthenticationOAuth2ConsumerCompleteResult,
|
|
14
|
+
IAMAuthenticationOAuth2ConsumerGetUserAuthenticationConfigResult,
|
|
15
|
+
IAMAuthenticationOAuth2ConsumerInitiateData,
|
|
16
|
+
IAMAuthenticationOAuth2ConsumerInitiateOptions,
|
|
17
|
+
IAMAuthenticationOAuth2ConsumerInitiateResult,
|
|
18
|
+
IAMAuthenticationOAuth2ConsumerRefreshExternalAccessTokenData,
|
|
19
|
+
IAMAuthenticationOAuth2ConsumerRefreshExternalAccessTokenResult,
|
|
20
|
+
IAMAuthenticationOAuth2ConsumerVerifyExternalAccessTokenData,
|
|
21
|
+
IAMAuthenticationOAuth2ConsumerVerifyExternalAccessTokenResult
|
|
22
|
+
} from './iam.authenticationOAuth2Consumer.definitions';
|
|
23
|
+
|
|
24
|
+
import { IAMAuthenticationConsumerService } from '../authenticationConsumer';
|
|
25
|
+
import { IAMAuthenticationOAuth2Service } from '../authenticationOAuth2';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A service for integrating OAuth2 via other Node-C Apps as a consumer.
|
|
29
|
+
*
|
|
30
|
+
* This service is intended for use by the consumer environment.
|
|
31
|
+
*/
|
|
32
|
+
export class IAMAuthenticationOAuth2ConsumerService<
|
|
33
|
+
CompleteContext extends object,
|
|
34
|
+
InitiateContext extends object
|
|
35
|
+
> extends IAMAuthenticationConsumerService<CompleteContext, InitiateContext> {
|
|
36
|
+
constructor(configProvider: ConfigProviderService, logger: LoggerService, moduleName: string, serviceName: string) {
|
|
37
|
+
super(configProvider, logger, moduleName, serviceName);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async complete(
|
|
41
|
+
data: IAMAuthenticationOAuth2ConsumerCompleteData,
|
|
42
|
+
options: IAMAuthenticationOAuth2ConsumerCompleteOptions<CompleteContext>
|
|
43
|
+
): Promise<IAMAuthenticationOAuth2ConsumerCompleteResult> {
|
|
44
|
+
return super.complete(data, options) as Promise<IAMAuthenticationOAuth2ConsumerCompleteResult>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
getUserAuthenticationConfig(): IAMAuthenticationOAuth2ConsumerGetUserAuthenticationConfigResult {
|
|
48
|
+
const configFromParent = super.getUserAuthenticationConfig();
|
|
49
|
+
const { configProvider, moduleName, serviceName } = this;
|
|
50
|
+
const moduleConfig = configProvider.config.domain[moduleName] as AppConfigDomainIAM;
|
|
51
|
+
const { steps } = moduleConfig.authServiceSettings![serviceName];
|
|
52
|
+
return ld.merge(
|
|
53
|
+
configFromParent,
|
|
54
|
+
{
|
|
55
|
+
[AppConfigDomainIAMAuthenticationStep.Initiate]: {
|
|
56
|
+
stepResultPublicFields: ['authorizationCodeRequestURL']
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
steps || {}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async initiate(
|
|
64
|
+
data: IAMAuthenticationOAuth2ConsumerInitiateData,
|
|
65
|
+
options: IAMAuthenticationOAuth2ConsumerInitiateOptions<InitiateContext>
|
|
66
|
+
): Promise<IAMAuthenticationOAuth2ConsumerInitiateResult> {
|
|
67
|
+
const { configProvider, moduleName, serviceName } = this;
|
|
68
|
+
const moduleConfig = configProvider.config.domain[moduleName] as AppConfigDomainIAM;
|
|
69
|
+
const { redirectUri } = moduleConfig.authServiceSettings![serviceName].oauth2!;
|
|
70
|
+
return super.initiate(
|
|
71
|
+
{
|
|
72
|
+
...data,
|
|
73
|
+
...(redirectUri ? { redirectUri } : {})
|
|
74
|
+
},
|
|
75
|
+
options
|
|
76
|
+
) as Promise<IAMAuthenticationOAuth2ConsumerInitiateResult>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async refreshExternalAccessToken(
|
|
80
|
+
data: IAMAuthenticationOAuth2ConsumerRefreshExternalAccessTokenData
|
|
81
|
+
): Promise<IAMAuthenticationOAuth2ConsumerRefreshExternalAccessTokenResult> {
|
|
82
|
+
return super.refreshExternalAccessToken(
|
|
83
|
+
data
|
|
84
|
+
) as Promise<IAMAuthenticationOAuth2ConsumerRefreshExternalAccessTokenResult>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// verifyExternalAccessToken from the OAuth2 service
|
|
88
|
+
async verifyExternalAccessToken(
|
|
89
|
+
data: IAMAuthenticationOAuth2ConsumerVerifyExternalAccessTokenData
|
|
90
|
+
): Promise<IAMAuthenticationOAuth2ConsumerVerifyExternalAccessTokenResult> {
|
|
91
|
+
return IAMAuthenticationOAuth2Service.prototype.verifyExternalAccessToken.call(this, data);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IAMAuthenticationCompleteData,
|
|
3
|
+
IAMAuthenticationCompleteOptions,
|
|
4
|
+
IAMAuthenticationCompleteResult,
|
|
5
|
+
IAMAuthenticationGetUserAuthenticationConfigResult,
|
|
6
|
+
IAMAuthenticationInitiateData,
|
|
7
|
+
IAMAuthenticationInitiateOptions,
|
|
8
|
+
IAMAuthenticationInitiateResult
|
|
9
|
+
} from '../authentication';
|
|
10
|
+
|
|
11
|
+
export type IAMAuthenticationPassthroughCompleteData = IAMAuthenticationCompleteData & {
|
|
12
|
+
externalAccessToken?: string;
|
|
13
|
+
externalAccessTokenExpiresIn?: number;
|
|
14
|
+
externalIdToken?: string;
|
|
15
|
+
externalRefreshToken?: string;
|
|
16
|
+
externalRefreshTokenExpiresIn?: number;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type IAMAuthenticationPassthroughCompleteOptions<Context extends object> =
|
|
20
|
+
IAMAuthenticationCompleteOptions<Context>;
|
|
21
|
+
|
|
22
|
+
export type IAMAuthenticationPassthroughCompleteResult = IAMAuthenticationCompleteResult;
|
|
23
|
+
|
|
24
|
+
export type IAMAuthenticationPassthroughGetUserAuthenticationConfigResult =
|
|
25
|
+
IAMAuthenticationGetUserAuthenticationConfigResult;
|
|
26
|
+
|
|
27
|
+
export type IAMAuthenticationPassthroughInitiateData = IAMAuthenticationInitiateData;
|
|
28
|
+
|
|
29
|
+
export type IAMAuthenticationPassthroughInitiateOptions<Context extends object> =
|
|
30
|
+
IAMAuthenticationInitiateOptions<Context>;
|
|
31
|
+
|
|
32
|
+
export type IAMAuthenticationPassthroughInitiateResult = IAMAuthenticationInitiateResult;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AppConfigDomainIAM,
|
|
3
|
+
AppConfigDomainIAMAuthenticationStep,
|
|
4
|
+
ConfigProviderService,
|
|
5
|
+
LoggerService
|
|
6
|
+
} from '@node-c/core';
|
|
7
|
+
|
|
8
|
+
import ld from 'lodash';
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
IAMAuthenticationPassthroughCompleteData,
|
|
12
|
+
IAMAuthenticationPassthroughCompleteOptions,
|
|
13
|
+
IAMAuthenticationPassthroughCompleteResult,
|
|
14
|
+
IAMAuthenticationPassthroughGetUserAuthenticationConfigResult,
|
|
15
|
+
IAMAuthenticationPassthroughInitiateData,
|
|
16
|
+
IAMAuthenticationPassthroughInitiateOptions,
|
|
17
|
+
IAMAuthenticationPassthroughInitiateResult
|
|
18
|
+
} from './iam.authenticationPassthrough.definitions';
|
|
19
|
+
|
|
20
|
+
import { IAMAuthenticationService } from '../authentication';
|
|
21
|
+
/**
|
|
22
|
+
* A service for skipping authentication in order to use the rest of the AuthenticationManager.authenticate functionality (passthrough).
|
|
23
|
+
*
|
|
24
|
+
* This service is intended for use by the provider environment.
|
|
25
|
+
*/
|
|
26
|
+
export class IAMAuthenticationPassthroughService<
|
|
27
|
+
CompleteContext extends object,
|
|
28
|
+
InitiateContext extends object
|
|
29
|
+
> extends IAMAuthenticationService<CompleteContext, InitiateContext> {
|
|
30
|
+
constructor(configProvider: ConfigProviderService, logger: LoggerService, moduleName: string, serviceName: string) {
|
|
31
|
+
super(configProvider, logger, moduleName, serviceName);
|
|
32
|
+
this.isLocal = true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async complete(
|
|
36
|
+
data: IAMAuthenticationPassthroughCompleteData,
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
38
|
+
_options: IAMAuthenticationPassthroughCompleteOptions<CompleteContext>
|
|
39
|
+
): Promise<IAMAuthenticationPassthroughCompleteResult> {
|
|
40
|
+
const returnData: IAMAuthenticationPassthroughCompleteResult = { mfaUsed: false, valid: true };
|
|
41
|
+
if (data.externalAccessToken) {
|
|
42
|
+
returnData.accessToken = data.externalAccessToken;
|
|
43
|
+
if (data.externalAccessTokenExpiresIn) {
|
|
44
|
+
returnData.accessTokenExpiresIn = data.externalAccessTokenExpiresIn;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (data.externalIdToken) {
|
|
48
|
+
returnData.idToken = data.externalIdToken;
|
|
49
|
+
}
|
|
50
|
+
if (data.externalRefreshToken) {
|
|
51
|
+
returnData.refreshToken = data.externalRefreshToken;
|
|
52
|
+
if (data.externalRefreshTokenExpiresIn) {
|
|
53
|
+
returnData.refreshTokenExpiresIn = data.externalRefreshTokenExpiresIn;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return returnData;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* This config is intended for use by the provider environment.
|
|
61
|
+
*
|
|
62
|
+
* User data from: provider
|
|
63
|
+
*
|
|
64
|
+
* Internal tokens from: provider
|
|
65
|
+
*
|
|
66
|
+
* External tokens from: consumer (optional)
|
|
67
|
+
*
|
|
68
|
+
* Authentication happens in: consumer
|
|
69
|
+
*/
|
|
70
|
+
getUserAuthenticationConfig(): IAMAuthenticationPassthroughGetUserAuthenticationConfigResult {
|
|
71
|
+
const { configProvider, moduleName, serviceName } = this;
|
|
72
|
+
const moduleConfig = configProvider.config.domain[moduleName] as AppConfigDomainIAM;
|
|
73
|
+
const { steps } = moduleConfig.authServiceSettings![serviceName];
|
|
74
|
+
const defaultConfig: IAMAuthenticationPassthroughGetUserAuthenticationConfigResult = {
|
|
75
|
+
// this step accepts the external access tokens (if any) from the authData in the step input
|
|
76
|
+
// and issues local tokens using that data
|
|
77
|
+
[AppConfigDomainIAMAuthenticationStep.Complete]: {
|
|
78
|
+
findUser: true,
|
|
79
|
+
findUserBeforeAuth: true,
|
|
80
|
+
validWithoutUser: false
|
|
81
|
+
},
|
|
82
|
+
// this step simply does nothing
|
|
83
|
+
[AppConfigDomainIAMAuthenticationStep.Initiate]: {
|
|
84
|
+
findUser: false,
|
|
85
|
+
findUserBeforeAuth: false,
|
|
86
|
+
validWithoutUser: true
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
return ld.merge(defaultConfig, steps || {});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async initiate(
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
94
|
+
_data: IAMAuthenticationPassthroughInitiateData,
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
96
|
+
_options: IAMAuthenticationPassthroughInitiateOptions<InitiateContext>
|
|
97
|
+
): Promise<IAMAuthenticationPassthroughInitiateResult> {
|
|
98
|
+
return { mfaUsed: false, valid: true };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IAMAuthenticationRefreshExternalAccessTokenData,
|
|
3
|
+
IAMAuthenticationRefreshExternalAccessTokenResult
|
|
4
|
+
} from '../authentication';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
IAMAuthenticationConsumerCompleteResult,
|
|
8
|
+
IAMAuthenticationConsumerGetUserAuthenticationConfigResult,
|
|
9
|
+
IAMAuthenticationConsumerInitiateResult
|
|
10
|
+
} from '../authenticationConsumer';
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
IAMAuthenticationPassthroughCompleteData,
|
|
14
|
+
IAMAuthenticationPassthroughCompleteOptions,
|
|
15
|
+
IAMAuthenticationPassthroughCompleteResult,
|
|
16
|
+
IAMAuthenticationPassthroughGetUserAuthenticationConfigResult,
|
|
17
|
+
IAMAuthenticationPassthroughInitiateData,
|
|
18
|
+
IAMAuthenticationPassthroughInitiateOptions,
|
|
19
|
+
IAMAuthenticationPassthroughInitiateResult
|
|
20
|
+
} from '../authenticationPassthrough';
|
|
21
|
+
|
|
22
|
+
export type IAMAuthenticationPassthroughConsumerCompleteData = IAMAuthenticationPassthroughCompleteData & {
|
|
23
|
+
externalAccessToken?: string;
|
|
24
|
+
externalAccessTokenExpiresIn?: number;
|
|
25
|
+
externalIdToken?: string;
|
|
26
|
+
externalRefreshToken?: string;
|
|
27
|
+
externalRefreshTokenExpiresIn?: number;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type IAMAuthenticationPassthroughConsumerCompleteOptions<Context extends object> =
|
|
31
|
+
IAMAuthenticationPassthroughCompleteOptions<Context>;
|
|
32
|
+
|
|
33
|
+
export type IAMAuthenticationPassthroughConsumerCompleteResult = IAMAuthenticationPassthroughCompleteResult &
|
|
34
|
+
IAMAuthenticationConsumerCompleteResult;
|
|
35
|
+
|
|
36
|
+
export type IAMAuthenticationPassthroughConsumerGetUserAuthenticationConfigResult =
|
|
37
|
+
IAMAuthenticationPassthroughGetUserAuthenticationConfigResult &
|
|
38
|
+
IAMAuthenticationConsumerGetUserAuthenticationConfigResult;
|
|
39
|
+
|
|
40
|
+
export type IAMAuthenticationPassthroughConsumerInitiateData = IAMAuthenticationPassthroughInitiateData;
|
|
41
|
+
|
|
42
|
+
export type IAMAuthenticationPassthroughConsumerInitiateOptions<Context extends object> =
|
|
43
|
+
IAMAuthenticationPassthroughInitiateOptions<Context>;
|
|
44
|
+
|
|
45
|
+
export type IAMAuthenticationPassthroughConsumerInitiateResult = IAMAuthenticationPassthroughInitiateResult &
|
|
46
|
+
IAMAuthenticationConsumerInitiateResult;
|
|
47
|
+
|
|
48
|
+
export type IAMAuthenticationPassthroughConsumerRefreshExternalAccessTokenData =
|
|
49
|
+
IAMAuthenticationRefreshExternalAccessTokenData;
|
|
50
|
+
|
|
51
|
+
export type IAMAuthenticationPassthroughConsumerRefreshExternalAccessTokenResult =
|
|
52
|
+
IAMAuthenticationRefreshExternalAccessTokenResult;
|