mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-18 13:49:09 +00:00
refactor(auth): expose verifyAccessToken (was private validateJwtToken)
Co-Authored-By: WOZCODE <contact@withwoz.com>
This commit is contained in:
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user