Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 63x 4x 4x 4x 3x | import { http, HttpResponse } from 'msw'
export const authHandlers = [
http.get('/api/auth/init', () =>
HttpResponse.json({
E authorization_url: 'https://login.app.keskikuja.site/api/oidc/authorize?client_id=agent-platform&response_type=code&scope=openid+profile+email+groups&state=mock-state&code_challenge=mock-challenge&code_challenge_method=S256',
}),
),
http.get('/api/auth/session', () => {
const unauthed = typeof window !== 'undefined' && window.__e2eUnauthed
if (unauthed) {
return HttpResponse.json({ error: 'No session' }, { status: 401 })
}
return HttpResponse.json({
sub: 'user-1',
preferred_username: 'admin',
email: 'admin@keskikuja.site',
groups: ['admin'],
expiresAt: new Date(Date.now() + 8 * 3600_000).toISOString(),
idleExpiresAt: new Date(Date.now() + 30 * 60_000).toISOString(),
serverTime: new Date().toISOString(),
})
}),
http.post('/api/auth/refresh', () =>
HttpResponse.json({
status: 'refreshed',
expiresAt: new Date(Date.now() + 8 * 3600_000).toISOString(),
idleExpiresAt: new Date(Date.now() + 30 * 60_000).toISOString(),
serverTime: new Date().toISOString(),
}),
),
http.post('/api/auth/logout', () =>
HttpResponse.json({
redirectUrl: 'https://login.app.keskikuja.site/oidc/logout?post_logout_redirect_uri=https://app.keskikuja.site/login',
}),
),
]
|