FEAT: list identity providers link for sso

This commit is contained in:
marcos-silva-rodrigues
2025-07-14 15:16:19 -03:00
parent 8cb7144ff4
commit c9bfe68ea5
6 changed files with 50 additions and 5 deletions
@@ -144,6 +144,21 @@ export class IdentityProviderController {
return await this.identityProviderService.getTokenByIdp(code, state);
}
@Get('/links')
@HttpCode(HttpStatus.OK)
async providerLinks(@Req() req: Request) {
this.logger.info('GET /identity-providers/links');
const frontDomain = req.headers['origin'] as string;
if (!frontDomain) {
throw new Error(ErrorCodes.IDENTITY_PROVIDER.INVALID_HEADER);
}
const result = await this.identityProviderService.identityProvidersLinksPerDomain(frontDomain);
return result;
}
@Get(':id')
@HttpCode(HttpStatus.OK)
@Redirect()
@@ -156,4 +171,5 @@ export class IdentityProviderController {
url: redirectUrl,
};
}
}
@@ -153,4 +153,10 @@ export class IdentityProviderService implements OnModuleInit {
);
}
async identityProvidersLinksPerDomain(frontDomain: string) {
return await lastValueFrom(
this.identityProviderService.GetProviderLinksFromDomain({ frontDomain }),
);
}
}