keycloak-api-manager 2.0.6 → 2.0.8
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/.idea/workspace.xml +1 -1
- package/index.js +10 -5
- package/package.json +1 -1
package/.idea/workspace.xml
CHANGED
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
<option name="presentableId" value="Default" />
|
|
80
80
|
<updated>1759849149064</updated>
|
|
81
81
|
<workItem from="1759849150239" duration="1214000" />
|
|
82
|
-
<workItem from="1759917554117" duration="
|
|
82
|
+
<workItem from="1759917554117" duration="64760000" />
|
|
83
83
|
</task>
|
|
84
84
|
<servers />
|
|
85
85
|
</component>
|
package/index.js
CHANGED
|
@@ -39,11 +39,14 @@ let configAdminclient=null;
|
|
|
39
39
|
*/
|
|
40
40
|
exports.configure=async function(adminClientCredentials){
|
|
41
41
|
configAdminclient={
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
baseUrl:adminClientCredentials.baseUrl,
|
|
43
|
+
realmName:adminClientCredentials.realmName
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
kcAdminClient= new keycloakAdminClient(configAdminclient);
|
|
47
|
+
configAdminclient.client_id=adminClientCredentials.client_id;
|
|
48
|
+
configAdminclient.client_secret=adminClientCredentials.client_secret;
|
|
49
|
+
|
|
47
50
|
let tokenLifeSpan= (adminClientCredentials.tokenLifeSpan *1000)/2;
|
|
48
51
|
delete adminClientCredentials.baseUrl;
|
|
49
52
|
delete adminClientCredentials.realmName;
|
|
@@ -101,19 +104,21 @@ exports.getToken=function(configToOverride){
|
|
|
101
104
|
|
|
102
105
|
//TODO: Remove da documentare
|
|
103
106
|
//permette ad un utente o un client di autenticarsi su keycloack ed oottenere un token
|
|
104
|
-
exports.auth=function(credentials){
|
|
107
|
+
exports.auth=async function(credentials){
|
|
108
|
+
credentials.client_id=configAdminclient.client_id;
|
|
109
|
+
credentials.client_secret=configAdminclient.client_secret;
|
|
105
110
|
let options={
|
|
106
111
|
url: `${configAdminclient.baseUrl}/realms/${configAdminclient.realmName}/protocol/openid-connect/token` ,
|
|
107
112
|
headers: {'Authorization': 'Bearer ' + kcAdminClient.accessToken},
|
|
108
113
|
contentType: 'application/www-form-urlencoded',
|
|
109
|
-
|
|
114
|
+
form: credentials
|
|
110
115
|
}
|
|
111
116
|
|
|
112
117
|
request.post(options, function (error, response, body) {
|
|
113
118
|
if(error){
|
|
114
119
|
console.log("Internal Server Error:", error);
|
|
115
120
|
}else{
|
|
116
|
-
|
|
121
|
+
return(body);
|
|
117
122
|
}
|
|
118
123
|
});
|
|
119
124
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keycloak-api-manager",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "Keycloak-api-manager is a lightweight Node.js wrapper for the Keycloak Admin REST API. It provides an easy-to-use functional methods and functions to manage realms, users, roles, clients, groups, and permissions directly from your application code — just like you would from the Keycloak admin console.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|