Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

feat(auth:oidc): revise authentication flow logic

johavenabb9979ed8f1
diff --git a/backend/src/authentication/auth.service.ts b/backend/src/authentication/auth.service.ts
index 74101015..35365420 100755
--- a/backend/src/authentication/auth.service.ts
+++ b/backend/src/authentication/auth.service.ts
@@ -148,7 +148,6 @@ export class AuthManager {
return {
loginUrl: API_OIDC_LOGIN,
autoRedirect: configuration.auth.oidc.options.autoRedirect,
- enablePasswordAuth: configuration.auth.oidc.options.enablePasswordAuth,
buttonText: configuration.auth.oidc.options.buttonText
}
}
diff --git a/backend/src/authentication/providers/oidc/auth-oidc.interfaces.ts b/backend/src/authentication/providers/oidc/auth-oidc.interfaces.ts
index c6c3fd03..9e5c1b7c 100644
--- a/backend/src/authentication/providers/oidc/auth-oidc.interfaces.ts
+++ b/backend/src/authentication/providers/oidc/auth-oidc.interfaces.ts
@@ -7,6 +7,5 @@
export interface AuthOIDCSettings {
loginUrl: string
autoRedirect: boolean
- enablePasswordAuth: boolean
buttonText: string
}
diff --git a/backend/src/authentication/providers/oidc/auth-provider-oidc.service.ts b/backend/src/authentication/providers/oidc/auth-provider-oidc.service.ts
index 4c116580..e5764c6a 100644
--- a/backend/src/authentication/providers/oidc/auth-provider-oidc.service.ts
+++ b/backend/src/authentication/providers/oidc/auth-provider-oidc.service.ts
@@ -52,7 +52,7 @@ export class AuthProviderOIDC implements AuthProvider {
) {}
async validateUser(login: string, password: string, ip?: string, scope?: AUTH_SCOPE): Promise<UserModel> {
- // Find user from login or email
+ // Local password authentication path (non-OIDC)
const user: UserModel = await this.usersManager.findUser(login, false)
if (!user) {
diff --git a/environment/environment.dist.yaml b/environment/environment.dist.yaml
index f5e97a52..bb2d7f66 100755
--- a/environment/environment.dist.yaml
+++ b/environment/environment.dist.yaml
@@ -206,9 +206,14 @@ auth:
# and require proper IdP mappers to be included in the ID token or UserInfo response.
# optional
adminRoleOrGroup:
- # enablePasswordAuth: Enable local password-based authentication (login or email/password).
- # When enabled, users can sign in with their Sync-in password in addition to OIDC authentication.
- # Users must have signed in at least once and have a local password set.
+ # enablePasswordAuth: Allow local password-based authentication when using OIDC.
+ # When enabled, users may authenticate with their Sync-in password instead of OIDC.
+ # Local password authentication is always allowed for:
+ # - guest users
+ # - administrator users (break-glass access)
+ # - application scopes (app passwords)
+ # Regular users are allowed only when this option is enabled.
+ # Users must already exist locally and have a password set.
# default: true
enablePasswordAuth: true
# autoRedirect: Automatically redirect users to the OIDC login flow.
diff --git a/frontend/src/app/auth/auth.component.html b/frontend/src/app/auth/auth.component.html
index eb29ec35..93963a57 100644
--- a/frontend/src/app/auth/auth.component.html
+++ b/frontend/src/app/auth/auth.component.html
@@ -56,26 +56,24 @@
</div>
</form>
} @else {
- @if (!oidcSettings || oidcSettings.enablePasswordAuth) {
- <form (ngSubmit)="onSubmit()" [formGroup]="loginForm">
- <p class="fs-sm mb-3 {{hasError ? 'text-danger' : 'text-white-50'}}" l10nTranslate>{{ hasError || 'Sign-in to your account' }}</p>
- <div class="input-group my-2">
+ <form (ngSubmit)="onSubmit()" [formGroup]="loginForm">
+ <p class="fs-sm mb-3 {{hasError ? 'text-danger' : 'text-white-50'}}" l10nTranslate>{{ hasError || 'Sign-in to your account' }}</p>
+ <div class="input-group my-2">
<span class="input-group-text">
<fa-icon [icon]="icons.faUserAlt"></fa-icon>
</span>
- <input appAutofocus class="form-control" formControlName="username" [placeholder]="'Login or Email' | translate:locale.language" type="text" />
- </div>
- <div class="input-group mb-3">
+ <input appAutofocus class="form-control" formControlName="username" [placeholder]="'Login or Email' | translate:locale.language" type="text" />
+ </div>
+ <div class="input-group mb-3">
<span class="input-group-text">
<fa-icon [icon]="icons.faLock"></fa-icon>
</span>
- <input class="form-control" formControlName="password" [placeholder]="'Password' | translate:locale.language" type="password" />
- </div>
- <div class="d-flex">
- <button type="submit" [disabled]="loginForm.invalid || submitted" class="btn btn-primary px-4 w-100" l10nTranslate>Sign in</button>
- </div>
- </form>
- }
+ <input class="form-control" formControlName="password" [placeholder]="'Password' | translate:locale.language" type="password" />
+ </div>
+ <div class="d-flex">
+ <button type="submit" [disabled]="loginForm.invalid || submitted" class="btn btn-primary px-4 w-100" l10nTranslate>Sign in</button>
+ </div>
+ </form>
@if (oidcSettings) {
<div class="d-flex flex-column">
<div class="d-flex mt-3">
diff --git a/frontend/src/app/auth/auth.component.ts b/frontend/src/app/auth/auth.component.ts
index 0ee6f086..2a19e04c 100644
--- a/frontend/src/app/auth/auth.component.ts
+++ b/frontend/src/app/auth/auth.component.ts
@@ -34,7 +34,7 @@ export class AuthComponent {
protected submitted = false
protected twoFaVerify = false
private route = inject(ActivatedRoute)
- protected oidcSettings: AuthOIDCSettings | false = this.route.snapshot.data['authSettings']
+ protected oidcSettings: AuthOIDCSettings | false = this.route.snapshot.data.authSettings
private readonly router = inject(Router)
private readonly auth = inject(AuthService)
private readonly fb = inject(UntypedFormBuilder)