feat: get api added for fetch provider list
This commit is contained in:
@@ -260,6 +260,7 @@ export class InfraResolver {
|
|||||||
@Query(() => [String], {
|
@Query(() => [String], {
|
||||||
description: 'Allowed Auth Provider list',
|
description: 'Allowed Auth Provider list',
|
||||||
})
|
})
|
||||||
|
@UseGuards(GqlAuthGuard, GqlAdminGuard)
|
||||||
allowedAuthProviders() {
|
allowedAuthProviders() {
|
||||||
return this.infraConfigService.getAllowedAuthProviders();
|
return this.infraConfigService.getAllowedAuthProviders();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,12 @@ export class AuthController {
|
|||||||
private configService: ConfigService,
|
private configService: ConfigService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
@Get('providers')
|
||||||
|
async getAuthProviders() {
|
||||||
|
const providers = await this.authService.getAuthProviders();
|
||||||
|
return { providers };
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Route to initiate magic-link auth for a users email
|
** Route to initiate magic-link auth for a users email
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { MicrosoftStrategy } from './strategies/microsoft.strategy';
|
|||||||
import { AuthProvider, authProviderCheck } from './helper';
|
import { AuthProvider, authProviderCheck } from './helper';
|
||||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||||
import { loadInfraConfiguration } from 'src/infra-config/helper';
|
import { loadInfraConfiguration } from 'src/infra-config/helper';
|
||||||
|
import { InfraConfigModule } from 'src/infra-config/infra-config.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -26,6 +27,7 @@ import { loadInfraConfiguration } from 'src/infra-config/helper';
|
|||||||
secret: configService.get('JWT_SECRET'),
|
secret: configService.get('JWT_SECRET'),
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
InfraConfigModule,
|
||||||
],
|
],
|
||||||
providers: [AuthService, JwtStrategy, RTJwtStrategy],
|
providers: [AuthService, JwtStrategy, RTJwtStrategy],
|
||||||
controllers: [AuthController],
|
controllers: [AuthController],
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import { AuthUser, IsAdmin } from 'src/types/AuthUser';
|
|||||||
import { VerificationToken } from '@prisma/client';
|
import { VerificationToken } from '@prisma/client';
|
||||||
import { Origin } from './helper';
|
import { Origin } from './helper';
|
||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
|
import { InfraConfigService } from 'src/infra-config/infra-config.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthService {
|
export class AuthService {
|
||||||
@@ -38,6 +39,7 @@ export class AuthService {
|
|||||||
private jwtService: JwtService,
|
private jwtService: JwtService,
|
||||||
private readonly mailerService: MailerService,
|
private readonly mailerService: MailerService,
|
||||||
private readonly configService: ConfigService,
|
private readonly configService: ConfigService,
|
||||||
|
private infraConfigService: InfraConfigService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -381,4 +383,8 @@ export class AuthService {
|
|||||||
|
|
||||||
return E.right(<IsAdmin>{ isAdmin: false });
|
return E.right(<IsAdmin>{ isAdmin: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getAuthProviders() {
|
||||||
|
return this.infraConfigService.getAllowedAuthProviders();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user