Skip to content

Commit ab31ac3

Browse files
committed
Improve cookie errors
1 parent 54ae00b commit ab31ac3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

server/src/helpers.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,13 @@ pub fn get_auth_from_cookie(
7979
for enc in encoded_session_cookies {
8080
let session = base64::decode(enc).map_err(|_| {
8181
AtomicError::unauthorized(
82-
"Malformed authentication resource - unable to decode base64".to_string(),
82+
"Malformed authentication resource in cookie - unable to decode base64".to_string(),
8383
)
8484
})?;
8585

8686
let session_str = std::str::from_utf8(&session).map_err(|_| AtomicServerError {
87-
message: "Malformed authentication resource - unable to parse from utf_8".to_string(),
87+
message: "Malformed authentication resource in cookie - unable to parse from utf_8"
88+
.to_string(),
8889
error_type: AppErrorType::Unauthorized,
8990
error_resource: None,
9091
})?;
@@ -107,7 +108,7 @@ pub fn get_auth_from_cookie(
107108
// 2. The user is trying to access a resource from a different origin
108109

109110
err = AtomicError::unauthorized(format!(
110-
"Wrong requested subject, expected {} was {}",
111+
"Wrong requested subject in cookie, expected {} was {}",
111112
requested_subject, auth_values.requested_subject
112113
))
113114
.into();

0 commit comments

Comments
 (0)