feat: add forward authentication configuration and UI
- Introduced ForwardAuthConfig model to store global forward authentication settings. - Updated Manager to fetch and apply forward authentication configuration. - Added ForwardAuthHandler to create a reverse proxy handler for authentication. - Enhanced ProxyHost model to include forward authentication options. - Created Security page and ForwardAuthSettings component for managing authentication settings. - Implemented API endpoints for fetching and updating forward authentication configuration. - Added tests for new functionality including validation and error handling. - Updated frontend components to support forward authentication settings.
This commit is contained in:
@@ -26,6 +26,7 @@ describe('proxyHosts API', () => {
|
||||
|
||||
const mockHost: ProxyHost = {
|
||||
uuid: '123',
|
||||
name: 'Example Host',
|
||||
domain_names: 'example.com',
|
||||
forward_scheme: 'http',
|
||||
forward_host: 'localhost',
|
||||
@@ -36,6 +37,8 @@ describe('proxyHosts API', () => {
|
||||
hsts_subdomains: false,
|
||||
block_exploits: false,
|
||||
websocket_support: false,
|
||||
forward_auth_enabled: false,
|
||||
forward_auth_bypass: '',
|
||||
locations: [],
|
||||
enabled: true,
|
||||
created_at: '2023-01-01',
|
||||
|
||||
@@ -30,6 +30,8 @@ export interface ProxyHost {
|
||||
hsts_subdomains: boolean;
|
||||
block_exploits: boolean;
|
||||
websocket_support: boolean;
|
||||
forward_auth_enabled: boolean;
|
||||
forward_auth_bypass: string;
|
||||
locations: Location[];
|
||||
advanced_config?: string;
|
||||
enabled: boolean;
|
||||
|
||||
32
frontend/src/api/security.ts
Normal file
32
frontend/src/api/security.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import client from './client';
|
||||
|
||||
export interface ForwardAuthConfig {
|
||||
id?: number;
|
||||
provider: 'authelia' | 'authentik' | 'pomerium' | 'custom';
|
||||
address: string;
|
||||
trust_forward_header: boolean;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
}
|
||||
|
||||
export interface ForwardAuthTemplate {
|
||||
provider: string;
|
||||
address: string;
|
||||
trust_forward_header: boolean;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export const getForwardAuthConfig = async (): Promise<ForwardAuthConfig> => {
|
||||
const { data } = await client.get<ForwardAuthConfig>('/security/forward-auth');
|
||||
return data;
|
||||
};
|
||||
|
||||
export const updateForwardAuthConfig = async (config: ForwardAuthConfig): Promise<ForwardAuthConfig> => {
|
||||
const { data } = await client.put<ForwardAuthConfig>('/security/forward-auth', config);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const getForwardAuthTemplates = async (): Promise<Record<string, ForwardAuthTemplate>> => {
|
||||
const { data } = await client.get<Record<string, ForwardAuthTemplate>>('/security/forward-auth/templates');
|
||||
return data;
|
||||
};
|
||||
Reference in New Issue
Block a user