@@ -50,16 +50,19 @@ impl FromStr for AuthenticationScheme {
50
50
type Err = crate :: Error ;
51
51
52
52
fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
53
- match s {
54
- "Basic" => Ok ( Self :: Basic ) ,
55
- "Bearer" => Ok ( Self :: Bearer ) ,
56
- "Digest" => Ok ( Self :: Digest ) ,
57
- "HOBA" => Ok ( Self :: Hoba ) ,
58
- "Mutual" => Ok ( Self :: Mutual ) ,
59
- "Negotiate" => Ok ( Self :: Negotiate ) ,
60
- "OAuth" => Ok ( Self :: OAuth ) ,
61
- "SCRAM-SHA-1" => Ok ( Self :: ScramSha1 ) ,
62
- "SCRAM-SHA-256" => Ok ( Self :: ScramSha256 ) ,
53
+ // NOTE(yosh): matching here is lowercase as specified by RFC2617#section-1.2
54
+ // > [...] case-insensitive token to identify the authentication scheme [...]
55
+ // https://tools.ietf.org/html/rfc2617#section-1.2
56
+ match s. to_lowercase ( ) . as_str ( ) {
57
+ "basic" => Ok ( Self :: Basic ) ,
58
+ "bearer" => Ok ( Self :: Bearer ) ,
59
+ "digest" => Ok ( Self :: Digest ) ,
60
+ "hoba" => Ok ( Self :: Hoba ) ,
61
+ "mutual" => Ok ( Self :: Mutual ) ,
62
+ "negotiate" => Ok ( Self :: Negotiate ) ,
63
+ "oauth" => Ok ( Self :: OAuth ) ,
64
+ "scram-sha-1" => Ok ( Self :: ScramSha1 ) ,
65
+ "scram-sha-256" => Ok ( Self :: ScramSha256 ) ,
63
66
"vapid" => Ok ( Self :: Vapid ) ,
64
67
s => bail ! ( "`{}` is not a recognized authentication scheme" , s) ,
65
68
}
0 commit comments