cidaas-javascript-sdk 4.3.3 → 5.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/CHANGELOG.md +40 -4
- package/README.md +156 -94
- package/dist/authentication-service/AuthenticationService.d.ts +140 -0
- package/dist/authentication-service/AuthenticationService.js +210 -0
- package/dist/{authentication/Authentication.model.d.ts → authentication-service/AuthenticationService.model.d.ts} +18 -12
- package/dist/{authentication/Authentication.model.js → authentication-service/AuthenticationService.model.js} +2 -2
- package/dist/common/Common.model.d.ts +15 -19
- package/dist/common/Common.model.js +17 -17
- package/dist/common/ConfigUserProvider.d.ts +10 -0
- package/dist/common/ConfigUserProvider.js +28 -0
- package/dist/common/Helper.d.ts +7 -0
- package/dist/common/Helper.js +19 -0
- package/dist/common/User.model.d.ts +0 -4
- package/dist/consent-service/ConsentService.d.ts +99 -95
- package/dist/consent-service/ConsentService.js +125 -122
- package/dist/consent-service/ConsentService.model.d.ts +14 -16
- package/dist/device-service/DeviceService.d.ts +49 -0
- package/dist/device-service/DeviceService.js +79 -0
- package/dist/device-service/DeviceService.model.d.ts +6 -0
- package/dist/id-validation-service/IdValidationService.d.ts +28 -0
- package/dist/id-validation-service/IdValidationService.js +59 -0
- package/dist/id-validation-service/IdValidationService.model.d.ts +8 -0
- package/dist/id-validation-service/IdValidationService.model.js +2 -0
- package/dist/index.d.ts +22 -3
- package/dist/index.js +35 -18
- package/dist/login-service/LoginService.d.ts +143 -141
- package/dist/login-service/LoginService.js +255 -232
- package/dist/login-service/LoginService.model.d.ts +9 -51
- package/dist/login-service/LoginService.model.js +1 -1
- package/dist/public-service/PublicService.d.ts +57 -0
- package/dist/public-service/PublicService.js +73 -0
- package/dist/public-service/PublicService.model.d.ts +20 -0
- package/dist/public-service/PublicService.model.js +2 -0
- package/dist/token-service/TokenService.d.ts +104 -138
- package/dist/token-service/TokenService.js +164 -219
- package/dist/token-service/TokenService.model.d.ts +3 -44
- package/dist/token-service/TokenService.model.js +3 -16
- package/dist/user-service/UserService.d.ts +381 -315
- package/dist/user-service/UserService.js +552 -426
- package/dist/user-service/UserService.model.d.ts +48 -14
- package/dist/user-service/UserService.model.js +4 -4
- package/dist/verification-service/VerificationService.d.ts +281 -223
- package/dist/verification-service/VerificationService.js +343 -287
- package/dist/verification-service/VerificationService.model.d.ts +4 -5
- package/package.json +6 -4
- package/dist/authentication/Authentication.d.ts +0 -139
- package/dist/authentication/Authentication.js +0 -186
- package/dist/web-auth/WebAuth.d.ts +0 -665
- package/dist/web-auth/WebAuth.js +0 -955
- package/dist/web-auth/webauth.model.d.ts +0 -66
- /package/dist/{web-auth/webauth.model.js → device-service/DeviceService.model.js} +0 -0
|
@@ -9,234 +9,179 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.TokenService = void 0;
|
|
13
13
|
const TokenService_model_1 = require("./TokenService.model");
|
|
14
14
|
const Helper_1 = require("../common/Helper");
|
|
15
15
|
const JwtHelper_1 = require("../common/JwtHelper");
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* ```js
|
|
21
|
-
* const options = {
|
|
22
|
-
* refresh_token: "your refresh token",
|
|
23
|
-
* }
|
|
24
|
-
*
|
|
25
|
-
* cidaas.renewToken(options)
|
|
26
|
-
* .then(function (response) {
|
|
27
|
-
* // type your code here
|
|
28
|
-
* })
|
|
29
|
-
* .catch(function (ex) {
|
|
30
|
-
* // your failure code here
|
|
31
|
-
* });
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
function renewToken(options) {
|
|
35
|
-
if (!options.refresh_token) {
|
|
36
|
-
throw new Helper_1.CustomException("refresh_token cannot be empty", 417);
|
|
16
|
+
class TokenService {
|
|
17
|
+
constructor(configUserProvider) {
|
|
18
|
+
this.config = configUserProvider.getConfig();
|
|
19
|
+
this.userManager = configUserProvider.getUserManager();
|
|
37
20
|
}
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const signInRequest = yield window.usermanager.getClient().createSigninRequest(window.webAuthSettings);
|
|
73
|
-
options.code_verifier = (_a = signInRequest.state) === null || _a === void 0 ? void 0 : _a.code_verifier;
|
|
74
|
-
}
|
|
75
|
-
const _serviceURL = window.webAuthSettings.authority + "/token-srv/token";
|
|
76
|
-
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
exports.getAccessToken = getAccessToken;
|
|
80
|
-
/**
|
|
81
|
-
* To validate an access token, call **validateAccessToken()**.
|
|
82
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/26ff31e2937f1-introspect-with-bearer-token for more details.
|
|
83
|
-
* @example
|
|
84
|
-
* ```js
|
|
85
|
-
* const options = {
|
|
86
|
-
* token: "your access token",
|
|
87
|
-
* token_type_hint: "accepted token type hints are access_token, id_token, refresh_token, sso",
|
|
88
|
-
* }
|
|
89
|
-
*
|
|
90
|
-
* cidaas.validateAccessToken(options)
|
|
91
|
-
* .then(function (response) {
|
|
92
|
-
* // type your code here
|
|
93
|
-
* })
|
|
94
|
-
* .catch(function (ex) {
|
|
95
|
-
* // your failure code here
|
|
96
|
-
* });
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
function validateAccessToken(options) {
|
|
100
|
-
if (!options.token) {
|
|
101
|
-
throw new Helper_1.CustomException("token cannot be empty", 417);
|
|
21
|
+
/**
|
|
22
|
+
* To generate token(s) with the grant type authorization_code, call **generateTokenFromCode()**
|
|
23
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/4ff850f48629a-generate-token for more details.
|
|
24
|
+
* @example
|
|
25
|
+
* ```js
|
|
26
|
+
* const options = {
|
|
27
|
+
* code: "your code to be exchanged with the token(s)",
|
|
28
|
+
* }
|
|
29
|
+
*
|
|
30
|
+
* cidaasTokenService.generateTokenFromCode(options)
|
|
31
|
+
* .then(function (response) {
|
|
32
|
+
* // type your code here
|
|
33
|
+
* })
|
|
34
|
+
* .catch(function (ex) {
|
|
35
|
+
* // your failure code here
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
generateTokenFromCode(options) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
var _a;
|
|
42
|
+
if (!options.code) {
|
|
43
|
+
throw new Helper_1.CustomException("code cannot be empty", 417);
|
|
44
|
+
}
|
|
45
|
+
options.client_id = this.config.client_id;
|
|
46
|
+
options.redirect_uri = this.config.redirect_uri;
|
|
47
|
+
options.grant_type = TokenService_model_1.GrantType.AuthorizationCode;
|
|
48
|
+
if (!this.config.disablePKCE) {
|
|
49
|
+
const signInRequest = yield this.userManager.getClient().createSigninRequest(this.config);
|
|
50
|
+
options.code_verifier = (_a = signInRequest.state) === null || _a === void 0 ? void 0 : _a.code_verifier;
|
|
51
|
+
}
|
|
52
|
+
const _serviceURL = this.config.authority + "/token-srv/token";
|
|
53
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
54
|
+
});
|
|
102
55
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
function loginPrecheck(options, headers) {
|
|
127
|
-
const _serviceURL = window.webAuthSettings.authority + "/token-srv/prelogin/metadata/" + options.track_id;
|
|
128
|
-
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET", undefined, headers);
|
|
129
|
-
}
|
|
130
|
-
exports.loginPrecheck = loginPrecheck;
|
|
131
|
-
/**
|
|
132
|
-
* To get the missing fields after login, call **getMissingFields()**.
|
|
133
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/aappczju1t3uh-precheck-information for more details.
|
|
134
|
-
* @example
|
|
135
|
-
* ```js
|
|
136
|
-
* const trackId = "your track id from login";
|
|
137
|
-
* cidaas.getMissingFields(trackId)
|
|
138
|
-
* .then(function (response) {
|
|
139
|
-
* // type your code here
|
|
140
|
-
* })
|
|
141
|
-
* .catch(function (ex) {
|
|
142
|
-
* // your failure code here
|
|
143
|
-
* });
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
146
|
-
function getMissingFields(trackId, headers) {
|
|
147
|
-
const _serviceURL = window.webAuthSettings.authority + "/token-srv/prelogin/metadata/" + trackId;
|
|
148
|
-
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET", undefined, headers);
|
|
149
|
-
}
|
|
150
|
-
exports.getMissingFields = getMissingFields;
|
|
151
|
-
/**
|
|
152
|
-
* To initiate device code, call **initiateDeviceCode()**.
|
|
153
|
-
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/b6d284f55be5e-authorization-request for more details.
|
|
154
|
-
* @example
|
|
155
|
-
* ```js
|
|
156
|
-
* const clientId = "your client id";
|
|
157
|
-
* cidaas.initiateDeviceCode(clientId)
|
|
158
|
-
* .then(function (response) {
|
|
159
|
-
* // type your code here
|
|
160
|
-
* })
|
|
161
|
-
* .catch(function (ex) {
|
|
162
|
-
* // your failure code here
|
|
163
|
-
* });
|
|
164
|
-
* ```
|
|
165
|
-
*/
|
|
166
|
-
function initiateDeviceCode(clientId) {
|
|
167
|
-
const clientid = clientId !== null && clientId !== void 0 ? clientId : window.webAuthSettings.client_id;
|
|
168
|
-
const _serviceURL = `${window.webAuthSettings.authority}/authz-srv/device/authz?client_id=${clientid}`;
|
|
169
|
-
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
170
|
-
}
|
|
171
|
-
exports.initiateDeviceCode = initiateDeviceCode;
|
|
172
|
-
/**
|
|
173
|
-
* To verify device code, call **deviceCodeVerify()**.
|
|
174
|
-
* @example
|
|
175
|
-
* ```js
|
|
176
|
-
* const code = "your code which has been send after initiateDeviceCode()";
|
|
177
|
-
* cidaas.deviceCodeVerify(code)
|
|
178
|
-
* .then(function (response) {
|
|
179
|
-
* // type your code here
|
|
180
|
-
* })
|
|
181
|
-
* .catch(function (ex) {
|
|
182
|
-
* // your failure code here
|
|
183
|
-
* });
|
|
184
|
-
* ```
|
|
185
|
-
*/
|
|
186
|
-
function deviceCodeVerify(code) {
|
|
187
|
-
const params = `user_code=${encodeURI(code)}`;
|
|
188
|
-
const url = `${window.webAuthSettings.authority}/token-srv/device/verify?${params}`;
|
|
189
|
-
try {
|
|
190
|
-
const options = {
|
|
191
|
-
user_code: encodeURI(code)
|
|
192
|
-
};
|
|
193
|
-
const form = Helper_1.Helper.createForm(url, options, 'GET');
|
|
194
|
-
document.body.appendChild(form);
|
|
195
|
-
form.submit();
|
|
56
|
+
/**
|
|
57
|
+
* To get precheck result after login, call **loginPrecheck()**. If there is missing information, user will be redirected to either accepting consent, changing password, continuing MFA process, or do progressive registration
|
|
58
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/aappczju1t3uh-precheck-information for more details.
|
|
59
|
+
* @example
|
|
60
|
+
* ```js
|
|
61
|
+
* const options = {
|
|
62
|
+
* track_id: "your track id from login",
|
|
63
|
+
* }
|
|
64
|
+
*
|
|
65
|
+
* cidaasTokenService.loginPrecheck(options)
|
|
66
|
+
* .then(function (response) {
|
|
67
|
+
* // type your code here
|
|
68
|
+
* })
|
|
69
|
+
* .catch(function (ex) {
|
|
70
|
+
* // your failure code here
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
loginPrecheck(options, headers) {
|
|
75
|
+
const _serviceURL = this.config.authority + "/token-srv/prelogin/metadata/" + options.track_id;
|
|
76
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET", undefined, headers);
|
|
196
77
|
}
|
|
197
|
-
|
|
198
|
-
|
|
78
|
+
/**
|
|
79
|
+
* To get the missing fields after login, call **getMissingFields()**.
|
|
80
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/aappczju1t3uh-precheck-information for more details.
|
|
81
|
+
* @example
|
|
82
|
+
* ```js
|
|
83
|
+
* const trackId = "your track id from login";
|
|
84
|
+
* cidaasTokenService.getMissingFields(trackId)
|
|
85
|
+
* .then(function (response) {
|
|
86
|
+
* // type your code here
|
|
87
|
+
* })
|
|
88
|
+
* .catch(function (ex) {
|
|
89
|
+
* // your failure code here
|
|
90
|
+
* });
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
getMissingFields(trackId, headers) {
|
|
94
|
+
const _serviceURL = this.config.authority + "/token-srv/prelogin/metadata/" + trackId;
|
|
95
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET", undefined, headers);
|
|
199
96
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
97
|
+
/**
|
|
98
|
+
* To initiate device code, call **initiateDeviceCode()**.
|
|
99
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/b6d284f55be5e-authorization-request for more details.
|
|
100
|
+
* @example
|
|
101
|
+
* ```js
|
|
102
|
+
* const clientId = "your client id";
|
|
103
|
+
* cidaasTokenService.initiateDeviceCode(clientId)
|
|
104
|
+
* .then(function (response) {
|
|
105
|
+
* // type your code here
|
|
106
|
+
* })
|
|
107
|
+
* .catch(function (ex) {
|
|
108
|
+
* // your failure code here
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
initiateDeviceCode(clientId) {
|
|
113
|
+
const clientid = clientId !== null && clientId !== void 0 ? clientId : this.config.client_id;
|
|
114
|
+
const _serviceURL = `${this.config.authority}/authz-srv/device/authz?client_id=${clientid}`;
|
|
115
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* To verify device code, call **deviceCodeVerify()**.
|
|
119
|
+
* @example
|
|
120
|
+
* ```js
|
|
121
|
+
* const code = "your code which has been send after initiateDeviceCode()";
|
|
122
|
+
* cidaasTokenService.deviceCodeVerify(code)
|
|
123
|
+
* .then(function (response) {
|
|
124
|
+
* // type your code here
|
|
125
|
+
* })
|
|
126
|
+
* .catch(function (ex) {
|
|
127
|
+
* // your failure code here
|
|
128
|
+
* });
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
deviceCodeVerify(code) {
|
|
132
|
+
const params = `user_code=${encodeURI(code)}`;
|
|
133
|
+
const url = `${this.config.authority}/token-srv/device/verify?${params}`;
|
|
134
|
+
try {
|
|
135
|
+
const options = {
|
|
136
|
+
user_code: encodeURI(code)
|
|
137
|
+
};
|
|
138
|
+
const form = Helper_1.Helper.createForm(url, options, 'GET');
|
|
139
|
+
document.body.appendChild(form);
|
|
140
|
+
form.submit();
|
|
141
|
+
}
|
|
142
|
+
catch (ex) {
|
|
143
|
+
throw new Error(String(ex));
|
|
144
|
+
}
|
|
220
145
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
146
|
+
/**
|
|
147
|
+
* To check access token without having to call cidaas api, call **offlineTokenCheck()**. THe function will return true if the token is valid & false if the token is invalid.
|
|
148
|
+
* @example
|
|
149
|
+
* ```js
|
|
150
|
+
* cidaasTokenService.offlineTokenCheck('your access token');
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
offlineTokenCheck(accessToken) {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
const result = {
|
|
156
|
+
isExpiryDateValid: false,
|
|
157
|
+
isScopesValid: false,
|
|
158
|
+
isIssuerValid: false,
|
|
159
|
+
};
|
|
160
|
+
const accessTokenHeaderAsJson = JwtHelper_1.JwtHelper.decodeTokenHeader(accessToken);
|
|
161
|
+
const accessTokenAsJson = JwtHelper_1.JwtHelper.decodeToken(accessToken);
|
|
162
|
+
if (!accessTokenAsJson || !accessTokenHeaderAsJson) {
|
|
163
|
+
return result;
|
|
226
164
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
165
|
+
else {
|
|
166
|
+
if (accessTokenAsJson.exp) {
|
|
167
|
+
const expirationDate = new Date(0);
|
|
168
|
+
expirationDate.setUTCSeconds(accessTokenAsJson.exp);
|
|
169
|
+
result.isExpiryDateValid = expirationDate.valueOf() > new Date().valueOf();
|
|
170
|
+
}
|
|
171
|
+
const accessTokenScopes = accessTokenAsJson.scopes;
|
|
172
|
+
const configScopes = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.scope) === null || _b === void 0 ? void 0 : _b.split(' ');
|
|
173
|
+
if ((accessTokenScopes === null || accessTokenScopes === void 0 ? void 0 : accessTokenScopes.length) === (configScopes === null || configScopes === void 0 ? void 0 : configScopes.length)) {
|
|
174
|
+
configScopes.forEach(scope => {
|
|
175
|
+
const i = accessTokenScopes.indexOf(scope);
|
|
176
|
+
if (i > -1) {
|
|
177
|
+
accessTokenScopes.splice(i, 1);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
result.isScopesValid = accessTokenScopes.length === 0;
|
|
181
|
+
}
|
|
182
|
+
result.isIssuerValid = accessTokenAsJson.iss === this.config.authority;
|
|
237
183
|
}
|
|
238
|
-
result
|
|
184
|
+
return result;
|
|
239
185
|
}
|
|
240
|
-
return result;
|
|
241
186
|
}
|
|
242
|
-
exports.
|
|
187
|
+
exports.TokenService = TokenService;
|
|
@@ -49,12 +49,6 @@ export interface TokenClaim {
|
|
|
49
49
|
ua_hash?: string;
|
|
50
50
|
/** List of unaccepted consents */
|
|
51
51
|
consents?: Consent[];
|
|
52
|
-
/** DEPRECATED: replaced with aud claim */
|
|
53
|
-
clientid?: string;
|
|
54
|
-
/** DEPRECATED: replaced with scopes claim */
|
|
55
|
-
scope?: string;
|
|
56
|
-
/** DEPRECATED: replaced with roles claim */
|
|
57
|
-
role?: string;
|
|
58
52
|
}
|
|
59
53
|
export interface Group {
|
|
60
54
|
/** Unique identifier for the group */
|
|
@@ -72,17 +66,6 @@ export interface Consent {
|
|
|
72
66
|
/** Time when the consent is created */
|
|
73
67
|
creation_time: string;
|
|
74
68
|
}
|
|
75
|
-
export interface RenewTokenRequest {
|
|
76
|
-
/** One time valid code that is used for issuing a new token */
|
|
77
|
-
refresh_token: string;
|
|
78
|
-
/** Unique identifier of client app, can be found in app setting under admin ui */
|
|
79
|
-
client_id?: string;
|
|
80
|
-
/**
|
|
81
|
-
* Type of grant used in token request
|
|
82
|
-
* BREAKING TODO: change type to GrantType only in next major version
|
|
83
|
-
*/
|
|
84
|
-
grant_type?: GrantType | string;
|
|
85
|
-
}
|
|
86
69
|
/** Type of grant used in token request */
|
|
87
70
|
export declare enum GrantType {
|
|
88
71
|
AuthorizationCode = "authorization_code",
|
|
@@ -93,7 +76,7 @@ export declare enum GrantType {
|
|
|
93
76
|
Internal = "internal",
|
|
94
77
|
DeviceCode = "urn:ietf:params:oauth:grant-type:device_code"
|
|
95
78
|
}
|
|
96
|
-
export interface
|
|
79
|
+
export interface GenerateTokenFromCodeRequest {
|
|
97
80
|
/** The code which you receive while using authorization code flow */
|
|
98
81
|
code: string;
|
|
99
82
|
/** When we choose PKCE method to generate token, we need to pass code_verifier which is a cryptographically random string */
|
|
@@ -102,35 +85,11 @@ export interface GetAccessTokenRequest {
|
|
|
102
85
|
client_id?: string;
|
|
103
86
|
/**
|
|
104
87
|
* Type of grant used in token request
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
grant_type?: GrantType | string;
|
|
88
|
+
*/
|
|
89
|
+
grant_type?: GrantType;
|
|
108
90
|
/** Specify the url where the user needs to be redirected after successful login */
|
|
109
91
|
redirect_uri?: string;
|
|
110
92
|
}
|
|
111
|
-
export declare class TokenIntrospectionRequest {
|
|
112
|
-
/** access token to be inspected */
|
|
113
|
-
token: string;
|
|
114
|
-
/**
|
|
115
|
-
* Optional hint about the type of the submitted token.
|
|
116
|
-
* BREAKING TODO: change type to TokenTypeHint only in next major version
|
|
117
|
-
* */
|
|
118
|
-
token_type_hint?: TokenTypeHint | string;
|
|
119
|
-
/** List of roles to match */
|
|
120
|
-
roles?: string[];
|
|
121
|
-
/** List of scopes to match */
|
|
122
|
-
scopes?: string[];
|
|
123
|
-
/** List of groups to match */
|
|
124
|
-
groups?: GroupAllowed[];
|
|
125
|
-
/** If true, all roles have to be included. If false, only 1 role from the list is needed */
|
|
126
|
-
strictRoleValidation?: boolean;
|
|
127
|
-
/** If true, all group have to be included. If false, only 1 group from the list is needed */
|
|
128
|
-
strictGroupValidation?: boolean;
|
|
129
|
-
/** If true, all scopes have to be included. If false, only 1 scope from the list is needed */
|
|
130
|
-
strictScopeValidation?: boolean;
|
|
131
|
-
/** If true, all defined roles and/or groups and/or scopes validation has to be succesful. If false, only 1 of them is needed */
|
|
132
|
-
strictValidation?: boolean;
|
|
133
|
-
}
|
|
134
93
|
/** Optional hint about the type of the submitted token. */
|
|
135
94
|
export declare enum TokenTypeHint {
|
|
136
95
|
AccessToken = "access_token",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GroupAllowed = exports.TokenTypeHint = exports.
|
|
3
|
+
exports.GroupAllowed = exports.TokenTypeHint = exports.GrantType = void 0;
|
|
4
4
|
/** Type of grant used in token request */
|
|
5
5
|
var GrantType;
|
|
6
6
|
(function (GrantType) {
|
|
@@ -11,20 +11,7 @@ var GrantType;
|
|
|
11
11
|
GrantType["ClientCredentials"] = "client_credentials";
|
|
12
12
|
GrantType["Internal"] = "internal";
|
|
13
13
|
GrantType["DeviceCode"] = "urn:ietf:params:oauth:grant-type:device_code";
|
|
14
|
-
})(GrantType
|
|
15
|
-
class TokenIntrospectionRequest {
|
|
16
|
-
constructor() {
|
|
17
|
-
/** If true, all roles have to be included. If false, only 1 role from the list is needed */
|
|
18
|
-
this.strictRoleValidation = false;
|
|
19
|
-
/** If true, all group have to be included. If false, only 1 group from the list is needed */
|
|
20
|
-
this.strictGroupValidation = false;
|
|
21
|
-
/** If true, all scopes have to be included. If false, only 1 scope from the list is needed */
|
|
22
|
-
this.strictScopeValidation = false;
|
|
23
|
-
/** If true, all defined roles and/or groups and/or scopes validation has to be succesful. If false, only 1 of them is needed */
|
|
24
|
-
this.strictValidation = false;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.TokenIntrospectionRequest = TokenIntrospectionRequest;
|
|
14
|
+
})(GrantType || (exports.GrantType = GrantType = {}));
|
|
28
15
|
/** Optional hint about the type of the submitted token. */
|
|
29
16
|
var TokenTypeHint;
|
|
30
17
|
(function (TokenTypeHint) {
|
|
@@ -33,7 +20,7 @@ var TokenTypeHint;
|
|
|
33
20
|
TokenTypeHint["IdToken"] = "id_token";
|
|
34
21
|
TokenTypeHint["Sid"] = "sid";
|
|
35
22
|
TokenTypeHint["Sso"] = "sso";
|
|
36
|
-
})(TokenTypeHint
|
|
23
|
+
})(TokenTypeHint || (exports.TokenTypeHint = TokenTypeHint = {}));
|
|
37
24
|
class GroupAllowed {
|
|
38
25
|
constructor() {
|
|
39
26
|
/** If true, all roles have to be included. If false, only 1 role from the list is needed */
|