keycloak-api-manager 2.0.8 → 2.0.10
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 +21 -14
- 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="66482000" />
|
|
83
83
|
</task>
|
|
84
84
|
<servers />
|
|
85
85
|
</component>
|
package/index.js
CHANGED
|
@@ -44,8 +44,9 @@ exports.configure=async function(adminClientCredentials){
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
kcAdminClient= new keycloakAdminClient(configAdminclient);
|
|
47
|
-
configAdminclient.
|
|
48
|
-
configAdminclient.
|
|
47
|
+
configAdminclient.clientId=adminClientCredentials.clientId;
|
|
48
|
+
configAdminclient.clientSecret=adminClientCredentials.clientSecret;
|
|
49
|
+
|
|
49
50
|
|
|
50
51
|
let tokenLifeSpan= (adminClientCredentials.tokenLifeSpan *1000)/2;
|
|
51
52
|
delete adminClientCredentials.baseUrl;
|
|
@@ -105,23 +106,29 @@ exports.getToken=function(configToOverride){
|
|
|
105
106
|
//TODO: Remove da documentare
|
|
106
107
|
//permette ad un utente o un client di autenticarsi su keycloack ed oottenere un token
|
|
107
108
|
exports.auth=async function(credentials){
|
|
108
|
-
credentials.client_id=configAdminclient.
|
|
109
|
-
credentials.client_secret=configAdminclient.
|
|
109
|
+
credentials.client_id=configAdminclient.clientId;
|
|
110
|
+
credentials.client_secret=configAdminclient.clientSecret;
|
|
110
111
|
let options={
|
|
111
|
-
url: `${configAdminclient.baseUrl}
|
|
112
|
-
headers: {'
|
|
113
|
-
contentType: 'application/www-form-urlencoded',
|
|
112
|
+
url: `${configAdminclient.baseUrl}realms/${configAdminclient.realmName}/protocol/openid-connect/token` ,
|
|
113
|
+
headers: {'content-type': 'application/www-form-urlencoded', 'Authorization': "Bearer " + kcAdminClient.accessToken },
|
|
114
114
|
form: credentials
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
return new Promise((resolve, reject) => {
|
|
120
|
+
request.post(options, function (error, response, body) {
|
|
121
|
+
if (error) {
|
|
122
|
+
console.error("Internal Server Error:", error);
|
|
123
|
+
reject(error);
|
|
124
|
+
} else {
|
|
125
|
+
resolve(JSON.parse(body)); // ✅ restituisce il valore al chiamante
|
|
126
|
+
}
|
|
127
|
+
});
|
|
123
128
|
});
|
|
124
|
-
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
|
|
125
132
|
|
|
126
133
|
|
|
127
134
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keycloak-api-manager",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
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": {
|