diff options
Diffstat (limited to 'contrib/tlsauth/gemini.go')
-rw-r--r-- | contrib/tlsauth/gemini.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/contrib/tlsauth/gemini.go b/contrib/tlsauth/gemini.go index 9996595..9bf07bd 100644 --- a/contrib/tlsauth/gemini.go +++ b/contrib/tlsauth/gemini.go @@ -15,11 +15,10 @@ import ( func GeminiAuth(approver Approver) sr.Middleware { return func(inner sr.Handler) sr.Handler { return sr.HandlerFunc(func(ctx context.Context, request *sr.Request) *sr.Response { - identity := Identity(request) - if identity == nil { + if Identity(request) == nil { return geminiMissingCert(ctx, request) } - if !approver(identity) { + if !approver(ctx, request) { return geminiCertNotAuthorized(ctx, request) } @@ -36,8 +35,7 @@ func GeminiAuth(approver Approver) sr.Middleware { func GeminiOptionalAuth(approver Approver) sr.Middleware { return func(inner sr.Handler) sr.Handler { return sr.HandlerFunc(func(ctx context.Context, request *sr.Request) *sr.Response { - identity := Identity(request) - if identity != nil && !approver(identity) { + if Identity(request) != nil && !approver(ctx, request) { return geminiCertNotAuthorized(ctx, request) } |