feat(auth): Complete OIDC security refactor and modernize test suite
- Refactored OIDC flow to implement PKCE, state/nonce validation, and BFF pattern. - Centralized configuration in Settings class (DEV_MODE, FRONTEND_URL, OIDC_REDIRECT_URI). - Updated auth routers to use conditional secure cookie flags based on DEV_MODE. - Modernized and cleaned up test suite by removing legacy Streamlit tests. - Fixed linting errors and unused imports across the backend.
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
import { useEffect } from "react"
|
||||
import { useNavigate } from "react-router-dom"
|
||||
import { AuthService } from "@/services/auth"
|
||||
|
||||
export function AuthCallback() {
|
||||
const navigate = useNavigate()
|
||||
|
||||
useEffect(() => {
|
||||
const verifyAuth = async () => {
|
||||
const urlParams = new URLSearchParams(window.location.search)
|
||||
const code = urlParams.get("code")
|
||||
|
||||
try {
|
||||
if (code) {
|
||||
// If we have a code, exchange it for a cookie
|
||||
await AuthService.exchangeOIDCCode(code)
|
||||
} else {
|
||||
// If no code, just verify existing cookie (backend-driven redirect)
|
||||
await AuthService.getMe()
|
||||
}
|
||||
|
||||
// Success - go to home. We use window.location.href to ensure a clean reload of App state
|
||||
window.location.href = "/"
|
||||
} catch (err) {
|
||||
console.error("Auth callback verification failed:", err)
|
||||
navigate("/?error=auth_failed", { replace: true })
|
||||
}
|
||||
}
|
||||
|
||||
verifyAuth()
|
||||
}, [navigate])
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex flex-col items-center justify-center bg-background">
|
||||
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary mb-4"></div>
|
||||
<p className="text-muted-foreground">Completing login...</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -22,10 +22,11 @@ import axios from "axios"
|
||||
interface LoginFormProps {
|
||||
onSuccess: () => void
|
||||
onToggleMode: () => void
|
||||
externalError?: string | null
|
||||
}
|
||||
|
||||
export function LoginForm({ onSuccess, onToggleMode }: LoginFormProps) {
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
export function LoginForm({ onSuccess, onToggleMode, externalError }: LoginFormProps) {
|
||||
const [error, setError] = useState<string | null>(externalError || null)
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
|
||||
const form = useForm<LoginInput>({
|
||||
|
||||
Reference in New Issue
Block a user