diff --git a/samlidp/samlidp.go b/samlidp/samlidp.go index 13ca10b9..7e5b36a7 100644 --- a/samlidp/samlidp.go +++ b/samlidp/samlidp.go @@ -80,6 +80,15 @@ func New(opts Options) (*Server, error) { return s, nil } +// InitializeLogger initialize the Server logger. (This function should be used only when +// not using the default New(opts Options) function where the logger +// object can be passed through the options) +func (s *Server) InitializeLogger(logger logger.Interface) { + if s != nil { + s.logger = logger + } +} + // InitializeHTTP sets up the HTTP handler for the server. (This function // is called automatically for you by New, but you may need to call it // yourself if you don't create the object using New.) diff --git a/samlidp/service.go b/samlidp/service.go index 0b62cd3b..cc0a97f5 100644 --- a/samlidp/service.go +++ b/samlidp/service.go @@ -93,6 +93,9 @@ func (s *Server) HandlePutService(c web.C, w http.ResponseWriter, r *http.Reques } s.idpConfigMu.Lock() + if s.serviceProviders == nil { + s.serviceProviders = map[string]*saml.EntityDescriptor{} + } s.serviceProviders[service.Metadata.EntityID] = &service.Metadata s.idpConfigMu.Unlock()