Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianP8701 committed Sep 30, 2024
1 parent 6832adc commit 2d15226
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/src/utils/auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ import { container } from '../di/container';
import { UserService } from '../../services/UserService';
import { AuthenticatedRequest } from './AuthRequest';
import { logger } from '../logging/logger';
import { SecretService } from '../../services/SecretService';

export const checkAuthenticated = async (req: AuthenticatedRequest, _res: Response, next: NextFunction) => {
try {
const secretService = container.get(SecretService);
const isEnvLocal = secretService.getEnvVars().MODE === 'local';
if (!isEnvLocal) {
logger.info('Authenticating user: ', JSON.stringify(req.auth, null, 2));
}
const sessionClaim = req.auth?.sessionClaims;
if (sessionClaim) {
const user = await container.get(UserService).getOrCreateUser(sessionClaim);
Expand Down

0 comments on commit 2d15226

Please sign in to comment.