mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #21736 from eliotsykes/document-bearer-prefix
Document Bearer prefix for Authorization header [ci skip]
This commit is contained in:
commit
262f92364b
1 changed files with 7 additions and 5 deletions
|
@ -436,15 +436,17 @@ module ActionController
|
|||
end
|
||||
end
|
||||
|
||||
# Parses the token and options out of the token authorization header. If
|
||||
# the header looks like this:
|
||||
# Parses the token and options out of the token authorization header.
|
||||
# The value for the Authorization header is expected to have the prefix
|
||||
# <tt>"Token"</tt> or <tt>"Bearer"</tt>. If the header looks like this:
|
||||
# Authorization: Token token="abc", nonce="def"
|
||||
# Then the returned token is "abc", and the options is {nonce: "def"}
|
||||
# Then the returned token is <tt>"abc"</tt>, and the options are
|
||||
# <tt>{nonce: "def"}</tt>
|
||||
#
|
||||
# request - ActionDispatch::Request instance with the current headers.
|
||||
#
|
||||
# Returns an Array of [String, Hash] if a token is present.
|
||||
# Returns nil if no token is found.
|
||||
# Returns an +Array+ of <tt>[String, Hash]</tt> if a token is present.
|
||||
# Returns +nil+ if no token is found.
|
||||
def token_and_options(request)
|
||||
authorization_request = request.authorization.to_s
|
||||
if authorization_request[TOKEN_REGEX]
|
||||
|
|
Loading…
Reference in a new issue