change public app name for oauth
This commit is contained in:
@@ -826,6 +826,11 @@ export class AuthGrpcController {
|
||||
return this.oauthCore.revokeConsent(command.userId, command.consentId);
|
||||
}
|
||||
|
||||
@GrpcMethod('OAuthCoreService', 'GetOAuthClientPublicInfo')
|
||||
getOAuthClientPublicInfo(command: { clientId: string }) {
|
||||
return this.oauthCore.getClientPublicInfo(command.clientId);
|
||||
}
|
||||
|
||||
@GrpcMethod('OtpService', 'SendOtp')
|
||||
sendOtp(command: { target: string; channel: string; purpose: string; userId?: string }) {
|
||||
return this.otp.send(command);
|
||||
|
||||
@@ -307,6 +307,15 @@ export class OAuthCoreService {
|
||||
return { count: 1 };
|
||||
}
|
||||
|
||||
async getClientPublicInfo(clientId: string) {
|
||||
const client = await this.prisma.oAuthClient.findUnique({ where: { clientId } });
|
||||
if (!client?.isActive) {
|
||||
throw new BadRequestException('OAuth приложение не найдено');
|
||||
}
|
||||
|
||||
return { clientId: client.clientId, name: client.name };
|
||||
}
|
||||
|
||||
private parseScopeSlugs(scope: string) {
|
||||
return [...new Set(scope.split(/\s+/).map((item) => item.trim()).filter(Boolean))];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user