Initial commit: OAuth IAM Laravel application

Laravel-based OAuth/IAM service with Passport, Vue 3 frontend, and
Docker Compose setup for local and production deployment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-26 01:02:41 +02:00
commit c2b5291a74
174 changed files with 29318 additions and 0 deletions

View File

@@ -0,0 +1,96 @@
import { createRouter, createWebHistory } from 'vue-router';
import { useAuthStore } from '../stores/auth';
declare module 'vue-router' {
interface RouteMeta {
requiresAuth?: boolean;
requiresAdmin?: boolean;
guestOnly?: boolean;
}
}
const routes = [
{
path: '/',
name: 'dashboard',
component: () => import('../pages/Dashboard.vue'),
meta: { requiresAuth: true },
},
{
path: '/login',
name: 'login',
component: () => import('../pages/Login.vue'),
meta: { guestOnly: true },
},
{
path: '/register',
name: 'register',
component: () => import('../pages/Register.vue'),
meta: { guestOnly: true },
},
{
path: '/clients',
name: 'clients',
component: () => import('../pages/Clients.vue'),
meta: { requiresAuth: true },
},
{
path: '/tokens',
name: 'tokens',
component: () => import('../pages/Tokens.vue'),
meta: { requiresAuth: true },
},
{
path: '/authorized-apps',
name: 'authorized-apps',
component: () => import('../pages/AuthorizedApps.vue'),
meta: { requiresAuth: true },
},
{
path: '/oauth/authorize',
name: 'oauth-authorize',
component: () => import('../pages/Authorize.vue'),
meta: { requiresAuth: true },
},
{
path: '/admin/users',
name: 'admin-users',
component: () => import('../pages/admin/Users.vue'),
meta: { requiresAuth: true, requiresAdmin: true },
},
{
path: '/admin/analytics',
name: 'admin-analytics',
component: () => import('../pages/admin/Analytics.vue'),
meta: { requiresAuth: true, requiresAdmin: true },
},
];
const router = createRouter({
history: createWebHistory(),
routes,
});
router.beforeEach(async (to) => {
const auth = useAuthStore();
if (!auth.checked) {
await auth.fetchUser();
}
if (to.meta.requiresAuth && !auth.isAuthenticated) {
return { name: 'login', query: { redirect: to.fullPath } };
}
if (to.meta.requiresAdmin && !auth.isAdmin) {
return { name: 'dashboard' };
}
if (to.meta.guestOnly && auth.isAuthenticated) {
return { name: 'dashboard' };
}
return true;
});
export default router;