fix: code review findings — auth-settings HTTP method, authorization, redirect
- Change auth-settings endpoint from PUT to PATCH (matches partial update semantics and frontend hook)
- Add @PreAuthorize("SCOPE_tenant:manage") to updateAuthSettings endpoint
- Consolidate MFA/passkey 403 redirect handling in API client
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -65,13 +65,11 @@ async function apiFetch<T>(path: string, options: RequestInit = {}): Promise<T>
|
||||
|
||||
if (response.status === 403) {
|
||||
const errorHeader = response.headers.get('X-Cameleer-Error');
|
||||
if (errorHeader === 'APP_MFA_REQUIRED') {
|
||||
window.location.href = '/platform/tenant/settings?mfa=required';
|
||||
throw new ApiError(403, '{"message":"MFA enrollment required"}');
|
||||
}
|
||||
if (errorHeader === 'APP_PASSKEY_REQUIRED') {
|
||||
window.location.href = '/platform/tenant/settings?passkey=required';
|
||||
throw new ApiError(403, '{"message":"Passkey enrollment required"}');
|
||||
if (errorHeader === 'APP_MFA_REQUIRED' || errorHeader === 'APP_PASSKEY_REQUIRED') {
|
||||
const param = errorHeader === 'APP_PASSKEY_REQUIRED' ? 'passkey=required' : 'mfa=required';
|
||||
window.location.href = `/platform/tenant/settings?${param}`;
|
||||
const msg = errorHeader === 'APP_PASSKEY_REQUIRED' ? 'Passkey enrollment required' : 'MFA enrollment required';
|
||||
throw new ApiError(403, JSON.stringify({ message: msg }));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user