-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Authentication scheme case-insensitivity #6228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm only going to address the Bearer part here, but it's really nothing outside of the thoughts I already expressed in my comments on #6150. The section 2.1 of RFC 6750 is quite explicit on the syntax of Authorization header for Bearer authentication scheme. There's no ambiguity there that would warrant pulling other Authorization header related specs into the mix (for the Bearer part that is). With the current situation, if one wants to build a fully spec compliant service (which behaves like Google's, for example) they need to provide a custom (?!) |
If the spec states that the scheme should be case insensitive, this should be our default, and then we should make it easy to deviate from that default. The case for it being case-sensitive, as I see it, is here:
This BNF doesn't leave room for case-insensitivity. And the spec doesn't make any comment to clarify. The case for it being case-insensitive is that this paragraph:
Implies that what is true for The syntax for Basic, from RFC2617 is:
But RFC2617 also says:
followed by:
Placing these three statements together means that simply consulting the I do not see the same explicitness that @vpavic sees. Personally, if the paragraph didn't say "follows the usage of the Basic scheme" and "as with Basic", I would agree that we'd be left only with RFC 6750 to consult. My conclusion is that the spec is unclear. Since it is unclear, Spring Security will likely be unsuccessful at stating that it defaults to case-sensitivity because it "follows the spec", implying that others do not. Because the spec is ambiguous, then the next quality to look for is compatibility. I don't have a lot to say about compatibility; @jgrandja mentioned to me offline that he was looking a bit into that, and we have anecdotes from members of the community that the components they use send However, a couple of quick points about the open-source authentication community:
I do not know whether Another point, then, is to consider consistency across Spring Security. |
I did a quick test with |
Can we support strict case sensitivity and case insensitive environments? |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Can you please elaborate so I can better understand. |
We spoke about this offline and determined this is completed. |
/cc @vpavic @jzheaux @rwinch @tnwang @nlebas
Let's revisit the Authentication scheme case-insensitivity as it seems we're not all on the same page as of yet. This is related to #6150 #5586 #6195
I've re-read the 3 related specs and have provided references below along with my comments.
RFC 6750 - The OAuth 2.0 Authorization Framework: Bearer Token Usage
Key references
** Take note of the highlighted
2.1. Authorization Request Header Field
When sending the access token in the "Authorization" request header
field defined by HTTP/1.1 [RFC2617], the client uses the "Bearer"
authentication scheme to transmit the access token.
For example:
The syntax of the "Authorization" header field for this scheme
follows the usage of the Basic scheme defined in Section 2 of
[RFC2617]. Note that, as with Basic, it does not conform to the
generic syntax defined in Section 1.2 of [RFC2617] but is compatible
with the general authentication framework being developed for
HTTP 1.1 [HTTP-AUTH], although it does not follow the preferred
practice outlined therein in order to reflect existing deployments.
The syntax for Bearer credentials is as follows:
Clients SHOULD make authenticated requests with a bearer token using
the "Authorization" request header field with the "Bearer" HTTP
authorization scheme. Resource servers MUST support this method.
Comments:
RFC 2617 - HTTP Authentication: Basic and Digest Access Authentication
Key references
** Take note of the highlighted
1.2 Access Authentication Framework
HTTP provides a simple challenge-response authentication mechanism
that MAY be used by a server to challenge a client request and by a
client to provide authentication information. It uses an extensible,
case-insensitive token to identify the authentication scheme,
followed by a comma-separated list of attribute-value pairs which
carry the parameters necessary for achieving authentication via that
scheme.
2. Basic Authentication Scheme
The "basic" authentication scheme is based on the model that the
client must authenticate itself with a user-ID and a password for
each realm. The realm value should be considered an opaque string
which can only be compared for equality with other realms on that
server. The server will service the request only if it can validate
the user-ID and password for the protection space of the Request-URI.
There are no optional authentication parameters.
For Basic, the framework above is utilized as follows:
Comments:
RFC 7617 - The 'Basic' HTTP Authentication Scheme
Key references
** Take note of the highlighted
1. Introduction
This document defines the "Basic" Hypertext Transfer Protocol (HTTP)
authentication scheme, which transmits credentials as user-id/
password pairs, encoded using Base64 (HTTP authentication schemes are
defined in [RFC7235]).
This scheme is not considered to be a secure method of user
authentication unless used in conjunction with some external secure
system such as TLS (Transport Layer Security, [RFC5246]), as the
user-id and password are passed over the network as cleartext.
The "Basic" scheme previously was defined in Section 2 of [RFC2617].
This document updates the definition, and also addresses
internationalization issues by introducing the 'charset'
authentication parameter (Section 2.1).
2. The 'Basic' Authentication Scheme
The Basic authentication scheme is based on the model that the client
needs to authenticate itself with a user-id and a password for each
protection space ("realm"). The realm value is a free-form string
that can only be compared for equality with other realms on that
server. The server will service the request only if it can validate
the user-id and password for the protection space applying to the
requested resource.
The Basic authentication scheme utilizes the Authentication Framework
as follows.
In challenges:
o The scheme name is "Basic".
o The authentication parameter 'realm' is REQUIRED ([RFC7235],
Section 2.2).
o The authentication parameter 'charset' is OPTIONAL (see
Section 2.1).
o No other authentication parameters are defined -- unknown
parameters MUST be ignored by recipients, and new parameters can
only be defined by revising this specification.
See also Section 4.1 of [RFC7235], which discusses the complexity of
parsing challenges properly.
Note that both scheme and parameter names are matched case-
insensitively.
For credentials, the "token68" syntax defined in Section 2.1 of
[RFC7235] is used. The value is computed based on user-id and
password as defined below.
Comments:
insensitively. Although it refers to the auth-scheme in the challenge, IMO it should also support case-insensitivity in the client response (eg. Authorization header). It simply does not make sense if the server returns "basic" as the auth-scheme in the challenge and does not support "basic" in the client response Authorization header.
The text was updated successfully, but these errors were encountered: