Skip to content

Commit

Permalink
docs(core-auth0-actions): Add inline documentation comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alllenshibu committed Dec 14, 2024
1 parent 8b3f78b commit 516aed5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apps/core-auth0-actions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# core-auth0-actiions

This is a collection of Auth0 actions that can be used to extend the functionality of Auth0. This project is not built
and deployed as a standalone application. Instead, these actions have to be manually copied pasted into the Auth0
dashboard under the appropriate action. Any changes to this project does not automatically reflect in the Auth0
dashboard. The changes have to be manually copied over.
6 changes: 6 additions & 0 deletions apps/core-auth0-actions/src/controllers/newuser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import { Request, Response } from 'express';

import prisma from '../utils/database';

/**
* Add new user to database on register. This is a must because Auth0 has no connection with our database. Not
* performing this action will result in a mismatch between the user in Auth0 and the user in our database.
* @param req
* @param res
*/
export const addNewUserToDatabaseOnRegister = async (req: Request, res: Response) => {
try {
const { userId, email } = req.body;
Expand Down
6 changes: 6 additions & 0 deletions apps/core-auth0-actions/src/controllers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import { Request, Response } from 'express';

import prisma from '../utils/database';

/**
* Get user's permissions under an organization. This gets executed when the user logs in and Auth0 action for log in is
* triggered.
* @param req
* @param res
*/
export const getUserPermissions = async (req: Request, res: Response) => {
try {
const { userId } = req.query;
Expand Down
6 changes: 6 additions & 0 deletions apps/core-auth0-actions/src/middlewares/auth.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { Request, Response, NextFunction } from 'express';

/**
* Middleware to authorize requests reaching Auth0 actions.
* @param req
* @param res
* @param next
*/
export const authorize = (req: Request, res: Response, next: NextFunction) => {
const { authorization } = req.headers;

Expand Down

0 comments on commit 516aed5

Please sign in to comment.