change public app name for oauth

This commit is contained in:
lendry
2026-06-26 11:00:48 +03:00
parent b81c0cedbb
commit 489b4d4a23
8 changed files with 130 additions and 8 deletions

View File

@@ -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);

View File

@@ -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))];
}