Comments (5)
I guess you try to address my problem with the wrapped.go example, however, I'm getting the following error:
the runtime process gave a bad HTTP response: ''
from go-http-auth.
This was a design decision. http.Request does not have a good place to pass authentication information, so it can't be used, and this also does not allow to use http.HandlerFunc with authenticated requests passing authentication information. If you are not interested in authentication information, use JustCheck wrapper as shown in wrapped.go example. Please reopen this ticket if wrapped.go example does not work as expected.
from go-http-auth.
Would you accept a PR with a handler similar to JustCheck except that it takes a standard http handler func? It should be possible to put the username in the request context since go 1.7 (https://golang.org/doc/go1.7#context).
from go-http-auth.
I guess, it would be a variation of https://github.com/abbot/go-http-auth/blob/master/examples/context.go, right?
Something like
func authenticatedHandler(a auth.AuthenticatorInterface, h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
h.ServeHTTP(w, r.WithContext(a.NewContext(r.Context(), r)))
})
}
(didn't actually test this code)
Can you point at your code?
from go-http-auth.
I haven't implemented it yet, but your snippet looks fine. Do you suggest that we create this handler func ourself in our projects, or that this package provides it as a helper?
It seems very similar to JustCheck excepts it sets it in the request context rather than a HTTP header.
from go-http-auth.
Related Issues (20)
- How to create a password from string HOT 1
- Tag v1 version and add it to gopkg.in
- Support digest with SHA-256 and SHA-512/256 as per RFC 7616 HOT 3
- Can i use this to send HTTP GET to a Digest authenticated server? HOT 1
- DigestAuth functions aren't thread-safe (Race conditions) HOT 3
- Go 1.10: misc_test.go:35: Fatalf format %s reads arg #3, but call has only 2 args
- BasicAuth password generate HOT 2
- algorithm HOT 1
- Session Expiry handling
- Update example?
- use of raw map for digest.clients leads to concurrent writes to map HOT 1
- Documentation on how to set passwords. HOT 1
- intermittent failure to find passwords (possible race?) HOT 4
- concurrent map read and map write HOT 2
- More crypters [Patch included] HOT 2
- MD5Crypt takes up high CPU HOT 3
- Double lock in digest
- Imlement http.Handler interface
- repeat ask user and password when using digest
- please tag and release HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-http-auth.