mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-03-04 02:20:19 +01:00
cleaning up
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user