@stackfactor/client-api 1.1.98 → 1.1.100
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/exports.js +2 -0
- package/lib/security.js +49 -0
- package/package.json +1 -1
package/exports.js
CHANGED
|
@@ -28,6 +28,7 @@ import logger from "./lib/logger.js";
|
|
|
28
28
|
import microSkillsQuizes from "./lib/microSkillsQuizes.js";
|
|
29
29
|
import role from "./lib/role.js";
|
|
30
30
|
import roleTemplate from "./lib/roleTemplate.js";
|
|
31
|
+
import security from "./lib/security.js";
|
|
31
32
|
import skill from "./lib/skill.js";
|
|
32
33
|
import skillAssessment from "./lib/skillAssessments.js";
|
|
33
34
|
import skillAssessmentTestingSession from "./lib/skillAssessmentTestingSession.js";
|
|
@@ -66,6 +67,7 @@ export {
|
|
|
66
67
|
RESPONSE_TYPE,
|
|
67
68
|
role,
|
|
68
69
|
roleTemplate,
|
|
70
|
+
security,
|
|
69
71
|
shouldReturnError,
|
|
70
72
|
skill,
|
|
71
73
|
skillAssessment,
|
package/lib/security.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { client } from "./axiosClient.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Get the enabled authentication connections for current organization.
|
|
5
|
+
* @param {String} authToken - Authorization token
|
|
6
|
+
* @returns {Promise<Object>}
|
|
7
|
+
*/
|
|
8
|
+
const getAuthConnection = (authToken) => {
|
|
9
|
+
return new Promise(function (resolve, reject) {
|
|
10
|
+
const getConfigInformationRequest = client.get(
|
|
11
|
+
`api/v1/security/getauthconnection`,
|
|
12
|
+
{ headers: { authorization: authToken } }
|
|
13
|
+
);
|
|
14
|
+
getConfigInformationRequest
|
|
15
|
+
.then((response) => {
|
|
16
|
+
resolve(response.data);
|
|
17
|
+
})
|
|
18
|
+
.catch((error) => {
|
|
19
|
+
reject(error);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Set the enabled authentication connections for current organization.
|
|
26
|
+
* @param {Object} data - the object containing the updated configuration
|
|
27
|
+
* @param {String} authToken - Authorization token
|
|
28
|
+
*/
|
|
29
|
+
const setAuthConnection = (data, authToken) => {
|
|
30
|
+
return new Promise(function (resolve, reject) {
|
|
31
|
+
const setConfigInformationRequest = client.post(
|
|
32
|
+
`api/v1/security/setauthconnection`,
|
|
33
|
+
{ data: data },
|
|
34
|
+
{ headers: { authorization: authToken } }
|
|
35
|
+
);
|
|
36
|
+
setConfigInformationRequest
|
|
37
|
+
.then((response) => {
|
|
38
|
+
resolve(response.data);
|
|
39
|
+
})
|
|
40
|
+
.catch((error) => {
|
|
41
|
+
reject(error);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default {
|
|
47
|
+
getAuthConnection,
|
|
48
|
+
setAuthConnection,
|
|
49
|
+
};
|