mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-10 03:49:08 +00:00
FEAT: list identity providers link for sso
This commit is contained in:
@@ -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 }),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user