Constructor
new IDP(root, realm, client)
Example
const idp = new IDP("https://idp.leadershipfactor.com", "Company X", "portal1");
Parameters:
| Name | Type | Description |
|---|---|---|
root |
string | Root URL for the IDP that manages this client |
realm |
string | The name of the IDP realm that controls this client |
client |
string | The name of this "client" i.e. the application or site name as defined on the IDP |
Methods
(inner) del(url, data) → {Promise}
Deletes a resource asynchronously from the IDP via an HTTP DELETE method.
Example
idp.del(`users/${userid}/role-mappings/realm`, [oldRole]).catch(err => console.log(err));
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string | URL of the endpoint to invoke on the IDP. Omit the root, including its traling slash |
data |
object | Data identifying the resource to be removed |
Returns:
- Type
- Promise
(inner) get(url) → {Promise}
Fetches a resource asynchronously from the IDP via an HTTP GET method. This is an idempotent method.
Example
idp.get("roles")
.then(roles => {
// Do something with roles here
}
.catch(err => {
// Something went wrong
console.log(err);
});
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string | URL of the endpoint to invoke on the IDP. Omit the root, including its traling slash |
Returns:
- Type
- Promise
(inner) post(url, data) → {Promise}
Creates a new resource asynchronously on the IDP via an HTTP POST method.
Example
idp.post(`users/${userid}/role-mappings/realm`, [newRole]).catch(err => console.log(err));
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string | URL of the endpoint to invoke on the IDP. Omit the root, including its traling slash |
data |
object | Data to apply as the update |
Returns:
- Type
- Promise
(inner) put(url, data) → {Promise}
Updates a resource asynchronously on the IDP via an HTTP PUT method. This is an idempotent method.
Example
idp.put(`users/${userid}`, { enabled: true }).catch(err => console.log(err))
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string | URL of the endpoint to invoke on the IDP. Omit the root, including its traling slash |
data |
object | JSON-encoded data to apply as the update |
Returns:
- Type
- Promise