feat(auth): Add external authentication (OAuth/OIDC & LDAP) with admin management, UI, and encryption support
This commit is contained in:
28
ts/services/auth/strategies/strategy.factory.ts
Normal file
28
ts/services/auth/strategies/strategy.factory.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Auth Strategy Factory
|
||||
* Creates the appropriate authentication strategy based on provider type
|
||||
*/
|
||||
|
||||
import type { AuthProvider } from '../../../models/auth.provider.ts';
|
||||
import type { CryptoService } from '../../crypto.service.ts';
|
||||
import type { IAuthStrategy } from './auth.strategy.interface.ts';
|
||||
import { OAuthStrategy } from './oauth.strategy.ts';
|
||||
import { LdapStrategy } from './ldap.strategy.ts';
|
||||
|
||||
export class AuthStrategyFactory {
|
||||
constructor(private cryptoService: CryptoService) {}
|
||||
|
||||
/**
|
||||
* Create the appropriate strategy for a provider
|
||||
*/
|
||||
public create(provider: AuthProvider): IAuthStrategy {
|
||||
switch (provider.type) {
|
||||
case 'oidc':
|
||||
return new OAuthStrategy(provider, this.cryptoService);
|
||||
case 'ldap':
|
||||
return new LdapStrategy(provider, this.cryptoService);
|
||||
default:
|
||||
throw new Error(`Unsupported provider type: ${provider.type}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user