refactor(middleware): remove RequireGlobalAuth wrapper
This commit is contained in:
@@ -55,10 +55,6 @@ func RequireAuth(next http.Handler) http.Handler {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func RequireGlobalAuth(next http.Handler) http.Handler {
|
|
||||||
return RequireGlobalAuthWithPolicy(NewAccessPolicy())(next)
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetUser(ctx context.Context) *database.User {
|
func GetUser(ctx context.Context) *database.User {
|
||||||
user, ok := ctx.Value(UserContextKey).(*database.User)
|
user, ok := ctx.Value(UserContextKey).(*database.User)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ func TestRequireAuth_AuthenticatedRequestPassesThrough(t *testing.T) {
|
|||||||
func TestRequireGlobalAuth_AllowsPublicRoute(t *testing.T) {
|
func TestRequireGlobalAuth_AllowsPublicRoute(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
h := RequireGlobalAuth(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
h := RequireGlobalAuthWithPolicy(NewAccessPolicy())(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user