@@ -50,16 +50,19 @@ impl FromStr for AuthenticationScheme {
5050 type Err = crate :: Error ;
5151
5252 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 ) ,
6366 "vapid" => Ok ( Self :: Vapid ) ,
6467 s => bail ! ( "`{}` is not a recognized authentication scheme" , s) ,
6568 }
0 commit comments