Skip to content
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

net/http: add GetBasicAuth method to *http.Request #6779

Closed
gopherbot opened this issue Nov 16, 2013 · 10 comments
Closed

net/http: add GetBasicAuth method to *http.Request #6779

gopherbot opened this issue Nov 16, 2013 · 10 comments

Comments

@gopherbot
Copy link

by jasper.timm:

For completeness sake it seems that, considering there is a SetBasicAuth method in
net/http which can be used to set the 'Authorization' header in a request, there should
be an equivalent method to GetBasicAuth credentials from a request as well, which given
a request would return the username and password given in the 'Authorization' header.

A discussion was created in the go-nuts google group:
https://groups.google.com/forum/#!topic/golang-nuts/EZMr3X2NPGc
@adg
Copy link
Contributor

adg commented Nov 18, 2013

Comment 1:

Labels changed: added priority-later, removed priority-triage.

Owner changed to @bradfitz.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 2:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 3:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 4:

Labels changed: added repo-main.

@kelseyhightower
Copy link
Contributor

Comment 5:

I've submitted a CL for this issue: https://golang.org/cl/76540043

@gopherbot
Copy link
Author

Comment 6:

CL https://golang.org/cl/76540043 references this issue.

@gopherbot
Copy link
Author

Comment 7:

CL https://golang.org/cl/76540043 references this issue.

@gopherbot
Copy link
Author

Comment 8 by matthias.kadenbach:

> Please ping this thread again after Go 1.3.
Ping ;-) GetBasicAuth urgently needed.

@bradfitz
Copy link
Contributor

Comment 9:

This is not "urgently" needed, because it can be done trivially anywhere else. Urgent
would mean you're incapable of doing it otherwise and your site is going down because Go
has a memory leak or is crashing. This is pretty much the least urgent thing ever.
But I agree it makes sense for symmetry.

@bradfitz
Copy link
Contributor

Comment 10:

This issue was closed by revision 29f9f3e.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
The net/http package supports setting the HTTP Authorization header
using the Basic Authentication Scheme as defined in RFC 2617, but does
not provide support for extracting the username and password from an
authenticated request using the Basic Authentication Scheme.

Add BasicAuth method to *http.Request that returns the username and
password from authenticated requests using the Basic Authentication
Scheme.

Fixes golang#6779.

LGTM=bradfitz
R=golang-codereviews, josharian, bradfitz, alberto.garcia.hierro, blakesgentry
CC=golang-codereviews
https://golang.org/cl/76540043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
The net/http package supports setting the HTTP Authorization header
using the Basic Authentication Scheme as defined in RFC 2617, but does
not provide support for extracting the username and password from an
authenticated request using the Basic Authentication Scheme.

Add BasicAuth method to *http.Request that returns the username and
password from authenticated requests using the Basic Authentication
Scheme.

Fixes golang#6779.

LGTM=bradfitz
R=golang-codereviews, josharian, bradfitz, alberto.garcia.hierro, blakesgentry
CC=golang-codereviews
https://golang.org/cl/76540043
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants