Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the valid characters in http Authorization header

I couldn't find an easy to understand answer in the specification document. Besides the simple answer I would be glad to get a reference to the specification describing this.

This question is a follow up for Authorization header in null when setting its value to an Encrypted SAML 2 token.

like image 709
RonyK Avatar asked Oct 22 '13 08:10

RonyK


People also ask

What is HTTP Authorization header?

The HTTP Authorization request header can be used to provide credentials that authenticate a user agent with a server, allowing access to a protected resource. The Authorization header is usually, but not always, sent after the user agent first attempts to request a protected resource without credentials.

What does a basic auth header look like?

Basic Auth: The client sends HTTP requests with the Authorization header that contains the word Basic, followed by a space and a base64-encoded(non-encrypted) string username: password. For example, to authorize as username / Pa$$w0rd the client would send.

What is HTTP auth username?

HTTP basic authentication is a simple challenge and response mechanism with which a server can request authentication information (a user ID and password) from a client. The client passes the authentication information to the server in an Authorization header. The authentication information is in base-64 encoding.

What kind of authentication is supported by HTTP headers?

HTTP supports the use of several authentication mechanisms to control access to pages and other resources. These mechanisms are all based around the use of the 401 status code and the WWW-Authenticate response header. The client sends the user name and password as unencrypted base64 encoded text.

What is the HTTP Authorization header?

The HTTP Authorization request header contains the credentials to authenticate a user agent with a server. APIs use authorization to ensure that client requests access data securely. This can involve authenticating the sender of a request and verifying that they have permission to access or manipulate the relevant data.

What characters are allowed in HTTP header values?

what characters are allowed in HTTP header values? Bookmark this question. Show activity on this post. After studying HTTP/1.1 standard, specifically page 31 and related I came to conclusion that any 8-bit octet can be present in HTTP header value. I.e. any character with code from [0,255] range.

What are HTTP headers?

Last Updated : 25 Aug, 2021 The HTTP headers are used to pass additional information between the clients and the server through the request and response header. All the headers are case-insensitive, headers fields are separated by colon, key-value pairs in clear-text string format. The end of the header section denoted by an empty field header.

What is the Accept header used for?

The Accept header is used to inform the server by the client that which content type is understandable by the client expressed as MIME-types. It is a request type header. This header is used to indicate what character set are acceptable for the response from the server.


1 Answers

RFC 2616, 14.8 Authorization:

Authorization = "Authorization" ":" credentials

RFC 2616, 11 Access Authentication:

This specification adopts the definitions of [..] "credentials" from [RFC 2617].

RFC 2617, 1.2 1.2 Access Authentication Framework:

credentials    = auth-scheme #auth-param
auth-scheme    = token
auth-param     = token "=" ( token | quoted-string )

RFC 2617, 2 Basic Authentication Scheme

For Basic, the framework above is utilized as follows:
 credentials = "Basic" basic-credentials

So after the fixed Authorization: part, you can use:

  • token, followed by an optional "=" (token | quoted-string) (see page 16 of RFC 2616) when using Digest or any other unspecified authentication scheme, or
  • "Basic" basic-credentials when using Basic authentication, where basic-credentials are base64-encoded according to RFC 2045.

I guess though that you're actually trying to ask a different question. Do you have any trouble regarding implementing a specific authorization mechanism? In what language are you trying to implement that, what code do you currently have and what is the problem?

like image 93
CodeCaster Avatar answered Nov 08 '22 23:11

CodeCaster