Returns an {@link AuthSession} based on an API-Key. API-Keys can be generated by d.velop cloud tenant administrators. The AuthSessionId should be kept secret and never be publicly available.
import { getAuthSession } from "@dvelop-sdk/identityprovider";
const authSession = await getAuthSession({
systemBaseUri: "https://monster-ag.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
});
console.log(authSession);
Returns an authSessionId for the given user. All requests with this authSessionId will be in that users name. The AuthSessionId should be kept secret and never be publicly available.
import { getImpersonatedAuthSessionId } from "@dvelop-sdk/identityprovider";
const authSessionId = await getImpersonatedAuthSessionId({
systemBaseUri: "https://monster-ag.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ" // has to be an AppSession
}, {
userId: "XiFkyR35v2Y"
});
console.log(authSessionId);
Returns the URI a request should be redirected to in case it does not contain a valid authSessionId. Redirected requests will display a HTML Login for users to authenticate.
const redirectionUri = getLoginRedirectionUri("https://monster-ag.d-velop.cloud/cda-compliance/feature");
redirect(redirectionUri); // respond with 302
Request an appSession for your app. The appSession will be sent via POST to your defined callback. Do not forget to validate the appSessionId via the validateAppSessionSignature-function
import { requestAppSession } from "@dvelop-sdk/identityprovider";
await requestAppSession({
systemBaseUri: "https://monster-ag.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
}, {
appName: "cda-compliance",
callback: "/cda-compliance/appsession"
});
Validate the sign value which is provided when an appSession is sent to your app. For further information on this process refer to the documentation.
try {
validateAppSessionSignature("cda-compliance", "qP-7GNoDJ5c", requestBody); //pass or error
} catch(e) {
// respond with 403 - Forbidden
}
}
Validates an AuthSessionId and returns a DvelopUser.
import { validateAuthSessionId } from "@dvelop-sdk/identityprovider";
const user: DvelopUser = await validateAuthSessionId({
systemBaseUri: "https://monster-ag.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
});
console.log(user.displayName) //Mike Glotzkowski
Generated using TypeDoc
@dvelop-sdk/identityprovider
This package contains functionality for the Identityprovider-App in the d.velop cloud.
Explore the docs » Install via npm » Check us out on GitHub »