@rockcarver/frodo-lib 0.18.9-2 → 0.18.9-4
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 +13 -1
- package/cjs/api/ApiTypes.js.map +1 -1
- package/cjs/api/OAuth2ClientApi.js +41 -11
- package/cjs/api/OAuth2ClientApi.js.map +1 -1
- package/cjs/api/OAuth2OIDCApi.js +4 -1
- package/cjs/api/OAuth2OIDCApi.js.map +1 -1
- package/cjs/api/OAuth2ProviderApi.js +5 -2
- package/cjs/api/OAuth2ProviderApi.js.map +1 -1
- package/cjs/index.js +3 -1
- package/cjs/index.js.map +1 -1
- package/cjs/ops/AdminOps.js +15 -15
- package/cjs/ops/AdminOps.js.map +1 -1
- package/cjs/ops/AuthenticateOps.js +69 -33
- package/cjs/ops/AuthenticateOps.js.map +1 -1
- package/cjs/ops/OAuth2ClientOps.js +347 -130
- package/cjs/ops/OAuth2ClientOps.js.map +1 -1
- package/cjs/ops/OAuth2ClientOps.test.js.map +1 -0
- package/cjs/ops/OAuth2ProviderOps.js +23 -0
- package/cjs/ops/OAuth2ProviderOps.js.map +1 -0
- package/cjs/ops/utils/OpsUtils.js +10 -0
- package/cjs/ops/utils/OpsUtils.js.map +1 -1
- package/esm/api/OAuth2ClientApi.mjs +35 -11
- package/esm/api/OAuth2OIDCApi.mjs +4 -1
- package/esm/api/OAuth2ProviderApi.mjs +5 -2
- package/esm/index.mjs +1 -0
- package/esm/ops/AdminOps.mjs +10 -10
- package/esm/ops/AuthenticateOps.mjs +69 -33
- package/esm/ops/OAuth2ClientOps.mjs +285 -95
- package/esm/ops/OAuth2ClientOps.test.mjs +1471 -0
- package/esm/ops/OAuth2ProviderOps.mjs +10 -0
- package/esm/ops/utils/OpsUtils.mjs +9 -0
- package/package.json +1 -1
- package/types/api/ApiTypes.d.ts +42 -0
- package/types/api/ApiTypes.d.ts.map +1 -1
- package/types/api/OAuth2ClientApi.d.ts +16 -9
- package/types/api/OAuth2ClientApi.d.ts.map +1 -1
- package/types/api/OAuth2OIDCApi.d.ts +1 -1
- package/types/api/OAuth2OIDCApi.d.ts.map +1 -1
- package/types/api/OAuth2ProviderApi.d.ts +2 -2
- package/types/api/OAuth2ProviderApi.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/ops/AdminOps.d.ts.map +1 -1
- package/types/ops/AuthenticateOps.d.ts.map +1 -1
- package/types/ops/OAuth2ClientOps.d.ts +76 -14
- package/types/ops/OAuth2ClientOps.d.ts.map +1 -1
- package/types/ops/OAuth2ProviderOps.d.ts +5 -0
- package/types/ops/OAuth2ProviderOps.d.ts.map +1 -0
- package/types/ops/utils/OpsUtils.d.ts +6 -0
- package/types/ops/utils/OpsUtils.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.18.9-4] - 2023-04-20
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- \#236: Frodo now properly handles logging in as a tenant admin when admin federation is enabled.
|
|
15
|
+
|
|
16
|
+
## [0.18.9-3] - 2023-04-18
|
|
17
|
+
|
|
10
18
|
## [0.18.9-2] - 2023-04-05
|
|
11
19
|
|
|
12
20
|
## [0.18.9-1] - 2023-03-27
|
|
@@ -1087,7 +1095,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1087
1095
|
- Fixed problem with adding connection profiles
|
|
1088
1096
|
- Miscellaneous bug fixes
|
|
1089
1097
|
|
|
1090
|
-
[Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.18.9-
|
|
1098
|
+
[Unreleased]: https://github.com/rockcarver/frodo-lib/compare/v0.18.9-4...HEAD
|
|
1099
|
+
|
|
1100
|
+
[0.18.9-4]: https://github.com/rockcarver/frodo-lib/compare/v0.18.9-3...v0.18.9-4
|
|
1101
|
+
|
|
1102
|
+
[0.18.9-3]: https://github.com/rockcarver/frodo-lib/compare/v0.18.9-2...v0.18.9-3
|
|
1091
1103
|
|
|
1092
1104
|
[0.18.9-2]: https://github.com/rockcarver/frodo-lib/compare/v0.18.9-1...v0.18.9-2
|
|
1093
1105
|
|
package/cjs/api/ApiTypes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiTypes.js","names":["ScriptLanguage","ScriptContext","Saml2ProiderLocation"],"sources":["api/ApiTypes.ts"],"sourcesContent":["export interface ObjectSkeletonInterface {\n _id: string;\n _rev?: number;\n [k: string]:\n | string\n | number\n | boolean\n | string[]\n | ObjectSkeletonInterface\n | object\n | null;\n}\n\nexport interface UiConfigInterface {\n categories: string;\n}\n\nexport interface NodeRefSkeletonInterface {\n connections: Record<string, string>;\n displayName: string;\n nodeType: string;\n x: number;\n y: number;\n}\n\nexport interface InnerNodeRefSkeletonInterface {\n _id: string;\n displayName: string;\n nodeType: string;\n}\n\nexport type TreeSkeleton = ObjectSkeletonInterface & {\n entryNodeId: string;\n nodes: Record<string, NodeRefSkeletonInterface>;\n identityResource?: string;\n uiConfig?: UiConfigInterface;\n enabled?: boolean;\n};\n\nexport type AmServiceType = ObjectSkeletonInterface & {\n name: string;\n};\n\nexport type NodeSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n nodes?: InnerNodeRefSkeletonInterface[];\n tree?: string;\n identityResource?: string;\n};\n\nexport type SocialIdpSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n enabled: boolean;\n};\n\nexport type AmServiceSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n};\n\nexport type AgentSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n};\n\nexport type EmailTemplateSkeleton = ObjectSkeletonInterface & {\n defaultLocale?: string;\n displayName?: string;\n enabled?: boolean;\n from: string;\n subject: Record<string, string>;\n};\n\nexport type ThemeSkeleton = ObjectSkeletonInterface & {\n name: string;\n isDefault: boolean;\n linkedTrees: string[];\n};\n\nexport type UiThemeRealmObject = ObjectSkeletonInterface & {\n name: string;\n realm: Map<string, ThemeSkeleton[]>;\n};\n\nexport enum ScriptLanguage {\n GROOVY,\n JAVASCRIPT,\n}\n\nexport enum ScriptContext {\n OAUTH2_ACCESS_TOKEN_MODIFICATION,\n AUTHENTICATION_CLIENT_SIDE,\n AUTHENTICATION_TREE_DECISION_NODE,\n AUTHENTICATION_SERVER_SIDE,\n SOCIAL_IDP_PROFILE_TRANSFORMATION,\n OAUTH2_VALIDATE_SCOPE,\n CONFIG_PROVIDER_NODE,\n OAUTH2_AUTHORIZE_ENDPOINT_DATA_PROVIDER,\n OAUTH2_EVALUATE_SCOPE,\n POLICY_CONDITION,\n OIDC_CLAIMS,\n SAML2_IDP_ADAPTER,\n SAML2_IDP_ATTRIBUTE_MAPPER,\n OAUTH2_MAY_ACT,\n}\n\nexport type ScriptSkeleton = ObjectSkeletonInterface & {\n name: string;\n description: string;\n default: boolean;\n script: string | string[];\n language: keyof typeof ScriptLanguage;\n context: keyof typeof ScriptContext;\n createdBy: string;\n creationDate: number;\n lastModifiedBy: string;\n lastModifiedDate: number;\n};\n\nexport enum Saml2ProiderLocation {\n HOSTED = 'hosted',\n REMOTE = 'remote',\n}\n\nexport type Saml2ProviderStub = ObjectSkeletonInterface & {\n entityId: string;\n location: Saml2ProiderLocation;\n roles: string[];\n};\n\nexport type Saml2ProviderSkeleton = ObjectSkeletonInterface & {\n entityId: string;\n entityLocation: Saml2ProiderLocation;\n serviceProvider: unknown;\n identityProvider: unknown;\n attributeQueryProvider: unknown;\n xacmlPolicyEnforcementPoint: unknown;\n};\n\nexport type CircleOfTrustSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n status: string;\n trustedProviders: string[];\n};\n\nexport type PagedResult<Result> = {\n result: Result[];\n resultCount: number;\n pagedResultsCookie: string;\n totalPagedResultsPolicy: 'EXACT';\n totalPagedResults: number;\n remainingPagedResults: number;\n};\n"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"ApiTypes.js","names":["ScriptLanguage","ScriptContext","Saml2ProiderLocation"],"sources":["api/ApiTypes.ts"],"sourcesContent":["export interface ObjectSkeletonInterface {\n _id: string;\n _rev?: number;\n [k: string]:\n | string\n | number\n | boolean\n | string[]\n | ObjectSkeletonInterface\n | object\n | null;\n}\n\nexport interface PagedResults {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result: any[];\n resultCount: number;\n pagedResultsCookie: string;\n totalPagedResultsPolicy: string;\n totalPagedResults: number;\n remainingPagedResults: number;\n}\n\nexport interface UiConfigInterface {\n categories: string;\n}\n\nexport interface NodeRefSkeletonInterface {\n connections: Record<string, string>;\n displayName: string;\n nodeType: string;\n x: number;\n y: number;\n}\n\nexport interface InnerNodeRefSkeletonInterface {\n _id: string;\n displayName: string;\n nodeType: string;\n}\n\nexport type TreeSkeleton = ObjectSkeletonInterface & {\n entryNodeId: string;\n nodes: Record<string, NodeRefSkeletonInterface>;\n identityResource?: string;\n uiConfig?: UiConfigInterface;\n enabled?: boolean;\n};\n\nexport type AmServiceType = ObjectSkeletonInterface & {\n name: string;\n};\n\nexport type NodeSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n nodes?: InnerNodeRefSkeletonInterface[];\n tree?: string;\n identityResource?: string;\n};\n\nexport type SocialIdpSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n enabled: boolean;\n};\n\nexport type OAuth2ClientSkeleton = ObjectSkeletonInterface & {\n overrideOAuth2ClientConfig?: {\n [k: string]: string | number | boolean | string[] | object | null;\n };\n advancedOAuth2ClientConfig?: {\n descriptions: {\n inherited: boolean;\n value: string[];\n };\n [k: string]: string | number | boolean | string[] | object | null;\n };\n signEncOAuth2ClientConfig?: {\n [k: string]: string | number | boolean | string[] | object | null;\n };\n coreOpenIDClientConfig?: {\n [k: string]: string | number | boolean | string[] | object | null;\n };\n coreOAuth2ClientConfig?: {\n userpassword?: null;\n clientName?: {\n inherited: boolean;\n value: string[];\n };\n accessTokenLifetime?: {\n inherited: boolean;\n value: number;\n };\n [k: string]: string | number | boolean | string[] | object | null;\n };\n coreUmaClientConfig?: {\n [k: string]: string | number | boolean | string[] | object | null;\n };\n _type: AmServiceType;\n};\n\nexport type AmServiceSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n};\n\nexport type AgentSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n};\n\nexport type EmailTemplateSkeleton = ObjectSkeletonInterface & {\n defaultLocale?: string;\n displayName?: string;\n enabled?: boolean;\n from: string;\n subject: Record<string, string>;\n};\n\nexport type ThemeSkeleton = ObjectSkeletonInterface & {\n name: string;\n isDefault: boolean;\n linkedTrees: string[];\n};\n\nexport type UiThemeRealmObject = ObjectSkeletonInterface & {\n name: string;\n realm: Map<string, ThemeSkeleton[]>;\n};\n\nexport enum ScriptLanguage {\n GROOVY,\n JAVASCRIPT,\n}\n\nexport enum ScriptContext {\n OAUTH2_ACCESS_TOKEN_MODIFICATION,\n AUTHENTICATION_CLIENT_SIDE,\n AUTHENTICATION_TREE_DECISION_NODE,\n AUTHENTICATION_SERVER_SIDE,\n SOCIAL_IDP_PROFILE_TRANSFORMATION,\n OAUTH2_VALIDATE_SCOPE,\n CONFIG_PROVIDER_NODE,\n OAUTH2_AUTHORIZE_ENDPOINT_DATA_PROVIDER,\n OAUTH2_EVALUATE_SCOPE,\n POLICY_CONDITION,\n OIDC_CLAIMS,\n SAML2_IDP_ADAPTER,\n SAML2_IDP_ATTRIBUTE_MAPPER,\n OAUTH2_MAY_ACT,\n}\n\nexport type ScriptSkeleton = ObjectSkeletonInterface & {\n name: string;\n description: string;\n default: boolean;\n script: string | string[];\n language: keyof typeof ScriptLanguage;\n context: keyof typeof ScriptContext;\n createdBy: string;\n creationDate: number;\n lastModifiedBy: string;\n lastModifiedDate: number;\n};\n\nexport enum Saml2ProiderLocation {\n HOSTED = 'hosted',\n REMOTE = 'remote',\n}\n\nexport type Saml2ProviderStub = ObjectSkeletonInterface & {\n entityId: string;\n location: Saml2ProiderLocation;\n roles: string[];\n};\n\nexport type Saml2ProviderSkeleton = ObjectSkeletonInterface & {\n entityId: string;\n entityLocation: Saml2ProiderLocation;\n serviceProvider: unknown;\n identityProvider: unknown;\n attributeQueryProvider: unknown;\n xacmlPolicyEnforcementPoint: unknown;\n};\n\nexport type CircleOfTrustSkeleton = ObjectSkeletonInterface & {\n _type: AmServiceType;\n status: string;\n trustedProviders: string[];\n};\n\nexport type PagedResult<Result> = {\n result: Result[];\n resultCount: number;\n pagedResultsCookie: string;\n totalPagedResultsPolicy: 'EXACT';\n totalPagedResults: number;\n remainingPagedResults: number;\n};\n"],"mappings":";;;;;;IAiIYA,cAAc;AAAA;AAAA,WAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;AAAA,GAAdA,cAAc,8BAAdA,cAAc;AAAA,IAKdC,aAAa;AAAA;AAAA,WAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;EAAbA,aAAa,CAAbA,aAAa;AAAA,GAAbA,aAAa,6BAAbA,aAAa;AAAA,IA8BbC,oBAAoB;AAAA;AAAA,WAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;AAAA,GAApBA,oBAAoB,oCAApBA,oBAAoB"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.deleteOAuth2Client = deleteOAuth2Client;
|
|
6
7
|
exports.getOAuth2Client = getOAuth2Client;
|
|
7
8
|
exports.getOAuth2Clients = getOAuth2Clients;
|
|
8
9
|
exports.putOAuth2Client = putOAuth2Client;
|
|
@@ -28,22 +29,25 @@ var getApiConfig = () => {
|
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
31
|
* Get OAuth2 Clients
|
|
31
|
-
* @returns {Promise} a promise that resolves to
|
|
32
|
+
* @returns {Promise<PagedResults>} a promise that resolves to a PagedResults object containing an array of oauth2client objects
|
|
32
33
|
*/
|
|
33
34
|
function getOAuth2Clients() {
|
|
34
35
|
return _getOAuth2Clients.apply(this, arguments);
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
37
38
|
* Get OAuth2 Client
|
|
38
|
-
* @param {
|
|
39
|
-
* @returns {Promise} a promise that resolves to an
|
|
39
|
+
* @param {string} id client id
|
|
40
|
+
* @returns {Promise<OAuth2ClientSkeleton>} a promise that resolves to an oauth2 client object
|
|
40
41
|
*/
|
|
41
42
|
function _getOAuth2Clients() {
|
|
42
43
|
_getOAuth2Clients = _asyncToGenerator(function* () {
|
|
43
44
|
var urlString = _util.default.format(oauth2ClientListURLTemplate, state.getHost(), (0, _ApiUtils.getCurrentRealmPath)());
|
|
44
|
-
|
|
45
|
+
var {
|
|
46
|
+
data
|
|
47
|
+
} = yield (0, _BaseApi.generateAmApi)(getApiConfig()).get(urlString, {
|
|
45
48
|
withCredentials: true
|
|
46
49
|
});
|
|
50
|
+
return data;
|
|
47
51
|
});
|
|
48
52
|
return _getOAuth2Clients.apply(this, arguments);
|
|
49
53
|
}
|
|
@@ -52,34 +56,60 @@ function getOAuth2Client(_x) {
|
|
|
52
56
|
}
|
|
53
57
|
/**
|
|
54
58
|
* Put OAuth2 Client
|
|
55
|
-
* @param {
|
|
56
|
-
* @param {
|
|
57
|
-
* @returns {Promise} a promise that resolves to an
|
|
59
|
+
* @param {string} id client id
|
|
60
|
+
* @param {OAuth2ClientSkeleton} clientData oauth2client object
|
|
61
|
+
* @returns {Promise<OAuth2ClientSkeleton>} a promise that resolves to an oauth2 client object
|
|
58
62
|
*/
|
|
59
63
|
function _getOAuth2Client() {
|
|
60
64
|
_getOAuth2Client = _asyncToGenerator(function* (id) {
|
|
61
65
|
var urlString = _util.default.format(oauth2ClientURLTemplate, state.getHost(), (0, _ApiUtils.getCurrentRealmPath)(), id);
|
|
62
|
-
|
|
66
|
+
var {
|
|
67
|
+
data
|
|
68
|
+
} = yield (0, _BaseApi.generateAmApi)(getApiConfig()).get(urlString, {
|
|
63
69
|
withCredentials: true
|
|
64
70
|
});
|
|
71
|
+
return data;
|
|
65
72
|
});
|
|
66
73
|
return _getOAuth2Client.apply(this, arguments);
|
|
67
74
|
}
|
|
68
75
|
function putOAuth2Client(_x2, _x3) {
|
|
69
76
|
return _putOAuth2Client.apply(this, arguments);
|
|
70
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Delete OAuth2 Client
|
|
80
|
+
* @param {string} id OAuth2 Client
|
|
81
|
+
* @returns {Promise<OAuth2ClientSkeleton>} a promise that resolves to an oauth2client object
|
|
82
|
+
*/
|
|
71
83
|
function _putOAuth2Client() {
|
|
72
|
-
_putOAuth2Client = _asyncToGenerator(function* (id,
|
|
84
|
+
_putOAuth2Client = _asyncToGenerator(function* (id, clientData) {
|
|
73
85
|
// until we figure out a way to use transport keys in Frodo,
|
|
74
86
|
// we'll have to drop those encrypted attributes.
|
|
75
|
-
var client = (0, _ApiUtils.deleteDeepByKey)(
|
|
87
|
+
var client = (0, _ApiUtils.deleteDeepByKey)(clientData, '-encrypted');
|
|
76
88
|
delete client._provider;
|
|
77
89
|
delete client._rev;
|
|
78
90
|
var urlString = _util.default.format(oauth2ClientURLTemplate, state.getHost(), (0, _ApiUtils.getCurrentRealmPath)(), id);
|
|
79
|
-
|
|
91
|
+
var {
|
|
92
|
+
data
|
|
93
|
+
} = yield (0, _BaseApi.generateAmApi)(getApiConfig()).put(urlString, client, {
|
|
80
94
|
withCredentials: true
|
|
81
95
|
});
|
|
96
|
+
return data;
|
|
82
97
|
});
|
|
83
98
|
return _putOAuth2Client.apply(this, arguments);
|
|
84
99
|
}
|
|
100
|
+
function deleteOAuth2Client(_x4) {
|
|
101
|
+
return _deleteOAuth2Client.apply(this, arguments);
|
|
102
|
+
}
|
|
103
|
+
function _deleteOAuth2Client() {
|
|
104
|
+
_deleteOAuth2Client = _asyncToGenerator(function* (id) {
|
|
105
|
+
var urlString = _util.default.format(oauth2ClientURLTemplate, state.getHost(), (0, _ApiUtils.getCurrentRealmPath)(), id);
|
|
106
|
+
var {
|
|
107
|
+
data
|
|
108
|
+
} = yield (0, _BaseApi.generateAmApi)(getApiConfig()).delete(urlString, {
|
|
109
|
+
withCredentials: true
|
|
110
|
+
});
|
|
111
|
+
return data;
|
|
112
|
+
});
|
|
113
|
+
return _deleteOAuth2Client.apply(this, arguments);
|
|
114
|
+
}
|
|
85
115
|
//# sourceMappingURL=OAuth2ClientApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuth2ClientApi.js","names":["oauth2ClientURLTemplate","oauth2ClientListURLTemplate","apiVersion","getApiConfig","configPath","getCurrentRealmPath","path","getOAuth2Clients","urlString","util","format","state","getHost","generateAmApi","get","withCredentials","getOAuth2Client","id","putOAuth2Client","
|
|
1
|
+
{"version":3,"file":"OAuth2ClientApi.js","names":["oauth2ClientURLTemplate","oauth2ClientListURLTemplate","apiVersion","getApiConfig","configPath","getCurrentRealmPath","path","getOAuth2Clients","urlString","util","format","state","getHost","data","generateAmApi","get","withCredentials","getOAuth2Client","id","putOAuth2Client","clientData","client","deleteDeepByKey","_provider","_rev","put","deleteOAuth2Client","delete"],"sources":["api/OAuth2ClientApi.ts"],"sourcesContent":["import util from 'util';\nimport { generateAmApi } from './BaseApi';\nimport { deleteDeepByKey, getCurrentRealmPath } from './utils/ApiUtils';\nimport * as state from '../shared/State';\nimport { OAuth2ClientSkeleton, PagedResults } from './ApiTypes';\n\nconst oauth2ClientURLTemplate = '%s/json%s/realm-config/agents/OAuth2Client/%s';\nconst oauth2ClientListURLTemplate =\n '%s/json%s/realm-config/agents/OAuth2Client?_queryFilter=true';\nconst apiVersion = 'protocol=2.1,resource=1.0';\nconst getApiConfig = () => {\n const configPath = getCurrentRealmPath();\n return {\n path: `${configPath}/realm-config/agents/OAuth2Client`,\n apiVersion,\n };\n};\n\n/**\n * Get OAuth2 Clients\n * @returns {Promise<PagedResults>} a promise that resolves to a PagedResults object containing an array of oauth2client objects\n */\nexport async function getOAuth2Clients(): Promise<PagedResults> {\n const urlString = util.format(\n oauth2ClientListURLTemplate,\n state.getHost(),\n getCurrentRealmPath()\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Get OAuth2 Client\n * @param {string} id client id\n * @returns {Promise<OAuth2ClientSkeleton>} a promise that resolves to an oauth2 client object\n */\nexport async function getOAuth2Client(\n id: string\n): Promise<OAuth2ClientSkeleton> {\n const urlString = util.format(\n oauth2ClientURLTemplate,\n state.getHost(),\n getCurrentRealmPath(),\n id\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Put OAuth2 Client\n * @param {string} id client id\n * @param {OAuth2ClientSkeleton} clientData oauth2client object\n * @returns {Promise<OAuth2ClientSkeleton>} a promise that resolves to an oauth2 client object\n */\nexport async function putOAuth2Client(\n id: string,\n clientData: OAuth2ClientSkeleton\n): Promise<OAuth2ClientSkeleton> {\n // until we figure out a way to use transport keys in Frodo,\n // we'll have to drop those encrypted attributes.\n const client = deleteDeepByKey(clientData, '-encrypted');\n delete client._provider;\n delete client._rev;\n const urlString = util.format(\n oauth2ClientURLTemplate,\n state.getHost(),\n getCurrentRealmPath(),\n id\n );\n const { data } = await generateAmApi(getApiConfig()).put(urlString, client, {\n withCredentials: true,\n });\n return data;\n}\n\n/**\n * Delete OAuth2 Client\n * @param {string} id OAuth2 Client\n * @returns {Promise<OAuth2ClientSkeleton>} a promise that resolves to an oauth2client object\n */\nexport async function deleteOAuth2Client(\n id: string\n): Promise<OAuth2ClientSkeleton> {\n const urlString = util.format(\n oauth2ClientURLTemplate,\n state.getHost(),\n getCurrentRealmPath(),\n id\n );\n const { data } = await generateAmApi(getApiConfig()).delete(urlString, {\n withCredentials: true,\n });\n return data;\n}\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AAAyC;AAAA;AAAA;AAAA;AAAA;AAGzC,IAAMA,uBAAuB,GAAG,+CAA+C;AAC/E,IAAMC,2BAA2B,GAC/B,8DAA8D;AAChE,IAAMC,UAAU,GAAG,2BAA2B;AAC9C,IAAMC,YAAY,GAAG,MAAM;EACzB,IAAMC,UAAU,GAAG,IAAAC,6BAAmB,GAAE;EACxC,OAAO;IACLC,IAAI,YAAKF,UAAU,sCAAmC;IACtDF;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AAHA,SAIsBK,gBAAgB;EAAA;AAAA;AAYtC;AACA;AACA;AACA;AACA;AAJA;EAAA,sCAZO,aAAyD;IAC9D,IAAMC,SAAS,GAAGC,aAAI,CAACC,MAAM,CAC3BT,2BAA2B,EAC3BU,KAAK,CAACC,OAAO,EAAE,EACf,IAAAP,6BAAmB,GAAE,CACtB;IACD,IAAM;MAAEQ;IAAK,CAAC,SAAS,IAAAC,sBAAa,EAACX,YAAY,EAAE,CAAC,CAACY,GAAG,CAACP,SAAS,EAAE;MAClEQ,eAAe,EAAE;IACnB,CAAC,CAAC;IACF,OAAOH,IAAI;EACb,CAAC;EAAA;AAAA;AAAA,SAOqBI,eAAe;EAAA;AAAA;AAerC;AACA;AACA;AACA;AACA;AACA;AALA;EAAA,qCAfO,WACLC,EAAU,EACqB;IAC/B,IAAMV,SAAS,GAAGC,aAAI,CAACC,MAAM,CAC3BV,uBAAuB,EACvBW,KAAK,CAACC,OAAO,EAAE,EACf,IAAAP,6BAAmB,GAAE,EACrBa,EAAE,CACH;IACD,IAAM;MAAEL;IAAK,CAAC,SAAS,IAAAC,sBAAa,EAACX,YAAY,EAAE,CAAC,CAACY,GAAG,CAACP,SAAS,EAAE;MAClEQ,eAAe,EAAE;IACnB,CAAC,CAAC;IACF,OAAOH,IAAI;EACb,CAAC;EAAA;AAAA;AAAA,SAQqBM,eAAe;EAAA;AAAA;AAqBrC;AACA;AACA;AACA;AACA;AAJA;EAAA,qCArBO,WACLD,EAAU,EACVE,UAAgC,EACD;IAC/B;IACA;IACA,IAAMC,MAAM,GAAG,IAAAC,yBAAe,EAACF,UAAU,EAAE,YAAY,CAAC;IACxD,OAAOC,MAAM,CAACE,SAAS;IACvB,OAAOF,MAAM,CAACG,IAAI;IAClB,IAAMhB,SAAS,GAAGC,aAAI,CAACC,MAAM,CAC3BV,uBAAuB,EACvBW,KAAK,CAACC,OAAO,EAAE,EACf,IAAAP,6BAAmB,GAAE,EACrBa,EAAE,CACH;IACD,IAAM;MAAEL;IAAK,CAAC,SAAS,IAAAC,sBAAa,EAACX,YAAY,EAAE,CAAC,CAACsB,GAAG,CAACjB,SAAS,EAAEa,MAAM,EAAE;MAC1EL,eAAe,EAAE;IACnB,CAAC,CAAC;IACF,OAAOH,IAAI;EACb,CAAC;EAAA;AAAA;AAAA,SAOqBa,kBAAkB;EAAA;AAAA;AAAA;EAAA,wCAAjC,WACLR,EAAU,EACqB;IAC/B,IAAMV,SAAS,GAAGC,aAAI,CAACC,MAAM,CAC3BV,uBAAuB,EACvBW,KAAK,CAACC,OAAO,EAAE,EACf,IAAAP,6BAAmB,GAAE,EACrBa,EAAE,CACH;IACD,IAAM;MAAEL;IAAK,CAAC,SAAS,IAAAC,sBAAa,EAACX,YAAY,EAAE,CAAC,CAACwB,MAAM,CAACnB,SAAS,EAAE;MACrEQ,eAAe,EAAE;IACnB,CAAC,CAAC;IACF,OAAOH,IAAI;EACb,CAAC;EAAA;AAAA"}
|
package/cjs/api/OAuth2OIDCApi.js
CHANGED
|
@@ -97,9 +97,12 @@ function _clientCredentialsGrant() {
|
|
|
97
97
|
grant_type: 'client_credentials',
|
|
98
98
|
scope
|
|
99
99
|
};
|
|
100
|
-
|
|
100
|
+
var {
|
|
101
|
+
data
|
|
102
|
+
} = yield (0, _BaseApi.generateOauth2Api)(getApiConfig(), requestOverride).post(urlString, _qs.default.stringify(requestBody), {
|
|
101
103
|
withCredentials: true
|
|
102
104
|
});
|
|
105
|
+
return data;
|
|
103
106
|
});
|
|
104
107
|
return _clientCredentialsGrant.apply(this, arguments);
|
|
105
108
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuth2OIDCApi.js","names":["authorizeUrlTemplate","accessTokenUrlTemplate","tokenInfoUrlTemplate","apiVersion","getApiConfig","authorize","data","config","authorizeURL","util","format","state","getHost","generateOauth2Api","post","accessToken","accessTokenURL","getTokenInfo","get","clientCredentialsGrant","clientId","clientSecret","scope","urlString","getCurrentRealmPath","requestOverride","headers","Authorization","encode","requestBody","grant_type","qs","stringify","withCredentials"],"sources":["api/OAuth2OIDCApi.ts"],"sourcesContent":["import util from 'util';\nimport qs from 'qs';\nimport { generateOauth2Api } from './BaseApi';\nimport { getCurrentRealmPath } from './utils/ApiUtils';\nimport * as state from '../shared/State';\nimport { encode } from './utils/Base64';\nimport { AxiosRequestConfig } from 'axios';\n\nconst authorizeUrlTemplate = '%s/oauth2%s/authorize';\nconst accessTokenUrlTemplate = '%s/oauth2%s/access_token';\nconst tokenInfoUrlTemplate = '%s/oauth2%s/tokeninfo';\nconst apiVersion = 'protocol=2.1,resource=1.0';\nconst getApiConfig = () => ({\n apiVersion,\n});\n\n/**\n * Perform the authorization step of the authorization code grant flow\n * @param {String} data body form data\n * @param {Object} config axios request config object\n * @returns {Promise} a promise resolving to an object containing the authorization server response object\n */\nexport async function authorize(data, config: AxiosRequestConfig = {}) {\n const authorizeURL = util.format(authorizeUrlTemplate, state.getHost(), '');\n return generateOauth2Api(getApiConfig()).post(authorizeURL, data, config);\n}\n\n/**\n * Perform access token request step of the authorization code grant flow\n * @param {*} data body form data\n * @param {*} config config axios request config object\n * @returns {Promise} a promise resolving to an object containing the authorization server response object containing the access token\n */\nexport async function accessToken(data, config: AxiosRequestConfig = {}) {\n const accessTokenURL = util.format(\n accessTokenUrlTemplate,\n state.getHost(),\n ''\n );\n return generateOauth2Api(getApiConfig()).post(accessTokenURL, data, config);\n}\n\nexport async function getTokenInfo(config: AxiosRequestConfig = {}) {\n const accessTokenURL = util.format(tokenInfoUrlTemplate, state.getHost(), '');\n const { data } = await generateOauth2Api(getApiConfig()).get(\n accessTokenURL,\n config\n );\n return data;\n}\n\n/**\n * Perform client credentials grant flow\n * @param {String} clientId client id\n * @param {String} clientSecret client secret\n * @param {String} scope space-delimited scope list\n * @returns {Promise} a promise resolving to an object containing the authorization server response object\n */\nexport async function clientCredentialsGrant(clientId, clientSecret, scope) {\n const urlString = util.format(\n accessTokenUrlTemplate,\n state.getHost(),\n getCurrentRealmPath()\n );\n const requestOverride = {\n headers: {\n Authorization: `Basic ${encode(`${clientId}:${clientSecret}`)}`,\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n };\n const requestBody = {\n grant_type: 'client_credentials',\n scope,\n };\n
|
|
1
|
+
{"version":3,"file":"OAuth2OIDCApi.js","names":["authorizeUrlTemplate","accessTokenUrlTemplate","tokenInfoUrlTemplate","apiVersion","getApiConfig","authorize","data","config","authorizeURL","util","format","state","getHost","generateOauth2Api","post","accessToken","accessTokenURL","getTokenInfo","get","clientCredentialsGrant","clientId","clientSecret","scope","urlString","getCurrentRealmPath","requestOverride","headers","Authorization","encode","requestBody","grant_type","qs","stringify","withCredentials"],"sources":["api/OAuth2OIDCApi.ts"],"sourcesContent":["import util from 'util';\nimport qs from 'qs';\nimport { generateOauth2Api } from './BaseApi';\nimport { getCurrentRealmPath } from './utils/ApiUtils';\nimport * as state from '../shared/State';\nimport { encode } from './utils/Base64';\nimport { AxiosRequestConfig } from 'axios';\n\nconst authorizeUrlTemplate = '%s/oauth2%s/authorize';\nconst accessTokenUrlTemplate = '%s/oauth2%s/access_token';\nconst tokenInfoUrlTemplate = '%s/oauth2%s/tokeninfo';\nconst apiVersion = 'protocol=2.1,resource=1.0';\nconst getApiConfig = () => ({\n apiVersion,\n});\n\n/**\n * Perform the authorization step of the authorization code grant flow\n * @param {String} data body form data\n * @param {Object} config axios request config object\n * @returns {Promise} a promise resolving to an object containing the authorization server response object\n */\nexport async function authorize(data, config: AxiosRequestConfig = {}) {\n const authorizeURL = util.format(authorizeUrlTemplate, state.getHost(), '');\n return generateOauth2Api(getApiConfig()).post(authorizeURL, data, config);\n}\n\n/**\n * Perform access token request step of the authorization code grant flow\n * @param {*} data body form data\n * @param {*} config config axios request config object\n * @returns {Promise} a promise resolving to an object containing the authorization server response object containing the access token\n */\nexport async function accessToken(data, config: AxiosRequestConfig = {}) {\n const accessTokenURL = util.format(\n accessTokenUrlTemplate,\n state.getHost(),\n ''\n );\n return generateOauth2Api(getApiConfig()).post(accessTokenURL, data, config);\n}\n\nexport async function getTokenInfo(config: AxiosRequestConfig = {}) {\n const accessTokenURL = util.format(tokenInfoUrlTemplate, state.getHost(), '');\n const { data } = await generateOauth2Api(getApiConfig()).get(\n accessTokenURL,\n config\n );\n return data;\n}\n\n/**\n * Perform client credentials grant flow\n * @param {String} clientId client id\n * @param {String} clientSecret client secret\n * @param {String} scope space-delimited scope list\n * @returns {Promise} a promise resolving to an object containing the authorization server response object\n */\nexport async function clientCredentialsGrant(clientId, clientSecret, scope) {\n const urlString = util.format(\n accessTokenUrlTemplate,\n state.getHost(),\n getCurrentRealmPath()\n );\n const requestOverride = {\n headers: {\n Authorization: `Basic ${encode(`${clientId}:${clientSecret}`)}`,\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n };\n const requestBody = {\n grant_type: 'client_credentials',\n scope,\n };\n const { data } = await generateOauth2Api(\n getApiConfig(),\n requestOverride\n ).post(urlString, qs.stringify(requestBody), { withCredentials: true });\n return data;\n}\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAAwC;AAAA;AAAA;AAAA;AAAA;AAGxC,IAAMA,oBAAoB,GAAG,uBAAuB;AACpD,IAAMC,sBAAsB,GAAG,0BAA0B;AACzD,IAAMC,oBAAoB,GAAG,uBAAuB;AACpD,IAAMC,UAAU,GAAG,2BAA2B;AAC9C,IAAMC,YAAY,GAAG,OAAO;EAC1BD;AACF,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AALA,SAMsBE,SAAS;EAAA;AAAA;AAK/B;AACA;AACA;AACA;AACA;AACA;AALA;EAAA,+BALO,WAAyBC,IAAI,EAAmC;IAAA,IAAjCC,MAA0B,uEAAG,CAAC,CAAC;IACnE,IAAMC,YAAY,GAAGC,aAAI,CAACC,MAAM,CAACV,oBAAoB,EAAEW,KAAK,CAACC,OAAO,EAAE,EAAE,EAAE,CAAC;IAC3E,OAAO,IAAAC,0BAAiB,EAACT,YAAY,EAAE,CAAC,CAACU,IAAI,CAACN,YAAY,EAAEF,IAAI,EAAEC,MAAM,CAAC;EAC3E,CAAC;EAAA;AAAA;AAAA,SAQqBQ,WAAW;EAAA;AAAA;AAAA;EAAA,iCAA1B,WAA2BT,IAAI,EAAmC;IAAA,IAAjCC,MAA0B,uEAAG,CAAC,CAAC;IACrE,IAAMS,cAAc,GAAGP,aAAI,CAACC,MAAM,CAChCT,sBAAsB,EACtBU,KAAK,CAACC,OAAO,EAAE,EACf,EAAE,CACH;IACD,OAAO,IAAAC,0BAAiB,EAACT,YAAY,EAAE,CAAC,CAACU,IAAI,CAACE,cAAc,EAAEV,IAAI,EAAEC,MAAM,CAAC;EAC7E,CAAC;EAAA;AAAA;AAAA,SAEqBU,YAAY;EAAA;AAAA;AASlC;AACA;AACA;AACA;AACA;AACA;AACA;AANA;EAAA,kCATO,aAA6D;IAAA,IAAjCV,MAA0B,uEAAG,CAAC,CAAC;IAChE,IAAMS,cAAc,GAAGP,aAAI,CAACC,MAAM,CAACR,oBAAoB,EAAES,KAAK,CAACC,OAAO,EAAE,EAAE,EAAE,CAAC;IAC7E,IAAM;MAAEN;IAAK,CAAC,SAAS,IAAAO,0BAAiB,EAACT,YAAY,EAAE,CAAC,CAACc,GAAG,CAC1DF,cAAc,EACdT,MAAM,CACP;IACD,OAAOD,IAAI;EACb,CAAC;EAAA;AAAA;AAAA,SASqBa,sBAAsB;EAAA;AAAA;AAAA;EAAA,4CAArC,WAAsCC,QAAQ,EAAEC,YAAY,EAAEC,KAAK,EAAE;IAC1E,IAAMC,SAAS,GAAGd,aAAI,CAACC,MAAM,CAC3BT,sBAAsB,EACtBU,KAAK,CAACC,OAAO,EAAE,EACf,IAAAY,6BAAmB,GAAE,CACtB;IACD,IAAMC,eAAe,GAAG;MACtBC,OAAO,EAAE;QACPC,aAAa,kBAAW,IAAAC,YAAM,YAAIR,QAAQ,cAAIC,YAAY,EAAG,CAAE;QAC/D,cAAc,EAAE;MAClB;IACF,CAAC;IACD,IAAMQ,WAAW,GAAG;MAClBC,UAAU,EAAE,oBAAoB;MAChCR;IACF,CAAC;IACD,IAAM;MAAEhB;IAAK,CAAC,SAAS,IAAAO,0BAAiB,EACtCT,YAAY,EAAE,EACdqB,eAAe,CAChB,CAACX,IAAI,CAACS,SAAS,EAAEQ,WAAE,CAACC,SAAS,CAACH,WAAW,CAAC,EAAE;MAAEI,eAAe,EAAE;IAAK,CAAC,CAAC;IACvE,OAAO3B,IAAI;EACb,CAAC;EAAA;AAAA"}
|
|
@@ -25,7 +25,7 @@ var getApiConfig = () => {
|
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Get OAuth2 Provider
|
|
28
|
-
* @returns {Promise} a promise that resolves to an
|
|
28
|
+
* @returns {Promise} a promise that resolves to an OAuth2Provider object
|
|
29
29
|
*/
|
|
30
30
|
function getOAuth2Provider() {
|
|
31
31
|
return _getOAuth2Provider.apply(this, arguments);
|
|
@@ -33,9 +33,12 @@ function getOAuth2Provider() {
|
|
|
33
33
|
function _getOAuth2Provider() {
|
|
34
34
|
_getOAuth2Provider = _asyncToGenerator(function* () {
|
|
35
35
|
var urlString = _util.default.format(oauthProviderServiceURLTemplate, state.getHost(), (0, _ApiUtils.getCurrentRealmPath)());
|
|
36
|
-
|
|
36
|
+
var {
|
|
37
|
+
data
|
|
38
|
+
} = yield (0, _BaseApi.generateAmApi)(getApiConfig()).get(urlString, {
|
|
37
39
|
withCredentials: true
|
|
38
40
|
});
|
|
41
|
+
return data;
|
|
39
42
|
});
|
|
40
43
|
return _getOAuth2Provider.apply(this, arguments);
|
|
41
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuth2ProviderApi.js","names":["oauthProviderServiceURLTemplate","apiVersion","getApiConfig","configPath","getCurrentRealmPath","path","getOAuth2Provider","urlString","util","format","state","getHost","generateAmApi","get","withCredentials"],"sources":["api/OAuth2ProviderApi.ts"],"sourcesContent":["import util from 'util';\nimport { generateAmApi } from './BaseApi';\nimport { getCurrentRealmPath } from './utils/ApiUtils';\nimport * as state from '../shared/State';\n\nconst oauthProviderServiceURLTemplate =\n '%s/json%s/realm-config/services/oauth-oidc';\n\nconst apiVersion = 'protocol=2.1,resource=1.0';\nconst getApiConfig = () => {\n const configPath = getCurrentRealmPath();\n return {\n path: `${configPath}/authentication/authenticationtrees`,\n apiVersion,\n };\n};\n\n/**\n * Get OAuth2 Provider\n * @returns {Promise} a promise that resolves to an
|
|
1
|
+
{"version":3,"file":"OAuth2ProviderApi.js","names":["oauthProviderServiceURLTemplate","apiVersion","getApiConfig","configPath","getCurrentRealmPath","path","getOAuth2Provider","urlString","util","format","state","getHost","data","generateAmApi","get","withCredentials"],"sources":["api/OAuth2ProviderApi.ts"],"sourcesContent":["import util from 'util';\nimport { generateAmApi } from './BaseApi';\nimport { getCurrentRealmPath } from './utils/ApiUtils';\nimport * as state from '../shared/State';\n\nconst oauthProviderServiceURLTemplate =\n '%s/json%s/realm-config/services/oauth-oidc';\n\nconst apiVersion = 'protocol=2.1,resource=1.0';\nconst getApiConfig = () => {\n const configPath = getCurrentRealmPath();\n return {\n path: `${configPath}/authentication/authenticationtrees`,\n apiVersion,\n };\n};\n\n/**\n * Get OAuth2 Provider\n * @returns {Promise} a promise that resolves to an OAuth2Provider object\n */\nexport async function getOAuth2Provider() {\n const urlString = util.format(\n oauthProviderServiceURLTemplate,\n state.getHost(),\n getCurrentRealmPath()\n );\n const { data } = await generateAmApi(getApiConfig()).get(urlString, {\n withCredentials: true,\n });\n return data;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAAyC;AAAA;AAAA;AAAA;AAAA;AAEzC,IAAMA,+BAA+B,GACnC,4CAA4C;AAE9C,IAAMC,UAAU,GAAG,2BAA2B;AAC9C,IAAMC,YAAY,GAAG,MAAM;EACzB,IAAMC,UAAU,GAAG,IAAAC,6BAAmB,GAAE;EACxC,OAAO;IACLC,IAAI,YAAKF,UAAU,wCAAqC;IACxDF;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AAHA,SAIsBK,iBAAiB;EAAA;AAAA;AAAA;EAAA,uCAAhC,aAAmC;IACxC,IAAMC,SAAS,GAAGC,aAAI,CAACC,MAAM,CAC3BT,+BAA+B,EAC/BU,KAAK,CAACC,OAAO,EAAE,EACf,IAAAP,6BAAmB,GAAE,CACtB;IACD,IAAM;MAAEQ;IAAK,CAAC,SAAS,IAAAC,sBAAa,EAACX,YAAY,EAAE,CAAC,CAACY,GAAG,CAACP,SAAS,EAAE;MAClEQ,eAAe,EAAE;IACnB,CAAC,CAAC;IACF,OAAOH,IAAI;EACb,CAAC;EAAA;AAAA"}
|
package/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.state = exports.constants = exports.VariablesRaw = exports.Variables = exports.ValidationUtils = exports.Utils = exports.TypesRaw = exports.Types = exports.TreeRaw = exports.Theme = exports.StartupRaw = exports.Startup = exports.SocialIdentityProvidersRaw = exports.ServiceAccount = exports.Service = exports.SecretsRaw = exports.Secrets = exports.Script = exports.Saml2 = exports.Realm = exports.Organization = exports.OAuth2OIDCApi = exports.OAuth2Client = exports.NodeRaw = exports.Node = exports.ManagedObject = exports.Log = exports.LibVersion = exports.Journey = exports.Jose = exports.Info = exports.Idp = exports.IdmConfigRaw = exports.Idm = exports.ExportImportUtils = exports.EmailTemplate = exports.ConnectionProfile = exports.CirclesOfTrust = exports.Base64 = exports.AuthenticateRaw = exports.Authenticate = exports.AgentRaw = exports.Agent = exports.Admin = void 0;
|
|
6
|
+
exports.state = exports.constants = exports.VariablesRaw = exports.Variables = exports.ValidationUtils = exports.Utils = exports.TypesRaw = exports.Types = exports.TreeRaw = exports.Theme = exports.StartupRaw = exports.Startup = exports.SocialIdentityProvidersRaw = exports.ServiceAccount = exports.Service = exports.SecretsRaw = exports.Secrets = exports.Script = exports.Saml2 = exports.Realm = exports.Organization = exports.OAuth2Provider = exports.OAuth2OIDCApi = exports.OAuth2Client = exports.NodeRaw = exports.Node = exports.ManagedObject = exports.Log = exports.LibVersion = exports.Journey = exports.Jose = exports.Info = exports.Idp = exports.IdmConfigRaw = exports.Idm = exports.ExportImportUtils = exports.EmailTemplate = exports.ConnectionProfile = exports.CirclesOfTrust = exports.Base64 = exports.AuthenticateRaw = exports.Authenticate = exports.AgentRaw = exports.Agent = exports.Admin = void 0;
|
|
7
7
|
var _colors = _interopRequireDefault(require("colors"));
|
|
8
8
|
var _AgentRaw = _interopRequireWildcard(require("./api/AgentApi"));
|
|
9
9
|
exports.AgentRaw = _AgentRaw;
|
|
@@ -57,6 +57,8 @@ var _Node = _interopRequireWildcard(require("./ops/NodeOps"));
|
|
|
57
57
|
exports.Node = _Node;
|
|
58
58
|
var _OAuth2Client = _interopRequireWildcard(require("./ops/OAuth2ClientOps"));
|
|
59
59
|
exports.OAuth2Client = _OAuth2Client;
|
|
60
|
+
var _OAuth2Provider = _interopRequireWildcard(require("./ops/OAuth2ProviderOps"));
|
|
61
|
+
exports.OAuth2Provider = _OAuth2Provider;
|
|
60
62
|
var _Organization = _interopRequireWildcard(require("./ops/OrganizationOps"));
|
|
61
63
|
exports.Organization = _Organization;
|
|
62
64
|
var _Realm = _interopRequireWildcard(require("./ops/RealmOps"));
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Color","enable"],"sources":["index.ts"],"sourcesContent":["import Color from 'colors';\n\nColor.enable();\n\n// Api Layer\nexport * as AgentRaw from './api/AgentApi';\nexport * as AuthenticateRaw from './api/AuthenticateApi';\nexport * as NodeRaw from './api/NodeApi';\n// TODO: need to figure out if this is the right approach or if we should even\n// use a public oauth2/oidc library. might be ok for now since there is only\n// one place where the cli needs to execute an oauth flow.\nexport * as OAuth2OIDCApi from './api/OAuth2OIDCApi';\nexport * as SecretsRaw from './api/cloud/SecretsApi';\nexport * as SocialIdentityProvidersRaw from './api/SocialIdentityProvidersApi';\nexport * as StartupRaw from './api/cloud/StartupApi';\nexport * as TreeRaw from './api/TreeApi';\nexport * as TypesRaw from './api/ApiTypes';\nexport * as VariablesRaw from './api/cloud/VariablesApi';\nexport * as IdmConfigRaw from './api/IdmConfigApi';\n\n// Ops Layer\nexport * as Admin from './ops/AdminOps';\nexport * as Agent from './ops/AgentOps';\nexport * as Authenticate from './ops/AuthenticateOps';\nexport * as CirclesOfTrust from './ops/CirclesOfTrustOps';\nexport * as ConnectionProfile from './ops/ConnectionProfileOps';\nexport * as EmailTemplate from './ops/EmailTemplateOps';\nexport * as Idp from './ops/IdpOps';\nexport * as Idm from './ops/IdmOps';\nexport * as Info from './ops/InfoOps';\nexport * as Journey from './ops/JourneyOps';\nexport * as Jose from './ops/JoseOps';\nexport * as Log from './ops/cloud/LogOps';\nexport * as ManagedObject from './ops/ManagedObjectOps';\nexport * as Node from './ops/NodeOps';\nexport * as OAuth2Client from './ops/OAuth2ClientOps';\nexport * as Organization from './ops/OrganizationOps';\nexport * as Realm from './ops/RealmOps';\nexport * as Saml2 from './ops/Saml2Ops';\nexport * as Script from './ops/ScriptOps';\nexport * as Service from './ops/ServiceOps';\nexport * as Secrets from './ops/cloud/SecretsOps';\nexport * as ServiceAccount from './ops/cloud/ServiceAccountOps';\nexport * as Startup from './ops/cloud/StartupOps';\nexport * as Theme from './ops/ThemeOps';\nexport * as Types from './ops/OpsTypes';\nexport * as Variables from './ops/cloud/VariablesOps';\n// TODO: revisit if there are better ways\nexport * as Utils from './ops/utils/OpsUtils';\nexport * as Base64 from './api/utils/Base64';\nexport * as ValidationUtils from './ops/utils/ValidationUtils';\nexport * as LibVersion from './ops/utils/Version';\nexport * as ExportImportUtils from './ops/utils/ExportImportUtils';\n// TODO: reconsider the aproach to pass in state from client\n// lib should be stateless, an aplication should own its state\nexport * as state from './shared/State';\nexport * as constants from './storage/StaticStorage';\n"],"mappings":";;;;;;AAAA;AAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAE3BA,eAAK,CAACC,MAAM,EAAE;;AAEd"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["Color","enable"],"sources":["index.ts"],"sourcesContent":["import Color from 'colors';\n\nColor.enable();\n\n// Api Layer\nexport * as AgentRaw from './api/AgentApi';\nexport * as AuthenticateRaw from './api/AuthenticateApi';\nexport * as NodeRaw from './api/NodeApi';\n// TODO: need to figure out if this is the right approach or if we should even\n// use a public oauth2/oidc library. might be ok for now since there is only\n// one place where the cli needs to execute an oauth flow.\nexport * as OAuth2OIDCApi from './api/OAuth2OIDCApi';\nexport * as SecretsRaw from './api/cloud/SecretsApi';\nexport * as SocialIdentityProvidersRaw from './api/SocialIdentityProvidersApi';\nexport * as StartupRaw from './api/cloud/StartupApi';\nexport * as TreeRaw from './api/TreeApi';\nexport * as TypesRaw from './api/ApiTypes';\nexport * as VariablesRaw from './api/cloud/VariablesApi';\nexport * as IdmConfigRaw from './api/IdmConfigApi';\n\n// Ops Layer\nexport * as Admin from './ops/AdminOps';\nexport * as Agent from './ops/AgentOps';\nexport * as Authenticate from './ops/AuthenticateOps';\nexport * as CirclesOfTrust from './ops/CirclesOfTrustOps';\nexport * as ConnectionProfile from './ops/ConnectionProfileOps';\nexport * as EmailTemplate from './ops/EmailTemplateOps';\nexport * as Idp from './ops/IdpOps';\nexport * as Idm from './ops/IdmOps';\nexport * as Info from './ops/InfoOps';\nexport * as Journey from './ops/JourneyOps';\nexport * as Jose from './ops/JoseOps';\nexport * as Log from './ops/cloud/LogOps';\nexport * as ManagedObject from './ops/ManagedObjectOps';\nexport * as Node from './ops/NodeOps';\nexport * as OAuth2Client from './ops/OAuth2ClientOps';\nexport * as OAuth2Provider from './ops/OAuth2ProviderOps';\nexport * as Organization from './ops/OrganizationOps';\nexport * as Realm from './ops/RealmOps';\nexport * as Saml2 from './ops/Saml2Ops';\nexport * as Script from './ops/ScriptOps';\nexport * as Service from './ops/ServiceOps';\nexport * as Secrets from './ops/cloud/SecretsOps';\nexport * as ServiceAccount from './ops/cloud/ServiceAccountOps';\nexport * as Startup from './ops/cloud/StartupOps';\nexport * as Theme from './ops/ThemeOps';\nexport * as Types from './ops/OpsTypes';\nexport * as Variables from './ops/cloud/VariablesOps';\n// TODO: revisit if there are better ways\nexport * as Utils from './ops/utils/OpsUtils';\nexport * as Base64 from './api/utils/Base64';\nexport * as ValidationUtils from './ops/utils/ValidationUtils';\nexport * as LibVersion from './ops/utils/Version';\nexport * as ExportImportUtils from './ops/utils/ExportImportUtils';\n// TODO: reconsider the aproach to pass in state from client\n// lib should be stateless, an aplication should own its state\nexport * as state from './shared/State';\nexport * as constants from './storage/StaticStorage';\n"],"mappings":";;;;;;AAAA;AAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAE3BA,eAAK,CAACC,MAAM,EAAE;;AAEd"}
|
package/cjs/ops/AdminOps.js
CHANGED
|
@@ -17,11 +17,11 @@ exports.revokeOAuth2ClientAdminPrivileges = revokeOAuth2ClientAdminPrivileges;
|
|
|
17
17
|
exports.showGenericExtensionAttributes = showGenericExtensionAttributes;
|
|
18
18
|
var _fs = _interopRequireDefault(require("fs"));
|
|
19
19
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
20
|
-
var
|
|
20
|
+
var _OAuth2ClientOps = require("../ops/OAuth2ClientOps");
|
|
21
21
|
var _IdmConfigApi = require("../api/IdmConfigApi");
|
|
22
22
|
var _OpsUtils = require("./utils/OpsUtils");
|
|
23
23
|
var _OrganizationOps = require("./OrganizationOps");
|
|
24
|
-
var
|
|
24
|
+
var _OAuth2ProviderOps = require("../ops/OAuth2ProviderOps");
|
|
25
25
|
var _SecretsApi = require("../api/cloud/SecretsApi");
|
|
26
26
|
var _OAuth2OIDCApi = require("../api/OAuth2OIDCApi");
|
|
27
27
|
var _Console = require("./utils/Console");
|
|
@@ -95,7 +95,7 @@ function listOAuth2CustomClients() {
|
|
|
95
95
|
*/
|
|
96
96
|
function _listOAuth2CustomClients() {
|
|
97
97
|
_listOAuth2CustomClients = _asyncToGenerator(function* () {
|
|
98
|
-
var clients =
|
|
98
|
+
var clients = yield (0, _OAuth2ClientOps.getOAuth2Clients)();
|
|
99
99
|
clients = clients.map(client => client._id).filter(client => !protectedClients.includes(client));
|
|
100
100
|
var authentication = yield (0, _IdmConfigApi.getConfigEntity)('authentication');
|
|
101
101
|
var subjects = authentication.rsFilter.staticUserMapping.map(mapping => mapping.subject).filter(subject => !protectedSubjects.includes(subject));
|
|
@@ -150,7 +150,7 @@ function listOAuth2AdminClients() {
|
|
|
150
150
|
*/
|
|
151
151
|
function _listOAuth2AdminClients() {
|
|
152
152
|
_listOAuth2AdminClients = _asyncToGenerator(function* () {
|
|
153
|
-
var clients =
|
|
153
|
+
var clients = yield (0, _OAuth2ClientOps.getOAuth2Clients)();
|
|
154
154
|
clients = clients.filter(client => {
|
|
155
155
|
var isPrivileged = false;
|
|
156
156
|
if (client.coreOAuth2ClientConfig.scopes) {
|
|
@@ -184,7 +184,7 @@ function listNonOAuth2AdminStaticUserMappings(_x) {
|
|
|
184
184
|
}
|
|
185
185
|
function _listNonOAuth2AdminStaticUserMappings() {
|
|
186
186
|
_listNonOAuth2AdminStaticUserMappings = _asyncToGenerator(function* (showProtected) {
|
|
187
|
-
var clients =
|
|
187
|
+
var clients = yield (0, _OAuth2ClientOps.getOAuth2Clients)();
|
|
188
188
|
clients = clients.map(client => client._id).filter(client => !protectedClients.includes(client));
|
|
189
189
|
var authentication = yield (0, _IdmConfigApi.getConfigEntity)('authentication');
|
|
190
190
|
var subjects = authentication.rsFilter.staticUserMapping.filter(mapping => {
|
|
@@ -211,7 +211,7 @@ function getDynamicClientRegistrationScope() {
|
|
|
211
211
|
}
|
|
212
212
|
function _getDynamicClientRegistrationScope() {
|
|
213
213
|
_getDynamicClientRegistrationScope = _asyncToGenerator(function* () {
|
|
214
|
-
var provider =
|
|
214
|
+
var provider = yield (0, _OAuth2ProviderOps.getOAuth2Provider)();
|
|
215
215
|
return provider.clientDynamicRegistrationConfig.dynamicClientRegistrationScope;
|
|
216
216
|
});
|
|
217
217
|
return _getDynamicClientRegistrationScope.apply(this, arguments);
|
|
@@ -403,7 +403,7 @@ function grantOAuth2ClientAdminPrivileges(_x5) {
|
|
|
403
403
|
}
|
|
404
404
|
function _grantOAuth2ClientAdminPrivileges() {
|
|
405
405
|
_grantOAuth2ClientAdminPrivileges = _asyncToGenerator(function* (clientId) {
|
|
406
|
-
var client =
|
|
406
|
+
var client = yield (0, _OAuth2ClientOps.getOAuth2Client)(clientId);
|
|
407
407
|
if (client.coreOAuth2ClientConfig.clientName.value.length === 0) {
|
|
408
408
|
client.coreOAuth2ClientConfig.clientName.value = [clientId];
|
|
409
409
|
}
|
|
@@ -412,7 +412,7 @@ function _grantOAuth2ClientAdminPrivileges() {
|
|
|
412
412
|
}
|
|
413
413
|
client = yield addAdminScopes(clientId, client);
|
|
414
414
|
client = addClientCredentialsGrantType(clientId, client);
|
|
415
|
-
yield (0,
|
|
415
|
+
yield (0, _OAuth2ClientOps.putOAuth2Client)(clientId, client);
|
|
416
416
|
yield addAdminStaticUserMapping(clientId);
|
|
417
417
|
});
|
|
418
418
|
return _grantOAuth2ClientAdminPrivileges.apply(this, arguments);
|
|
@@ -509,7 +509,7 @@ function revokeOAuth2ClientAdminPrivileges(_x9) {
|
|
|
509
509
|
}
|
|
510
510
|
function _revokeOAuth2ClientAdminPrivileges() {
|
|
511
511
|
_revokeOAuth2ClientAdminPrivileges = _asyncToGenerator(function* (clientId) {
|
|
512
|
-
var client =
|
|
512
|
+
var client = yield (0, _OAuth2ClientOps.getOAuth2Client)(clientId);
|
|
513
513
|
if (client.coreOAuth2ClientConfig.clientName.value.length === 0) {
|
|
514
514
|
client.coreOAuth2ClientConfig.clientName.value = [clientId];
|
|
515
515
|
}
|
|
@@ -518,7 +518,7 @@ function _revokeOAuth2ClientAdminPrivileges() {
|
|
|
518
518
|
}
|
|
519
519
|
client = yield removeAdminScopes(clientId, client);
|
|
520
520
|
client = removeClientCredentialsGrantType(clientId, client);
|
|
521
|
-
yield (0,
|
|
521
|
+
yield (0, _OAuth2ClientOps.putOAuth2Client)(clientId, client);
|
|
522
522
|
yield removeAdminStaticUserMapping(clientId);
|
|
523
523
|
});
|
|
524
524
|
return _revokeOAuth2ClientAdminPrivileges.apply(this, arguments);
|
|
@@ -534,7 +534,7 @@ function _createOAuth2ClientWithAdminPrivileges() {
|
|
|
534
534
|
client.advancedOAuth2ClientConfig.descriptions.value = ["Created by Frodo on ".concat(new Date().toLocaleString())];
|
|
535
535
|
try {
|
|
536
536
|
client = yield addAdminScopes(clientId, client);
|
|
537
|
-
yield (0,
|
|
537
|
+
yield (0, _OAuth2ClientOps.putOAuth2Client)(clientId, client);
|
|
538
538
|
yield addAdminStaticUserMapping(clientId);
|
|
539
539
|
} catch (error) {
|
|
540
540
|
(0, _Console.printMessage)("Error creating oauth2 client: ".concat(error.message), 'error');
|
|
@@ -548,19 +548,19 @@ function createLongLivedToken(_x12, _x13, _x14, _x15, _x16) {
|
|
|
548
548
|
function _createLongLivedToken() {
|
|
549
549
|
_createLongLivedToken = _asyncToGenerator(function* (clientId, clientSecret, scope, secret, lifetime) {
|
|
550
550
|
// get oauth2 client
|
|
551
|
-
var client =
|
|
551
|
+
var client = yield (0, _OAuth2ClientOps.getOAuth2Client)(clientId);
|
|
552
552
|
client.userpassword = clientSecret;
|
|
553
553
|
// remember current lifetime
|
|
554
554
|
var rememberedLifetime = client.coreOAuth2ClientConfig.accessTokenLifetime.value || 3600;
|
|
555
555
|
// set long token lifetime
|
|
556
556
|
client.coreOAuth2ClientConfig.accessTokenLifetime.value = lifetime;
|
|
557
|
-
yield (0,
|
|
558
|
-
var response =
|
|
557
|
+
yield (0, _OAuth2ClientOps.putOAuth2Client)(clientId, client);
|
|
558
|
+
var response = yield (0, _OAuth2OIDCApi.clientCredentialsGrant)(clientId, clientSecret, scope);
|
|
559
559
|
var expires = new Date().getTime() + 1000 * response.expires_in;
|
|
560
560
|
response.expires_on = new Date(expires).toLocaleString();
|
|
561
561
|
// reset token lifetime
|
|
562
562
|
client.coreOAuth2ClientConfig.accessTokenLifetime.value = rememberedLifetime;
|
|
563
|
-
yield (0,
|
|
563
|
+
yield (0, _OAuth2ClientOps.putOAuth2Client)(clientId, client);
|
|
564
564
|
// create secret with token as value
|
|
565
565
|
var description = 'Long-lived admin token';
|
|
566
566
|
try {
|