feat(auth): implement Android refresh token handling and session management
- Added support for generating Android access tokens and managing refresh sessions in the auth endpoints. - Implemented new tests for login, logout, and refresh functionalities specific to Android clients. - Enhanced password reset logging with normalization and masking of email addresses. - Created a new diagnostics endpoint for password reset attempts, including filtering and summarizing logs. - Introduced a new utility for managing password reset logs with retention policies. - Added tests for password reset log utilities to ensure proper functionality and privacy compliance. - Updated WebAuthn configuration tests to validate origin handling for production and allowed origins.
This commit is contained in:
@@ -65,7 +65,7 @@ export default defineEventHandler(async (event) => {
|
||||
})
|
||||
}
|
||||
|
||||
const { origin, rpId, requireUV } = getWebAuthnConfig()
|
||||
const { origins, rpId, requireUV } = getWebAuthnConfig()
|
||||
|
||||
const authenticator = {
|
||||
credentialID: fromBase64Url(passkey.credentialId),
|
||||
@@ -74,14 +74,20 @@ export default defineEventHandler(async (event) => {
|
||||
transports: passkey.transports || undefined
|
||||
}
|
||||
|
||||
const verification = await verifyAuthenticationResponse({
|
||||
response,
|
||||
expectedChallenge: challenge,
|
||||
expectedOrigin: origin,
|
||||
expectedRPID: rpId,
|
||||
authenticator,
|
||||
requireUserVerification: requireUV
|
||||
})
|
||||
let verification
|
||||
try {
|
||||
verification = await verifyAuthenticationResponse({
|
||||
response,
|
||||
expectedChallenge: challenge,
|
||||
expectedOrigin: origins,
|
||||
expectedRPID: rpId,
|
||||
authenticator,
|
||||
requireUserVerification: requireUV
|
||||
})
|
||||
} catch {
|
||||
await writeAuditLog('auth.passkey.login.failed', { ip, userId: user.id, reason: 'verification_error' })
|
||||
throw createError({ statusCode: 401, statusMessage: 'Passkey-Login fehlgeschlagen' })
|
||||
}
|
||||
|
||||
if (!verification.verified) {
|
||||
await writeAuditLog('auth.passkey.login.failed', { ip, userId: user.id, reason: 'verification_failed' })
|
||||
@@ -118,4 +124,3 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user