diff --git a/src/modules/auth/auth.service.ts b/src/modules/auth/auth.service.ts index 8539d0e..8ca6844 100644 --- a/src/modules/auth/auth.service.ts +++ b/src/modules/auth/auth.service.ts @@ -307,7 +307,7 @@ export class AuthClientService implements OnModuleInit { } public async validateUserSession(accessToken: any, resourceHost: string) { - const payload = await this.validateJwtToken(accessToken); + const payload = await this.verifyAccessToken(accessToken); const userDto = await this.getUserfromPayload(payload); @@ -410,7 +410,12 @@ export class AuthClientService implements OnModuleInit { this.logger.info('Clean cookie sessions'); } - private async validateJwtToken(token: string) { + /** + * Verify a DUC access token against the JWKS and return its payload. + * Public so the /auth/module-identity route can authenticate the ddf-auth + * cookie the same way (was the private validateJwtToken). + */ + public async verifyAccessToken(token: string) { const decoded: any = token && jwt.decode(token, { complete: true }); if (!decoded) throw new Error('Invalid token');