summaryrefslogtreecommitdiff
path: root/src/login/extract/identity_token.rs
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-09-12 00:24:31 -0400
committerOwen Jacobson <owen@grimoire.ca>2024-09-12 00:24:31 -0400
commit8a4e25c2a7d6235d726499d43fd1721104314e86 (patch)
tree40a2f76101ce917873107095ed3dbf7074aad9f3 /src/login/extract/identity_token.rs
parentf97028985a477d46fd35c7b897ce95dc7887904c (diff)
Be a bit more consistent about 'token', the whole record, versus 'secret', the value in that record used to verify logins.
Diffstat (limited to 'src/login/extract/identity_token.rs')
-rw-r--r--src/login/extract/identity_token.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/login/extract/identity_token.rs b/src/login/extract/identity_token.rs
index d39e3df..c322f7b 100644
--- a/src/login/extract/identity_token.rs
+++ b/src/login/extract/identity_token.rs
@@ -14,18 +14,19 @@ pub struct IdentityToken {
}
impl IdentityToken {
- /// Get the identity token sent in the request, if any. If the identity was
- /// not sent, or if it has previously been [clear]ed, then this will return
- /// [None]. If the identity has previously been [set], then this will return
- /// that token.
- pub fn token(&self) -> Option<&str> {
+ /// Get the identity secret sent in the request, if any. If the identity
+ /// was not sent, or if it has previously been [clear]ed, then this will
+ /// return [None]. If the identity has previously been [set], then this
+ /// will return that secret, regardless of what the request originally
+ /// included.
+ pub fn secret(&self) -> Option<&str> {
self.cookies.get(IDENTITY_COOKIE).map(Cookie::value)
}
- /// Positively set the identity token, and ensure that it will be sent back
- /// to the client when this extractor is included in a response.
- pub fn set(self, token: &str) -> Self {
- let identity_cookie = Cookie::build((IDENTITY_COOKIE, String::from(token)))
+ /// Positively set the identity secret, and ensure that it will be sent
+ /// back to the client when this extractor is included in a response.
+ pub fn set(self, secret: &str) -> Self {
+ let identity_cookie = Cookie::build((IDENTITY_COOKIE, String::from(secret)))
.http_only(true)
.permanent()
.build();
@@ -35,7 +36,7 @@ impl IdentityToken {
}
}
- /// Remove the identity token and ensure that it will be cleared when this
+ /// Remove the identity secret and ensure that it will be cleared when this
/// extractor is included in a response.
pub fn clear(self) -> Self {
IdentityToken {