Authenticate an authSessionId by sending it to the Identityprovder-App. In case of success a DvelopUser object will be available in the request.dvelopContext.user
-property.
If the authSessionId is not validated data is anonimously available on the internet.
import { authenticationMiddleware } from "@dvelop-sdk/express-utils";
app.use(authenticationMiddleware);
Sets a DvelopContext to the express-request-object. Accessable via the req.dvelopContext
-property.
import { contextMiddleware } from "@dvelop-sdk/express-utils";
app.use(contextMiddleware);
app.use((req: Request, _: Response, next: NextFunction) => {
console.log(req.dvelopContext);
next();
});
Validate the cloud-center-event signature against your appSecret.
The cloud-center-event signature should be validated for every request when recieving events from the d.velop cloud-center. Refer to the d.velop cloud center API for more information.
import { validateCloudCenterEventSignatureMiddlewareFactory } from "@dvelop-sdk/express-utils";
app.use("/some/route/dvelop-cloud-lifecycle-event", validateCloudCenterEventSignatureMiddlewareFactory(process.env.APP_SECRET));
Validate the cloud-center-event signature against your appSecret.
The cloud-center-event signature should be validated for every request when recieving events from the d.velop cloud-center. Refer to the d.velop cloud center API for more information.
import { validateCloudCenterEventSignatureMiddlewareFactory } from "@dvelop-sdk/express-utils";
app.use("/some/route/dvelop-cloud-lifecycle-event", validateCloudCenterEventSignatureMiddlewareFactory(process.env.APP_SECRET));
Validate the cloud-center-event signature against your appSecret. You can supply a custom validate-function.
Validate the cloud-center-event signature against your appSecret. You can supply a custom validate-function.
Validate the requestSignature against the requestData your appSecret.
Requires the dvelopContext
-propertiy to be set. See {@link dvelopContextMiddleware}.
The requestSignature should be validated for every request when recieving calls from the d.velop cloud. Refer to the d.velop basics tenant header section for more information.
import { validateSignatureMiddlewareFactory } from "@dvelop-sdk/express-utils";
app.use(validateSignatureMiddlewareFactory(process.env.APP_SECRET));
Validate the requestSignature against the requestData your appSecret.
Requires the dvelopContext
-propertiy to be set. See {@link dvelopContextMiddleware}.
The requestSignature should be validated for every request when recieving calls from the d.velop cloud. Refer to the d.velop basics tenant header section for more information.
import { validateSignatureMiddlewareFactory } from "@dvelop-sdk/express-utils";
app.use(validateSignatureMiddlewareFactory(process.env.APP_SECRET));
Validate the requestSignature against the requestData your appSecret. You can supply a custom validate-function.
Validate the requestSignature against the requestData your appSecret. You can supply a custom validate-function.
Redirect a request to the login page provided by the Identityprovider-App.
import { redirectToLoginPage, UnauthorizedError } from "@dvelop-sdk/express-utils";
app.use((err, req, res, next) => {
if (err instanceof UnauthorizedError && req.accepts("text/html")) {
redirectToLoginPage(req, res);
} else {
res.status(401).send("Unauhtorized") // For Content-Types such as JSON return a 401 - Unauthorized
}
});
Generated using TypeDoc
@dvelop-sdk/express-utils
This package contains util-functions for the express-framework and d.velop app-building.
Explore the docs » Install via npm » Check us out on GitHub »