FIX: Adicionado service Faccade
All checks were successful
Deploy Dev / deploy (push) Successful in 18s
All checks were successful
Deploy Dev / deploy (push) Successful in 18s
This commit is contained in:
parent
5bd13e30f1
commit
f7a3f80efe
36
src/modules/auth/auth.service.ts
Normal file
36
src/modules/auth/auth.service.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
|
import { AuthConfigService } from './auth.config';
|
||||||
|
import { AuthResult, LoginData } from './auth.types';
|
||||||
|
import { LdapAuthProvider } from './providers/ldap-auth.provider';
|
||||||
|
import { MicrosoftOAuthProvider } from './providers/microsoft-oauth.provider';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class AuthService {
|
||||||
|
constructor(
|
||||||
|
private readonly authConfig: AuthConfigService,
|
||||||
|
private readonly ldapAuthProvider: LdapAuthProvider,
|
||||||
|
private readonly microsoftOAuthProvider: MicrosoftOAuthProvider,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
getPublicConfig() {
|
||||||
|
return this.authConfig.getPublicConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
loginWithLdap(loginData: LoginData): Promise<AuthResult> {
|
||||||
|
return this.ldapAuthProvider.authenticate(loginData);
|
||||||
|
}
|
||||||
|
|
||||||
|
getMicrosoftAuthorizeUrl() {
|
||||||
|
return this.microsoftOAuthProvider.getAuthorizeUrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
loginWithMicrosoftCallback(query: { code?: string; state?: string }) {
|
||||||
|
return this.microsoftOAuthProvider.authenticateCallback(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
getMicrosoftSuccessRedirectUrl() {
|
||||||
|
const config = this.authConfig.getConfig();
|
||||||
|
|
||||||
|
return config.microsoft.successRedirectUrl || `${config.frontendUrl}/login`;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user