cleaning up

This commit is contained in:
DarioGii
2025-10-23 11:58:35 +01:00
parent 7e6f9524ea
commit cd03c7487a
3 changed files with 7 additions and 29 deletions

View File

@@ -20,7 +20,7 @@ security:
username: '' # initial username for the first login
password: '' # initial password for the first login
oauth2:
enabled: true # set to 'true' to enable login (Note: enableLogin must also be 'true' for this to work)
enabled: false # set to 'true' to enable login (Note: enableLogin must also be 'true' for this to work)
client:
keycloak:
issuer: '' # URL of the Keycloak realm's OpenID Connect Discovery endpoint

View File

@@ -28,7 +28,7 @@ const AuthContext = createContext<AuthContextType>({
* Auth Provider Component
*
* Manages authentication state and provides it to the entire app.
* Replaces Supabase's AuthProvider with Spring Security + JWT integration.
* Integrates with Spring Security + JWT backend.
*/
export function AuthProvider({ children }: { children: ReactNode }) {
const [session, setSession] = useState<Session | null>(null);

View File

@@ -1,16 +1,13 @@
/**
* Spring Auth Client - Replaces Supabase client
* Spring Auth Client
*
* This client provides the same API surface as Supabase for authentication,
* but integrates with the Spring Security + JWT backend instead.
*
* Main differences from Supabase:
* This client integrates with the Spring Security + JWT backend.
* - Uses localStorage for JWT storage (sent via Authorization header)
* - JWT validation handled server-side
* - No email confirmation flow (auto-confirmed on registration)
*/
// Types matching Supabase structure for compatibility
// Auth types
export interface User {
id: string;
email: string;
@@ -47,10 +44,6 @@ export type AuthChangeEvent =
type AuthChangeCallback = (event: AuthChangeEvent, session: Session | null) => void;
/**
* Spring Auth Client - Replaces Supabase client
* Maintains same API surface as Supabase for easy migration
*/
class SpringAuthClient {
private listeners: AuthChangeCallback[] = [];
private sessionCheckInterval: NodeJS.Timeout | null = null;
@@ -338,7 +331,7 @@ class SpringAuthClient {
}
/**
* Listen to auth state changes (mimics Supabase onAuthStateChange)
* Listen to auth state changes
*/
onAuthStateChange(callback: AuthChangeCallback): { data: { subscription: { unsubscribe: () => void } } } {
this.listeners.push(callback);
@@ -401,23 +394,8 @@ class SpringAuthClient {
}
}
// Export singleton instance (mimics Supabase pattern)
export const springAuth = new SpringAuthClient();
// Export helper functions (matching Supabase exports)
/**
* Anonymous sign-in
* Note: Not implemented yet - returns error
*/
export const signInAnonymously = async () => {
// For now, return error - implement anonymous auth if needed
return {
data: { user: null, session: null },
error: { message: 'Anonymous authentication not implemented' },
};
};
/**
* Get current user
*/
@@ -464,4 +442,4 @@ export const createAnonymousSession = (): Session => {
};
// Export auth client as default for convenience
export default springAuth;
export default springAuth;