- Updated nuxt.config.js to include Authentik configuration and public keys for client-side access. - Introduced a new composable, useAuth.js, for handling authentication logic with Authentik, including user validation, login, and logout functionalities. - Enhanced documentation to reflect the simplified RBAC structure and the integration of Authentik, emphasizing user-centric design and streamlined permission management. - Refactored middleware for authentication checks and improved error handling during user validation. - Created new pages for login and dashboard, ensuring proper routing and user experience. - Removed obsolete Metabase integration and unnecessary complexity from the project structure.
13 lines
600 B
JavaScript
13 lines
600 B
JavaScript
// Login endpoint - redirects to Authentik OAuth2
|
|
export default defineEventHandler(async (event) => {
|
|
const config = useRuntimeConfig();
|
|
|
|
// Redirect to Authentik login
|
|
const authUrl = new URL('/application/o/authorize/', config.public.authentikUrl);
|
|
authUrl.searchParams.append('client_id', config.authentik.clientId);
|
|
authUrl.searchParams.append('redirect_uri', `${config.public.appUrl}/api/auth/callback`);
|
|
authUrl.searchParams.append('response_type', 'code');
|
|
authUrl.searchParams.append('scope', 'openid profile email');
|
|
|
|
return sendRedirect(event, authUrl.toString());
|
|
});
|