We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6b065f9 commit 6932af5Copy full SHA for 6932af5
src/common/authorization.rs
@@ -45,6 +45,16 @@ impl Authorization<Basic> {
45
46
Authorization(Basic { decoded, colon_pos })
47
}
48
+
49
+ /// View the decoded username.
50
+ pub fn username(&self) -> &str {
51
+ self.0.username()
52
+ }
53
54
+ /// View the decoded password.
55
+ pub fn password(&self) -> &str {
56
+ self.0.password()
57
58
59
60
impl Authorization<Bearer> {
@@ -54,6 +64,11 @@ impl Authorization<Bearer> {
64
.map(|val| Authorization(Bearer(val)))
65
.ok_or_else(|| InvalidBearerToken { _inner: () })
66
67
68
+ /// View the token part as a `&str`.
69
+ pub fn token(&self) -> &str {
70
+ self.0.token()
71
72
73
74
impl<C: Credentials> ::Header for Authorization<C> {
0 commit comments