diff options
author | tjpcc <tjp@ctrl-c.club> | 2023-05-01 07:56:25 -0600 |
---|---|---|
committer | tjpcc <tjp@ctrl-c.club> | 2023-05-01 07:56:25 -0600 |
commit | 9a2da81b11ad0064cca24ce7974827d032309369 (patch) | |
tree | 4313224dc089208423e78bffc3ec50833e35bcea /contrib/tlsauth/gemini.go | |
parent | 21e2758145d100d74013060f7090d84679cae683 (diff) |
name change gus -> sliderule
Diffstat (limited to 'contrib/tlsauth/gemini.go')
-rw-r--r-- | contrib/tlsauth/gemini.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/contrib/tlsauth/gemini.go b/contrib/tlsauth/gemini.go index 40bee9e..9996595 100644 --- a/contrib/tlsauth/gemini.go +++ b/contrib/tlsauth/gemini.go @@ -3,8 +3,8 @@ package tlsauth import ( "context" - "tildegit.org/tjp/gus" - "tildegit.org/tjp/gus/gemini" + sr "tildegit.org/tjp/sliderule" + "tildegit.org/tjp/sliderule/gemini" ) // GeminiAuth builds an authentication middleware from approval criteria. @@ -12,9 +12,9 @@ import ( // If a request does not contain a client certificate it will be rejected // with a "60 certificate required" response. If the client identity does // not pass the approver it will be rejected with "62 certificate invalid". -func GeminiAuth(approver Approver) gus.Middleware { - return func(inner gus.Handler) gus.Handler { - return gus.HandlerFunc(func(ctx context.Context, request *gus.Request) *gus.Response { +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 { return geminiMissingCert(ctx, request) @@ -33,9 +33,9 @@ func GeminiAuth(approver Approver) gus.Middleware { // If there is no client certificate the request will pass through the middleware. // It will only be rejected with "62 certificate invalid" if there *is* a client // certificate, but it fails the approval. -func GeminiOptionalAuth(approver Approver) gus.Middleware { - return func(inner gus.Handler) gus.Handler { - return gus.HandlerFunc(func(ctx context.Context, request *gus.Request) *gus.Response { +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) { return geminiCertNotAuthorized(ctx, request) @@ -49,10 +49,10 @@ func GeminiOptionalAuth(approver Approver) gus.Middleware { // GeminiRequireCertificate is a middleware that only requires a client certificate. var GeminiRequireCertificate = GeminiAuth(Allow) -func geminiMissingCert(_ context.Context, _ *gus.Request) *gus.Response { +func geminiMissingCert(_ context.Context, _ *sr.Request) *sr.Response { return gemini.RequireCert("A client certificate is required.") } -func geminiCertNotAuthorized(_ context.Context, _ *gus.Request) *gus.Response { +func geminiCertNotAuthorized(_ context.Context, _ *sr.Request) *sr.Response { return gemini.CertAuthFailure("Client certificate not authorized.") } |