kubeblocks-auth0-actions
v0.6.1
Published
Secrets allow you to securely define secret or privileged values that can be accessed in your running code as properties of the event.secrets object.
Downloads
123
Readme
Auth0 Action Secret
Secrets allow you to securely define secret or privileged values that can be accessed in your running code as properties of the event.secrets object.
export type Secrets = {
OPENAPI_ENDPOINT: string, // apecloud openapi Endpoint
OPENAPI_ADMIN_TOKEN: string, // apecloud openapi admin basic token
AUTH0_DOMAIN: string,
AUTH0_SPA_CLIENT_ID: string,
AUTH0_M2M_CLIENT_ID: string,
AUTH0_M2M_CLIENT_SECRET: string,
}
const secret: Secrets = {
...
...
...
};
const TOKEN = Buffer.from(JSON.stringify(secret)).toString("base64");
PreUserRegistrationEvent
// @ts-nocheck
/**
* Handler that will be called during the execution of a PreUserRegistration flow.
*
* @param {PreUserRegistrationEvent} event - Details about the context and user that is attempting to register.
* @param {PreUserRegistrationAPI} api - Interface whose methods can be used to change the behavior of the signup.
*/
const { KubeblocksAuth0Actions } = require('kubeblocks-auth0-actions');
exports.onExecutePreUserRegistration = async (event, api) => {
const { onExecutePreUserRegistration } = new KubeblocksAuth0Actions(event.secrets.TOKEN)
onExecutePreUserRegistration(event, api)
};
onExecutePostUserRegistration
/**
* Handler that will be called during the execution of a PostUserRegistration flow.
*
* @param {Event} event - Details about the context and user that has registered.
* @param {PostUserRegistrationAPI} api - Methods and utilities to help change the behavior after a signup.
*/
const { KubeblocksAuth0Actions } = require('kubeblocks-auth0-actions');
exports.onExecutePostUserRegistration = async (event, api) => {
const { onExecutePostUserRegistration } = new KubeblocksAuth0Actions(event.secrets.TOKEN)
onExecutePostUserRegistration(event, api)
};
onExecutePostLogin
/**
* Handler that will be called during the execution of a PostLogin flow.
*
* @param {Event} event - Details about the user and the context in which they are logging in.
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
*/
const { KubeblocksAuth0Actions } = require('kubeblocks-auth0-actions');
exports.onExecutePostLogin = async (event, api) => {
const { onExecutePostLogin } = new KubeblocksAuth0Actions(event.secrets.TOKEN);
onExecutePostLogin(event, api);
};
/**
* Handler that will be invoked when this action is resuming after an external redirect. If your
* onExecutePostLogin function does not perform a redirect, this function can be safely ignored.
*
* @param {Event} event - Details about the user and the context in which they are logging in.
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
*/
// exports.onContinuePostLogin = async (event, api) => {
// };