@boxyhq/saml-jackson 1.33.1-beta.1 → 1.34.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/dist/typings.d.ts +1 -1
- package/package.json +1 -1
- package/dist/controller/oauth/oidc-issuer.d.ts +0 -2
- package/dist/controller/oauth/oidc-issuer.js +0 -25
- package/dist/controller/oauth/oidc-issuer.js.map +0 -1
- package/dist/src/controller/admin.d.ts +0 -27
- package/dist/src/controller/admin.js +0 -60
- package/dist/src/controller/admin.js.map +0 -1
- package/dist/src/controller/analytics.d.ts +0 -16
- package/dist/src/controller/analytics.js +0 -79
- package/dist/src/controller/analytics.js.map +0 -1
- package/dist/src/controller/api.d.ts +0 -557
- package/dist/src/controller/api.js +0 -806
- package/dist/src/controller/api.js.map +0 -1
- package/dist/src/controller/connection/oidc.d.ts +0 -7
- package/dist/src/controller/connection/oidc.js +0 -181
- package/dist/src/controller/connection/oidc.js.map +0 -1
- package/dist/src/controller/connection/saml.d.ts +0 -7
- package/dist/src/controller/connection/saml.js +0 -250
- package/dist/src/controller/connection/saml.js.map +0 -1
- package/dist/src/controller/error.d.ts +0 -10
- package/dist/src/controller/error.js +0 -13
- package/dist/src/controller/error.js.map +0 -1
- package/dist/src/controller/health-check.d.ts +0 -11
- package/dist/src/controller/health-check.js +0 -51
- package/dist/src/controller/health-check.js.map +0 -1
- package/dist/src/controller/logout.d.ts +0 -18
- package/dist/src/controller/logout.js +0 -132
- package/dist/src/controller/logout.js.map +0 -1
- package/dist/src/controller/oauth/allowed.d.ts +0 -1
- package/dist/src/controller/oauth/allowed.js +0 -30
- package/dist/src/controller/oauth/allowed.js.map +0 -1
- package/dist/src/controller/oauth/code-verifier.d.ts +0 -1
- package/dist/src/controller/oauth/code-verifier.js +0 -8
- package/dist/src/controller/oauth/code-verifier.js.map +0 -1
- package/dist/src/controller/oauth/oidc-client.d.ts +0 -12
- package/dist/src/controller/oauth/oidc-client.js +0 -89
- package/dist/src/controller/oauth/oidc-client.js.map +0 -1
- package/dist/src/controller/oauth/redirect.d.ts +0 -1
- package/dist/src/controller/oauth/redirect.js +0 -13
- package/dist/src/controller/oauth/redirect.js.map +0 -1
- package/dist/src/controller/oauth.d.ts +0 -142
- package/dist/src/controller/oauth.js +0 -1112
- package/dist/src/controller/oauth.js.map +0 -1
- package/dist/src/controller/oidc-discovery.d.ts +0 -22
- package/dist/src/controller/oidc-discovery.js +0 -47
- package/dist/src/controller/oidc-discovery.js.map +0 -1
- package/dist/src/controller/setup-link.d.ts +0 -307
- package/dist/src/controller/setup-link.js +0 -462
- package/dist/src/controller/setup-link.js.map +0 -1
- package/dist/src/controller/sp-config.d.ts +0 -22
- package/dist/src/controller/sp-config.js +0 -89
- package/dist/src/controller/sp-config.js.map +0 -1
- package/dist/src/controller/sso-handler.d.ts +0 -66
- package/dist/src/controller/sso-handler.js +0 -306
- package/dist/src/controller/sso-handler.js.map +0 -1
- package/dist/src/controller/utils.d.ts +0 -84
- package/dist/src/controller/utils.js +0 -328
- package/dist/src/controller/utils.js.map +0 -1
- package/dist/src/cron/lock.d.ts +0 -18
- package/dist/src/cron/lock.js +0 -98
- package/dist/src/cron/lock.js.map +0 -1
- package/dist/src/db/db.d.ts +0 -5
- package/dist/src/db/db.js +0 -178
- package/dist/src/db/db.js.map +0 -1
- package/dist/src/db/defaultDb.d.ts +0 -2
- package/dist/src/db/defaultDb.js +0 -18
- package/dist/src/db/defaultDb.js.map +0 -1
- package/dist/src/db/dynamoDb.d.ts +0 -19
- package/dist/src/db/dynamoDb.js +0 -320
- package/dist/src/db/dynamoDb.js.map +0 -1
- package/dist/src/db/encrypter.d.ts +0 -3
- package/dist/src/db/encrypter.js +0 -22
- package/dist/src/db/encrypter.js.map +0 -1
- package/dist/src/db/mem.d.ts +0 -23
- package/dist/src/db/mem.js +0 -186
- package/dist/src/db/mem.js.map +0 -1
- package/dist/src/db/mongo.d.ts +0 -22
- package/dist/src/db/mongo.js +0 -177
- package/dist/src/db/mongo.js.map +0 -1
- package/dist/src/db/planetscale/entity/JacksonIndex.d.ts +0 -5
- package/dist/src/db/planetscale/entity/JacksonIndex.js +0 -32
- package/dist/src/db/planetscale/entity/JacksonIndex.js.map +0 -1
- package/dist/src/db/planetscale/entity/JacksonStore.d.ts +0 -9
- package/dist/src/db/planetscale/entity/JacksonStore.js +0 -63
- package/dist/src/db/planetscale/entity/JacksonStore.js.map +0 -1
- package/dist/src/db/planetscale/entity/JacksonTTL.d.ts +0 -4
- package/dist/src/db/planetscale/entity/JacksonTTL.js +0 -27
- package/dist/src/db/planetscale/entity/JacksonTTL.js.map +0 -1
- package/dist/src/db/redis.d.ts +0 -18
- package/dist/src/db/redis.js +0 -214
- package/dist/src/db/redis.js.map +0 -1
- package/dist/src/db/sql/entity/JacksonIndex.d.ts +0 -7
- package/dist/src/db/sql/entity/JacksonIndex.js +0 -39
- package/dist/src/db/sql/entity/JacksonIndex.js.map +0 -1
- package/dist/src/db/sql/entity/JacksonStore.d.ts +0 -9
- package/dist/src/db/sql/entity/JacksonStore.js +0 -61
- package/dist/src/db/sql/entity/JacksonStore.js.map +0 -1
- package/dist/src/db/sql/entity/JacksonTTL.d.ts +0 -4
- package/dist/src/db/sql/entity/JacksonTTL.js +0 -27
- package/dist/src/db/sql/entity/JacksonTTL.js.map +0 -1
- package/dist/src/db/sql/mariadb/entity/JacksonIndex.d.ts +0 -7
- package/dist/src/db/sql/mariadb/entity/JacksonIndex.js +0 -39
- package/dist/src/db/sql/mariadb/entity/JacksonIndex.js.map +0 -1
- package/dist/src/db/sql/mariadb/entity/JacksonStore.d.ts +0 -9
- package/dist/src/db/sql/mariadb/entity/JacksonStore.js +0 -63
- package/dist/src/db/sql/mariadb/entity/JacksonStore.js.map +0 -1
- package/dist/src/db/sql/mariadb/entity/JacksonTTL.d.ts +0 -4
- package/dist/src/db/sql/mariadb/entity/JacksonTTL.js +0 -27
- package/dist/src/db/sql/mariadb/entity/JacksonTTL.js.map +0 -1
- package/dist/src/db/sql/mssql/entity/JacksonIndex.d.ts +0 -7
- package/dist/src/db/sql/mssql/entity/JacksonIndex.js +0 -39
- package/dist/src/db/sql/mssql/entity/JacksonIndex.js.map +0 -1
- package/dist/src/db/sql/mssql/entity/JacksonStore.d.ts +0 -9
- package/dist/src/db/sql/mssql/entity/JacksonStore.js +0 -61
- package/dist/src/db/sql/mssql/entity/JacksonStore.js.map +0 -1
- package/dist/src/db/sql/mssql/entity/JacksonTTL.d.ts +0 -4
- package/dist/src/db/sql/mssql/entity/JacksonTTL.js +0 -27
- package/dist/src/db/sql/mssql/entity/JacksonTTL.js.map +0 -1
- package/dist/src/db/sql/mssql.d.ts +0 -1
- package/dist/src/db/sql/mssql.js +0 -44
- package/dist/src/db/sql/mssql.js.map +0 -1
- package/dist/src/db/sql/sql.d.ts +0 -32
- package/dist/src/db/sql/sql.js +0 -318
- package/dist/src/db/sql/sql.js.map +0 -1
- package/dist/src/db/sql/sqlite/entity/JacksonIndex.d.ts +0 -7
- package/dist/src/db/sql/sqlite/entity/JacksonIndex.js +0 -39
- package/dist/src/db/sql/sqlite/entity/JacksonIndex.js.map +0 -1
- package/dist/src/db/sql/sqlite/entity/JacksonStore.d.ts +0 -9
- package/dist/src/db/sql/sqlite/entity/JacksonStore.js +0 -61
- package/dist/src/db/sql/sqlite/entity/JacksonStore.js.map +0 -1
- package/dist/src/db/sql/sqlite/entity/JacksonTTL.d.ts +0 -4
- package/dist/src/db/sql/sqlite/entity/JacksonTTL.js +0 -27
- package/dist/src/db/sql/sqlite/entity/JacksonTTL.js.map +0 -1
- package/dist/src/db/store.d.ts +0 -5
- package/dist/src/db/store.js +0 -65
- package/dist/src/db/store.js.map +0 -1
- package/dist/src/db/utils.d.ts +0 -16
- package/dist/src/db/utils.js +0 -28
- package/dist/src/db/utils.js.map +0 -1
- package/dist/src/directory-sync/batch-events/queue.d.ts +0 -40
- package/dist/src/directory-sync/batch-events/queue.js +0 -225
- package/dist/src/directory-sync/batch-events/queue.js.map +0 -1
- package/dist/src/directory-sync/index.d.ts +0 -27
- package/dist/src/directory-sync/index.js +0 -97
- package/dist/src/directory-sync/index.js.map +0 -1
- package/dist/src/directory-sync/non-scim/google/api.d.ts +0 -36
- package/dist/src/directory-sync/non-scim/google/api.js +0 -143
- package/dist/src/directory-sync/non-scim/google/api.js.map +0 -1
- package/dist/src/directory-sync/non-scim/google/index.d.ts +0 -12
- package/dist/src/directory-sync/non-scim/google/index.js +0 -10
- package/dist/src/directory-sync/non-scim/google/index.js.map +0 -1
- package/dist/src/directory-sync/non-scim/google/oauth.d.ts +0 -27
- package/dist/src/directory-sync/non-scim/google/oauth.js +0 -105
- package/dist/src/directory-sync/non-scim/google/oauth.js.map +0 -1
- package/dist/src/directory-sync/non-scim/index.d.ts +0 -24
- package/dist/src/directory-sync/non-scim/index.js +0 -85
- package/dist/src/directory-sync/non-scim/index.js.map +0 -1
- package/dist/src/directory-sync/non-scim/syncGroupMembers.d.ts +0 -23
- package/dist/src/directory-sync/non-scim/syncGroupMembers.js +0 -105
- package/dist/src/directory-sync/non-scim/syncGroupMembers.js.map +0 -1
- package/dist/src/directory-sync/non-scim/syncGroups.d.ts +0 -24
- package/dist/src/directory-sync/non-scim/syncGroups.js +0 -120
- package/dist/src/directory-sync/non-scim/syncGroups.js.map +0 -1
- package/dist/src/directory-sync/non-scim/syncUsers.d.ts +0 -24
- package/dist/src/directory-sync/non-scim/syncUsers.js +0 -120
- package/dist/src/directory-sync/non-scim/syncUsers.js.map +0 -1
- package/dist/src/directory-sync/non-scim/utils.d.ts +0 -36
- package/dist/src/directory-sync/non-scim/utils.js +0 -109
- package/dist/src/directory-sync/non-scim/utils.js.map +0 -1
- package/dist/src/directory-sync/request.d.ts +0 -14
- package/dist/src/directory-sync/request.js +0 -29
- package/dist/src/directory-sync/request.js.map +0 -1
- package/dist/src/directory-sync/scim/Base.d.ts +0 -12
- package/dist/src/directory-sync/scim/Base.js +0 -23
- package/dist/src/directory-sync/scim/Base.js.map +0 -1
- package/dist/src/directory-sync/scim/DirectoryConfig.d.ts +0 -343
- package/dist/src/directory-sync/scim/DirectoryConfig.js +0 -580
- package/dist/src/directory-sync/scim/DirectoryConfig.js.map +0 -1
- package/dist/src/directory-sync/scim/DirectoryGroups.d.ts +0 -28
- package/dist/src/directory-sync/scim/DirectoryGroups.js +0 -252
- package/dist/src/directory-sync/scim/DirectoryGroups.js.map +0 -1
- package/dist/src/directory-sync/scim/DirectoryUsers.d.ts +0 -25
- package/dist/src/directory-sync/scim/DirectoryUsers.js +0 -193
- package/dist/src/directory-sync/scim/DirectoryUsers.js.map +0 -1
- package/dist/src/directory-sync/scim/Groups.d.ts +0 -166
- package/dist/src/directory-sync/scim/Groups.js +0 -348
- package/dist/src/directory-sync/scim/Groups.js.map +0 -1
- package/dist/src/directory-sync/scim/Users.d.ts +0 -99
- package/dist/src/directory-sync/scim/Users.js +0 -215
- package/dist/src/directory-sync/scim/Users.js.map +0 -1
- package/dist/src/directory-sync/scim/WebhookEventsLogger.d.ts +0 -101
- package/dist/src/directory-sync/scim/WebhookEventsLogger.js +0 -165
- package/dist/src/directory-sync/scim/WebhookEventsLogger.js.map +0 -1
- package/dist/src/directory-sync/scim/transform.d.ts +0 -6
- package/dist/src/directory-sync/scim/transform.js +0 -37
- package/dist/src/directory-sync/scim/transform.js.map +0 -1
- package/dist/src/directory-sync/scim/utils.d.ts +0 -33
- package/dist/src/directory-sync/scim/utils.js +0 -129
- package/dist/src/directory-sync/scim/utils.js.map +0 -1
- package/dist/src/directory-sync/types.d.ts +0 -195
- package/dist/src/directory-sync/types.js +0 -10
- package/dist/src/directory-sync/types.js.map +0 -1
- package/dist/src/directory-sync/utils.d.ts +0 -19
- package/dist/src/directory-sync/utils.js +0 -56
- package/dist/src/directory-sync/utils.js.map +0 -1
- package/dist/src/ee/branding/index.d.ts +0 -17
- package/dist/src/ee/branding/index.js +0 -49
- package/dist/src/ee/branding/index.js.map +0 -1
- package/dist/src/ee/common/checkLicense.d.ts +0 -3
- package/dist/src/ee/common/checkLicense.js +0 -23
- package/dist/src/ee/common/checkLicense.js.map +0 -1
- package/dist/src/ee/identity-federation/app.d.ts +0 -328
- package/dist/src/ee/identity-federation/app.js +0 -532
- package/dist/src/ee/identity-federation/app.js.map +0 -1
- package/dist/src/ee/identity-federation/idp-login.d.ts +0 -18
- package/dist/src/ee/identity-federation/idp-login.js +0 -98
- package/dist/src/ee/identity-federation/idp-login.js.map +0 -1
- package/dist/src/ee/identity-federation/index.d.ts +0 -15
- package/dist/src/ee/identity-federation/index.js +0 -43
- package/dist/src/ee/identity-federation/index.js.map +0 -1
- package/dist/src/ee/identity-federation/sso.d.ts +0 -24
- package/dist/src/ee/identity-federation/sso.js +0 -124
- package/dist/src/ee/identity-federation/sso.js.map +0 -1
- package/dist/src/ee/identity-federation/types.d.ts +0 -38
- package/dist/src/ee/identity-federation/types.js +0 -2
- package/dist/src/ee/identity-federation/types.js.map +0 -1
- package/dist/src/ee/ory/ory.d.ts +0 -18
- package/dist/src/ee/ory/ory.js +0 -195
- package/dist/src/ee/ory/ory.js.map +0 -1
- package/dist/src/ee/product/index.d.ts +0 -14
- package/dist/src/ee/product/index.js +0 -45
- package/dist/src/ee/product/index.js.map +0 -1
- package/dist/src/event/axios.d.ts +0 -2
- package/dist/src/event/axios.js +0 -27
- package/dist/src/event/axios.js.map +0 -1
- package/dist/src/event/index.d.ts +0 -11
- package/dist/src/event/index.js +0 -53
- package/dist/src/event/index.js.map +0 -1
- package/dist/src/event/types.d.ts +0 -21
- package/dist/src/event/types.js +0 -2
- package/dist/src/event/types.js.map +0 -1
- package/dist/src/event/utils.d.ts +0 -4
- package/dist/src/event/utils.js +0 -33
- package/dist/src/event/utils.js.map +0 -1
- package/dist/src/event/webhook.d.ts +0 -3
- package/dist/src/event/webhook.js +0 -34
- package/dist/src/event/webhook.js.map +0 -1
- package/dist/src/index.d.ts +0 -35
- package/dist/src/index.js +0 -161
- package/dist/src/index.js.map +0 -1
- package/dist/src/loadConnection.d.ts +0 -4
- package/dist/src/loadConnection.js +0 -38
- package/dist/src/loadConnection.js.map +0 -1
- package/dist/src/opentelemetry/metrics.d.ts +0 -14
- package/dist/src/opentelemetry/metrics.js +0 -64
- package/dist/src/opentelemetry/metrics.js.map +0 -1
- package/dist/src/saml/claims.d.ts +0 -12
- package/dist/src/saml/claims.js +0 -57
- package/dist/src/saml/claims.js.map +0 -1
- package/dist/src/saml/lib.d.ts +0 -8
- package/dist/src/saml/lib.js +0 -29
- package/dist/src/saml/lib.js.map +0 -1
- package/dist/src/saml/x509.d.ts +0 -9
- package/dist/src/saml/x509.js +0 -93
- package/dist/src/saml/x509.js.map +0 -1
- package/dist/src/sso-traces/index.d.ts +0 -114
- package/dist/src/sso-traces/index.js +0 -229
- package/dist/src/sso-traces/index.js.map +0 -1
- package/dist/src/sso-traces/types.d.ts +0 -44
- package/dist/src/sso-traces/types.js +0 -2
- package/dist/src/sso-traces/types.js.map +0 -1
- package/dist/src/typings.d.ts +0 -540
- package/dist/src/typings.js +0 -5
- package/dist/src/typings.js.map +0 -1
- package/dist/typeorm.d.ts +0 -3
- package/dist/typeorm.js +0 -58
- package/dist/typeorm.js.map +0 -1
@@ -1,132 +0,0 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
|
-
import crypto from 'crypto';
|
11
|
-
import { promisify } from 'util';
|
12
|
-
import { deflateRaw } from 'zlib';
|
13
|
-
import * as dbutils from '../db/utils';
|
14
|
-
import saml from '@boxyhq/saml20';
|
15
|
-
import { JacksonError } from './error';
|
16
|
-
import * as redirect from './oauth/redirect';
|
17
|
-
import { IndexNames } from './utils';
|
18
|
-
import { getDefaultCertificate } from '../saml/x509';
|
19
|
-
const deflateRawAsync = promisify(deflateRaw);
|
20
|
-
const relayStatePrefix = 'boxyhq_jackson_';
|
21
|
-
const logoutXPath = "/*[local-name(.)='LogoutRequest']";
|
22
|
-
export class LogoutController {
|
23
|
-
constructor({ connectionStore, sessionStore, opts }) {
|
24
|
-
this.opts = opts;
|
25
|
-
this.connectionStore = connectionStore;
|
26
|
-
this.sessionStore = sessionStore;
|
27
|
-
}
|
28
|
-
// Create SLO Request
|
29
|
-
createRequest(_a) {
|
30
|
-
return __awaiter(this, arguments, void 0, function* ({ nameId, tenant, product, redirectUrl }) {
|
31
|
-
let samlConnection = null;
|
32
|
-
if (tenant && product) {
|
33
|
-
const samlConnections = (yield this.connectionStore.getByIndex({
|
34
|
-
name: IndexNames.TenantProduct,
|
35
|
-
value: dbutils.keyFromParts(tenant, product),
|
36
|
-
})).data;
|
37
|
-
if (!samlConnections || samlConnections.length === 0) {
|
38
|
-
throw new JacksonError('SAML connection not found.', 403);
|
39
|
-
}
|
40
|
-
samlConnection = samlConnections[0];
|
41
|
-
}
|
42
|
-
if (!samlConnection) {
|
43
|
-
throw new JacksonError('SAML connection not found.', 403);
|
44
|
-
}
|
45
|
-
const { idpMetadata: { slo, provider }, } = samlConnection;
|
46
|
-
const { privateKey, publicKey } = yield getDefaultCertificate();
|
47
|
-
if ('redirectUrl' in slo === false && 'postUrl' in slo === false) {
|
48
|
-
throw new JacksonError(`${provider} doesn't support SLO or disabled by IdP.`, 400);
|
49
|
-
}
|
50
|
-
const { id, xml } = saml.createLogoutRequest({
|
51
|
-
nameId,
|
52
|
-
providerName: this.opts.samlAudience,
|
53
|
-
sloUrl: slo.redirectUrl,
|
54
|
-
});
|
55
|
-
const sessionId = crypto.randomBytes(16).toString('hex');
|
56
|
-
let logoutUrl = null;
|
57
|
-
let logoutForm = null;
|
58
|
-
const relayState = relayStatePrefix + sessionId;
|
59
|
-
const signedXML = yield signXML(xml, privateKey, publicKey);
|
60
|
-
yield this.sessionStore.put(sessionId, {
|
61
|
-
id,
|
62
|
-
redirectUrl,
|
63
|
-
});
|
64
|
-
// HTTP-Redirect binding
|
65
|
-
if ('redirectUrl' in slo) {
|
66
|
-
logoutUrl = redirect.success(slo.redirectUrl, {
|
67
|
-
SAMLRequest: Buffer.from(yield deflateRawAsync(signedXML)).toString('base64'),
|
68
|
-
RelayState: relayState,
|
69
|
-
});
|
70
|
-
}
|
71
|
-
// HTTP-POST binding
|
72
|
-
if ('postUrl' in slo) {
|
73
|
-
logoutForm = saml.createPostForm(slo.postUrl, [
|
74
|
-
{
|
75
|
-
name: 'RelayState',
|
76
|
-
value: relayState,
|
77
|
-
},
|
78
|
-
{
|
79
|
-
name: 'SAMLRequest',
|
80
|
-
value: Buffer.from(signedXML).toString('base64'),
|
81
|
-
},
|
82
|
-
]);
|
83
|
-
}
|
84
|
-
return { logoutUrl, logoutForm };
|
85
|
-
});
|
86
|
-
}
|
87
|
-
// Handle SLO Response
|
88
|
-
handleResponse(_a) {
|
89
|
-
return __awaiter(this, arguments, void 0, function* ({ SAMLResponse, RelayState }) {
|
90
|
-
var _b;
|
91
|
-
const rawResponse = Buffer.from(SAMLResponse, 'base64').toString();
|
92
|
-
const sessionId = RelayState.replace(relayStatePrefix, '');
|
93
|
-
const session = yield this.sessionStore.get(sessionId);
|
94
|
-
if (!session) {
|
95
|
-
throw new JacksonError('Unable to validate state from the origin request.', 403);
|
96
|
-
}
|
97
|
-
const parsedResponse = yield saml.parseLogoutResponse(rawResponse);
|
98
|
-
if (parsedResponse.status !== 'urn:oasis:names:tc:SAML:2.0:status:Success') {
|
99
|
-
throw new JacksonError(`SLO failed with status ${parsedResponse.status}.`, 400);
|
100
|
-
}
|
101
|
-
if (parsedResponse.inResponseTo !== session.id) {
|
102
|
-
throw new JacksonError(`SLO failed with mismatched request ID.`, 400);
|
103
|
-
}
|
104
|
-
const samlConnections = (yield this.connectionStore.getByIndex({
|
105
|
-
name: IndexNames.EntityID,
|
106
|
-
value: parsedResponse.issuer,
|
107
|
-
})).data;
|
108
|
-
if (!samlConnections || samlConnections.length === 0) {
|
109
|
-
throw new JacksonError('SAML connection not found.', 403);
|
110
|
-
}
|
111
|
-
const { idpMetadata, defaultRedirectUrl } = samlConnections[0];
|
112
|
-
if (!(yield saml.validateSignature(rawResponse, null, idpMetadata.thumbprint))) {
|
113
|
-
throw new JacksonError('Invalid signature.', 403);
|
114
|
-
}
|
115
|
-
try {
|
116
|
-
yield this.sessionStore.delete(sessionId);
|
117
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
118
|
-
}
|
119
|
-
catch (_err) {
|
120
|
-
// Ignore
|
121
|
-
}
|
122
|
-
return {
|
123
|
-
redirectUrl: (_b = session.redirectUrl) !== null && _b !== void 0 ? _b : defaultRedirectUrl,
|
124
|
-
};
|
125
|
-
});
|
126
|
-
}
|
127
|
-
}
|
128
|
-
// Sign the XML
|
129
|
-
const signXML = (xml, signingKey, publicKey) => __awaiter(void 0, void 0, void 0, function* () {
|
130
|
-
return yield saml.sign(xml, signingKey, publicKey, logoutXPath);
|
131
|
-
});
|
132
|
-
//# sourceMappingURL=logout.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../src/controller/logout.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,KAAK,OAAO,MAAM,aAAa,CAAC;AAEvC,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,QA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AC,eAAe,CAAC,UAAU,CAAC;gBACpC,IAAI,EAAE,UAAU,CAAC,QAAQ;gBACzB,KAAK,EAAE,cAAc,CAAC,MAAM;aAC7B,CAAC,CACH,CAAC,IAAI,CAAC;YAEP,IAAI,CAAC,eAAe,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACrD,MAAM,IAAI,YAAY,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;YAC5D,CAAC;YAED,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE,GAAmB,eAAe,CAAC,CAAC,CAAC,CAAC;YAE/E,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,IAAI,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;gBAC/E,MAAM,IAAI,YAAY,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;YACpD,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;gBAC1C,6DAA6D;YAC/D,CAAC;YAAC,OAAO,IAAI,EAAE,CAAC;gBACd,SAAS;YACX,CAAC;YAED,OAAO;gBACL,WAAW,EAAE,MAAA,OAAO,CAAC,WAAW,mCAAI,kBAAkB;aACvD,CAAC;QACJ,CAAC;KAAA;CACF;AAED,eAAe;AACf,MAAM,OAAO,GAAG,CAAO,GAAW,EAAE,UAAkB,EAAE,SAAiB,EAAmB,EAAE;IAC5F,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AAClE,CAAC,CAAA,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const redirect: (redirectUrl: string, redirectUrls: string[]) => boolean;
|
@@ -1,30 +0,0 @@
|
|
1
|
-
const redirectUrlPlaceholder = 'http://_boxyhq_redirect_not_in_use';
|
2
|
-
export const redirect = (redirectUrl, redirectUrls) => {
|
3
|
-
// Don't allow redirect to URL placeholder
|
4
|
-
if (redirectUrl === redirectUrlPlaceholder) {
|
5
|
-
return false;
|
6
|
-
}
|
7
|
-
const url = new URL(redirectUrl);
|
8
|
-
for (const idx in redirectUrls) {
|
9
|
-
const rUrl = new URL(redirectUrls[idx]);
|
10
|
-
let hostname = url.hostname;
|
11
|
-
let hostNameAllowed = rUrl.hostname;
|
12
|
-
// allow subdomain globbing *.example.com only
|
13
|
-
try {
|
14
|
-
if (rUrl.hostname.startsWith('*.')) {
|
15
|
-
hostNameAllowed = rUrl.hostname.slice(2);
|
16
|
-
hostname = hostname.slice(hostname.indexOf('.') + 1);
|
17
|
-
}
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
19
|
-
}
|
20
|
-
catch (e) {
|
21
|
-
// no-op
|
22
|
-
}
|
23
|
-
// TODO: Check pathname, for now pathname is ignored
|
24
|
-
if (rUrl.protocol === url.protocol && hostNameAllowed === hostname && rUrl.port === url.port) {
|
25
|
-
return true;
|
26
|
-
}
|
27
|
-
}
|
28
|
-
return false;
|
29
|
-
};
|
30
|
-
//# sourceMappingURL=allowed.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"allowed.js","sourceRoot":"","sources":["../../../../src/controller/oauth/allowed.ts"],"names":[],"mappings":"AAAA,MAAM,sBAAsB,GAAG,oCAAoC,CAAC;AAEpE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,WAAmB,EAAE,YAAsB,EAAW,EAAE;IAC/E,0CAA0C;IAC1C,IAAI,WAAW,KAAK,sBAAsB,EAAE,CAAC;QAC3C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,GAAG,GAAQ,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;IAEtC,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC/B,MAAM,IAAI,GAAQ,IAAI,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QAE7C,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;QAC5B,IAAI,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC;QAEpC,8CAA8C;QAC9C,IAAI,CAAC;YACH,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnC,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACzC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACvD,CAAC;YACD,6DAA6D;QAC/D,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,QAAQ;QACV,CAAC;QAED,oDAAoD;QAEpD,IAAI,IAAI,CAAC,QAAQ,KAAK,GAAG,CAAC,QAAQ,IAAI,eAAe,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,EAAE,CAAC;YAC7F,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const encode: (code_challenge: string) => string;
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import crypto from 'crypto';
|
2
|
-
const transformBase64 = (input) => {
|
3
|
-
return input.replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
|
4
|
-
};
|
5
|
-
export const encode = (code_challenge) => {
|
6
|
-
return transformBase64(crypto.createHash('sha256').update(code_challenge).digest('base64'));
|
7
|
-
};
|
8
|
-
//# sourceMappingURL=code-verifier.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"code-verifier.js","sourceRoot":"","sources":["../../../../src/controller/oauth/code-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,eAAe,GAAG,CAAC,KAAa,EAAU,EAAE;IAChD,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACzE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,cAAsB,EAAU,EAAE;IACvD,OAAO,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC9F,CAAC,CAAC"}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import type { ServerMetadata, Configuration } from 'openid-client' with { 'resolution-mode': 'import' };
|
2
|
-
import { SSOTrace, SSOTracesInstance } from '../../typings';
|
3
|
-
export declare const oidcClientConfig: ({ discoveryUrl, metadata, clientId, clientSecret, ssoTraces, }: {
|
4
|
-
discoveryUrl?: string;
|
5
|
-
metadata?: ServerMetadata;
|
6
|
-
clientId: string;
|
7
|
-
clientSecret: string;
|
8
|
-
ssoTraces: {
|
9
|
-
instance: SSOTracesInstance;
|
10
|
-
context: SSOTrace["context"];
|
11
|
-
};
|
12
|
-
}) => Promise<Configuration>;
|
@@ -1,89 +0,0 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
|
-
import * as http from 'http';
|
11
|
-
import * as https from 'https';
|
12
|
-
import { JacksonError } from '../error';
|
13
|
-
import { URL } from 'url';
|
14
|
-
const createCustomFetch = (ssoTraces) => {
|
15
|
-
return (url, options) => __awaiter(void 0, void 0, void 0, function* () {
|
16
|
-
return new Promise((resolve, reject) => {
|
17
|
-
const parsedUrl = new URL(url);
|
18
|
-
const requestOptions = {
|
19
|
-
hostname: parsedUrl.hostname,
|
20
|
-
port: parsedUrl.port,
|
21
|
-
path: parsedUrl.pathname + parsedUrl.search,
|
22
|
-
method: options.method || 'GET',
|
23
|
-
headers: options.headers,
|
24
|
-
};
|
25
|
-
const request = parsedUrl.protocol === 'https:' ? https.request : http.request;
|
26
|
-
const req = request(requestOptions, (res) => {
|
27
|
-
let data = '';
|
28
|
-
res.on('data', (chunk) => {
|
29
|
-
data += chunk;
|
30
|
-
});
|
31
|
-
res.on('end', () => {
|
32
|
-
const response = new Response(data, {
|
33
|
-
status: res.statusCode,
|
34
|
-
statusText: res.statusMessage,
|
35
|
-
headers: new Headers(res.headers),
|
36
|
-
});
|
37
|
-
resolve(response);
|
38
|
-
});
|
39
|
-
});
|
40
|
-
req.on('error', (error) => {
|
41
|
-
ssoTraces.instance.saveTrace({
|
42
|
-
error: `Fetch failed for OIDC IdP endpoint: ${parsedUrl.toString()}`,
|
43
|
-
context: ssoTraces.context,
|
44
|
-
});
|
45
|
-
reject(error);
|
46
|
-
});
|
47
|
-
if (options.body) {
|
48
|
-
let body;
|
49
|
-
let contentType;
|
50
|
-
if (options.body instanceof URLSearchParams) {
|
51
|
-
body = options.body.toString();
|
52
|
-
contentType = 'application/x-www-form-urlencoded';
|
53
|
-
}
|
54
|
-
else {
|
55
|
-
body = options.body;
|
56
|
-
}
|
57
|
-
if (contentType) {
|
58
|
-
req.setHeader('content-type', contentType);
|
59
|
-
}
|
60
|
-
req.write(body);
|
61
|
-
}
|
62
|
-
req.end();
|
63
|
-
});
|
64
|
-
});
|
65
|
-
};
|
66
|
-
export const oidcClientConfig = (_a) => __awaiter(void 0, [_a], void 0, function* ({ discoveryUrl, metadata, clientId, clientSecret, ssoTraces, }) {
|
67
|
-
const url = discoveryUrl ? new URL(discoveryUrl) : new URL(metadata.issuer);
|
68
|
-
const isLocalhost = url.hostname === 'localhost';
|
69
|
-
const customFetchWithSsoTraces = createCustomFetch(ssoTraces);
|
70
|
-
const client = yield import('openid-client');
|
71
|
-
if (discoveryUrl) {
|
72
|
-
return yield client.discovery(url, clientId, clientSecret, undefined, isLocalhost
|
73
|
-
? {
|
74
|
-
execute: [client.allowInsecureRequests],
|
75
|
-
[client.customFetch]: customFetchWithSsoTraces,
|
76
|
-
}
|
77
|
-
: { [client.customFetch]: customFetchWithSsoTraces });
|
78
|
-
}
|
79
|
-
if (metadata) {
|
80
|
-
const config = new client.Configuration(metadata, clientId, clientSecret);
|
81
|
-
config[client.customFetch] = customFetchWithSsoTraces;
|
82
|
-
if (isLocalhost) {
|
83
|
-
client.allowInsecureRequests(config);
|
84
|
-
}
|
85
|
-
return config;
|
86
|
-
}
|
87
|
-
throw new JacksonError('Neither "discoveryUrl" nor "metadata" set for the OIDC provider', 500);
|
88
|
-
});
|
89
|
-
//# sourceMappingURL=oidc-client.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"oidc-client.js","sourceRoot":"","sources":["../../../../src/controller/oauth/oidc-client.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAG1B,MAAM,iBAAiB,GAAG,CAAC,SAAwE,EAAE,EAAE;IACrG,OAAO,CAAO,GAAgB,EAAE,OAAoB,EAAqB,EAAE;QACzE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,SAAS,GAAG,IAAI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Y,EACZ,SAAS,EACT,WAAW;YACT,CAAC,CAAC;gBACE,OAAO,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC;gBACvC,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,wBAAwB;aAC/C;YACH,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,wBAAwB,EAAE,CACvD,CAAC;IACJ,CAAC;IACD,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;QAC1E,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,wBAAwB,CAAC;QACtD,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,MAAM,IAAI,YAAY,CAAC,iEAAiE,EAAE,GAAG,CAAC,CAAC;AACjG,CAAC,CAAA,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const success: (redirectUrl: string, params: Record<string, string | string[] | undefined>) => string;
|
@@ -1,13 +0,0 @@
|
|
1
|
-
export const success = (redirectUrl, params) => {
|
2
|
-
const url = new URL(redirectUrl);
|
3
|
-
for (const [key, value] of Object.entries(params)) {
|
4
|
-
if (Array.isArray(value)) {
|
5
|
-
value.forEach((v) => url.searchParams.append(key, v));
|
6
|
-
}
|
7
|
-
else if (value !== undefined) {
|
8
|
-
url.searchParams.set(key, value);
|
9
|
-
}
|
10
|
-
}
|
11
|
-
return url.href;
|
12
|
-
};
|
13
|
-
//# sourceMappingURL=redirect.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"redirect.js","sourceRoot":"","sources":["../../../../src/controller/oauth/redirect.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,WAAmB,EACnB,MAAqD,EAC7C,EAAE;IACV,MAAM,GAAG,GAAQ,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;IAEtC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QACxD,CAAC;aAAM,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YAC/B,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC,IAAI,CAAC;AAClB,CAAC,CAAC"}
|
@@ -1,142 +0,0 @@
|
|
1
|
-
import type { IOAuthController, OAuthReq, OAuthTokenReq, OAuthTokenRes, Profile, SAMLResponsePayload, OIDCAuthzResponsePayload } from '../typings';
|
2
|
-
export declare class OAuthController implements IOAuthController {
|
3
|
-
private connectionStore;
|
4
|
-
private sessionStore;
|
5
|
-
private codeStore;
|
6
|
-
private tokenStore;
|
7
|
-
private ssoTraces;
|
8
|
-
private opts;
|
9
|
-
private ssoHandler;
|
10
|
-
private idFedApp;
|
11
|
-
constructor({ connectionStore, sessionStore, codeStore, tokenStore, ssoTraces, opts, idFedApp }: {
|
12
|
-
connectionStore: any;
|
13
|
-
sessionStore: any;
|
14
|
-
codeStore: any;
|
15
|
-
tokenStore: any;
|
16
|
-
ssoTraces: any;
|
17
|
-
opts: any;
|
18
|
-
idFedApp: any;
|
19
|
-
});
|
20
|
-
authorize(body: OAuthReq): Promise<{
|
21
|
-
redirect_url?: string;
|
22
|
-
authorize_form?: string;
|
23
|
-
}>;
|
24
|
-
samlResponse(body: SAMLResponsePayload): Promise<{
|
25
|
-
redirect_url?: string;
|
26
|
-
app_select_form?: string;
|
27
|
-
response_form?: string;
|
28
|
-
}>;
|
29
|
-
oidcAuthzResponse(body: OIDCAuthzResponsePayload): Promise<{
|
30
|
-
redirect_url?: string;
|
31
|
-
response_form?: string;
|
32
|
-
}>;
|
33
|
-
private _buildAuthorizationCode;
|
34
|
-
/**
|
35
|
-
* @swagger
|
36
|
-
*
|
37
|
-
* /oauth/token:
|
38
|
-
* post:
|
39
|
-
* summary: Code exchange
|
40
|
-
* operationId: oauth-code-exchange
|
41
|
-
* tags:
|
42
|
-
* - OAuth
|
43
|
-
* consumes:
|
44
|
-
* - application/x-www-form-urlencoded
|
45
|
-
* parameters:
|
46
|
-
* - name: grant_type
|
47
|
-
* in: formData
|
48
|
-
* type: string
|
49
|
-
* description: Grant type should be 'authorization_code'
|
50
|
-
* default: authorization_code
|
51
|
-
* required: true
|
52
|
-
* - name: client_id
|
53
|
-
* in: formData
|
54
|
-
* type: string
|
55
|
-
* description: Use the client_id returned by the SAML connection API
|
56
|
-
* required: true
|
57
|
-
* - name: client_secret
|
58
|
-
* in: formData
|
59
|
-
* type: string
|
60
|
-
* description: Use the client_secret returned by the SAML connection API
|
61
|
-
* required: true
|
62
|
-
* - name: code_verifier
|
63
|
-
* in: formData
|
64
|
-
* type: string
|
65
|
-
* description: code_verifier against the code_challenge in the authz request (relevant to PKCE flow)
|
66
|
-
* - name: redirect_uri
|
67
|
-
* in: formData
|
68
|
-
* type: string
|
69
|
-
* description: Redirect URI
|
70
|
-
* required: true
|
71
|
-
* - name: code
|
72
|
-
* in: formData
|
73
|
-
* type: string
|
74
|
-
* description: Code
|
75
|
-
* required: true
|
76
|
-
* responses:
|
77
|
-
* '200':
|
78
|
-
* description: Success
|
79
|
-
* schema:
|
80
|
-
* type: object
|
81
|
-
* properties:
|
82
|
-
* access_token:
|
83
|
-
* type: string
|
84
|
-
* token_type:
|
85
|
-
* type: string
|
86
|
-
* expires_in:
|
87
|
-
* type: string
|
88
|
-
* example:
|
89
|
-
* access_token: 8958e13053832b5af58fdf2ee83f35f5d013dc74
|
90
|
-
* token_type: bearer
|
91
|
-
* expires_in: 300
|
92
|
-
*/
|
93
|
-
token(body: OAuthTokenReq, authHeader?: string | null): Promise<OAuthTokenRes>;
|
94
|
-
/**
|
95
|
-
* @swagger
|
96
|
-
*
|
97
|
-
* /oauth/userinfo:
|
98
|
-
* get:
|
99
|
-
* summary: Get profile
|
100
|
-
* operationId: oauth-get-profile
|
101
|
-
* tags:
|
102
|
-
* - OAuth
|
103
|
-
* responses:
|
104
|
-
* '200':
|
105
|
-
* description: Success
|
106
|
-
* schema:
|
107
|
-
* type: object
|
108
|
-
* properties:
|
109
|
-
* id:
|
110
|
-
* type: string
|
111
|
-
* email:
|
112
|
-
* type: string
|
113
|
-
* firstName:
|
114
|
-
* type: string
|
115
|
-
* lastName:
|
116
|
-
* type: string
|
117
|
-
* roles:
|
118
|
-
* type: array
|
119
|
-
* items:
|
120
|
-
* type: string
|
121
|
-
* groups:
|
122
|
-
* type: array
|
123
|
-
* items:
|
124
|
-
* type: string
|
125
|
-
* raw:
|
126
|
-
* type: object
|
127
|
-
* requested:
|
128
|
-
* type: object
|
129
|
-
* example:
|
130
|
-
* id: 32b5af58fdf
|
131
|
-
* email: jackson@coolstartup.com
|
132
|
-
* firstName: SAML
|
133
|
-
* lastName: Jackson
|
134
|
-
* raw: {
|
135
|
-
*
|
136
|
-
* }
|
137
|
-
* requested: {
|
138
|
-
*
|
139
|
-
* }
|
140
|
-
*/
|
141
|
-
userInfo(token: string): Promise<Profile>;
|
142
|
-
}
|