unify identity service registration
2 files changed, 3 insertions(+), 18 deletions(-)
M domain/identity/service.go → domain/identity/service.go
@@ -31,8 +31,7 @@ } func (s *Service) RegisterHandlers(mux *http.ServeMux) { s.oidc.RegisterHandlers(mux) - - mux.HandleFunc("/.well-known/webfinger", s.webfinger.HandleFunc) + s.webfinger.RegisterHandlers(mux) } func (s *Service) GetOIDCService() *oidc.Service {
M domain/identity/webfinger/service.go → domain/identity/webfinger/service.go
@@ -43,12 +43,8 @@ return service } -func (s *Service) RegisterHandlers(mux *http.ServeMux) { - mux.HandleFunc("/.well-known/webfinger", s.handleWebFinger) -} - -func (s *Service) Handler() http.HandlerFunc { - return s.handleWebFinger +func (s *Service) RegisterHandlers(mux *ihttp.ServeMux) { + mux.HandleFunc("/.well-known/webfinger", s.HandleFunc) } func (s *Service) HandleFunc(w http.ResponseWriter, r *http.Request) ihttp.Error {@@ -75,13 +71,3 @@ } return ihttp.NotFound("Resource not found") } - -func (s *Service) handleWebFinger(w http.ResponseWriter, r *http.Request) { - if err := s.HandleFunc(w, r); err != nil { - status := err.StatusCode() - if status == 0 { - status = http.StatusInternalServerError - } - http.Error(w, err.Error(), status) - } -}