BLOG-85 Implement OIDC authentication #93
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "BLOG-85_oidc_login"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
/auth/login
/auth/callback
/auth/logout
Package Changes
Screenshots
Reference
Resolves #85
Checklist
auth
crate/improve
PR Code Suggestions ✨
Add specific error for OIDC state mismatch
The
AuthError::InvalidNonce
variant is currently used to indicate a mismatch in theOIDC
state
parameter. Thestate
parameter is used for CSRF protection, distinct fromthe
nonce
parameter which protects against ID token replay attacks. Introduce a newerror variant,
InvalidState
, to accurately represent issues with thestate
parameter.
backend/feature/auth/src/application/error/auth_error.rs [2-7]
Suggestion importance[1-10]: 9
__
Why: The suggestion correctly identifies a conceptual error in using
InvalidNonce
for astate
parameter mismatch. IntroducingInvalidState
improves the clarity and correctness of error handling, which is crucial for security and maintainability in an authentication feature.Use correct error for state validation
Update the error returned when the
received_state
does not match theexpected_state
.This should use the newly introduced
AuthError::InvalidState
variant to accuratelyreflect the nature of the security validation failure, improving clarity and
maintainability.
backend/feature/auth/src/application/use_case/exchange_auth_code_use_case.rs [40-42]
Suggestion importance[1-10]: 9
__
Why: This suggestion directly addresses a logical flaw by correcting the error type returned for a
state
mismatch. It ensures that the system accurately reports the specific security validation failure, which is vital for debugging and maintaining the authentication flow.Handle new OIDC state error
After introducing
AuthError::InvalidState
and using it for state validation, updatethe
oidc_callback_handler
to correctly handle this new error variant. This ensuresthat state validation failures are explicitly caught and result in an appropriate
HTTP response.
backend/feature/auth/src/framework/web/auth_web_routes.rs [83-85]
Suggestion importance[1-10]: 8
__
Why: This suggestion ensures that the newly introduced
AuthError::InvalidState
is properly handled in the web layer, providing a consistent HTTP response for state validation failures. It completes the error handling chain, making the application more robust.The above and related issues are addressed in
7a153f0f86
.