Re-enable ForwardAuth and have ForwardAuth work using email address (#1426)

* Fallback to using email for auth if user not defined by forwardauth

* Re-enable RemoteAuth

* Update build env
This commit is contained in:
Chris Debenham
2025-10-23 21:57:08 -06:00
committed by GitHub
parent 1827ae23bd
commit 2f6ae855dd
8 changed files with 46 additions and 3 deletions
@@ -94,6 +94,18 @@ export function initializeAuthFactory() {
resolve();
});
} else if (publicSettings.remoteAuthEnabled) {
authService.remoteLogin().subscribe({
next: () => {
authInitService.markAsInitialized();
resolve();
},
error: err => {
console.error('[Remote Login] failed:', err);
authInitService.markAsInitialized();
resolve();
}
});
} else {
if (forceLocalOnly) {
console.warn('[OIDC] Forced local-only login via ?localOnly=true');
@@ -8,6 +8,7 @@ import {AuthService} from './auth.service';
export interface PublicAppSettings {
oidcEnabled: boolean;
remoteAuthEnabled: boolean;
oidcProviderDetails: OidcProviderDetails;
}
@@ -76,6 +77,7 @@ export class AppSettingsService {
private syncPublicSettings(appSettings: AppSettings): void {
const updatedPublicSettings: PublicAppSettings = {
oidcEnabled: appSettings.oidcEnabled,
remoteAuthEnabled: appSettings.remoteAuthEnabled,
oidcProviderDetails: appSettings.oidcProviderDetails
};
const current = this.publicAppSettingsSubject.value;
@@ -83,6 +85,7 @@ export class AppSettingsService {
if (
!current ||
current.oidcEnabled !== updatedPublicSettings.oidcEnabled ||
current.remoteAuthEnabled !== updatedPublicSettings.remoteAuthEnabled ||
JSON.stringify(current.oidcProviderDetails) !== JSON.stringify(updatedPublicSettings.oidcProviderDetails)
) {
this.publicAppSettingsSubject.next(updatedPublicSettings);
@@ -47,6 +47,17 @@ export class AuthService {
);
}
remoteLogin(): Observable<{ accessToken: string; refreshToken: string, isDefaultPassword: string }> {
return this.http.get<{ accessToken: string; refreshToken: string, isDefaultPassword: string }>(`${this.apiUrl}/remote`).pipe(
tap((response) => {
if (response.accessToken && response.refreshToken) {
this.saveInternalTokens(response.accessToken, response.refreshToken);
this.initializeWebSocketConnection();
}
})
);
}
saveInternalTokens(accessToken: string, refreshToken: string): void {
localStorage.setItem('accessToken_Internal', accessToken);
localStorage.setItem('refreshToken_Internal', refreshToken);