mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-10-06 09:06:18 +01:00
Feature: Reverse proxy authentication (#455)
- Changes the auth settings to support more than two auth types - Added a proxy auth type with settings for user and optionally group headers - Added a global middleware `proxy_auth_middleware` to handle proxy auth (it does nothing if any other auth mode is set) - Added support for proxy auth to `get_auth_mode`, `login_required`, `api_login/out`, and `api_auth_check` - Added a backend check to make protect the API for settings when admin is required --------- Co-authored-by: Joshua Tag Howard <git@jthoward.dev> Co-authored-by: Alex <alex.bilbie1@gmail.com>
This commit is contained in:
co-authored by
Joshua Tag Howard
Alex
parent
475ae420e5
commit
0d7a12ca7c
@@ -83,7 +83,11 @@ export function useAuth(options: UseAuthOptions = {}): UseAuthReturn {
|
||||
|
||||
const handleLogout = useCallback(async () => {
|
||||
try {
|
||||
await logout();
|
||||
const { logout_url } = await logout();
|
||||
if (logout_url?.startsWith('https://') || logout_url?.startsWith('http://')) {
|
||||
window.location.href = logout_url;
|
||||
return;
|
||||
}
|
||||
setIsAuthenticated(false);
|
||||
onLogoutSuccess?.();
|
||||
navigate('/login', { replace: true });
|
||||
|
||||
@@ -181,6 +181,7 @@ export interface AuthResponse {
|
||||
auth_required?: boolean;
|
||||
is_admin?: boolean;
|
||||
error?: string;
|
||||
logout_url?: string;
|
||||
}
|
||||
|
||||
// Type guard to check if a book is from a metadata provider
|
||||
|
||||
Reference in New Issue
Block a user