@@ -54,7 +54,7 @@ func (h *Handler) validateSession(r *http.Request) error {
5454 if h .dependencies .Config ().Http .SSOProxyAuth {
5555 account , err = h .ssoAccount (r )
5656 if err != nil {
57- return err
57+ h . dependencies . Logger (). WithError ( err ). Error ( "getting sso account" )
5858 }
5959 }
6060
@@ -116,18 +116,12 @@ func (h *Handler) ssoAccount(r *http.Request) (*model.AccountDTO, error) {
116116 if errors .As (err , & addrErr ) && addrErr .Err == "missing port in address" {
117117 ip = remoteAddr
118118 } else {
119- h .dependencies .Logger ().
120- WithError (err ).
121- WithField ("remote_addr" , remoteAddr ).
122- WithField ("method" , r .Method ).
123- WithField ("path" , r .URL .Path ).
124- Error ("Could not parse remote ip" )
125- return nil , nil
119+ return nil , err
126120 }
127121 }
128122 requestIP := net .ParseIP (ip )
129123 if ! h .isTrustedIP (requestIP ) {
130- return nil , nil
124+ return nil , fmt . Errorf ( "'%s' is not a trusted ip" , r . RemoteAddr )
131125 }
132126
133127 headerName := h .dependencies .Config ().Http .SSOProxyAuthHeaderName
@@ -138,11 +132,6 @@ func (h *Handler) ssoAccount(r *http.Request) (*model.AccountDTO, error) {
138132
139133 account , err := h .dependencies .Domains ().Accounts ().GetAccountByUsername (r .Context (), userName )
140134 if err != nil {
141- h .dependencies .Logger ().
142- WithError (err ).
143- WithField ("method" , r .Method ).
144- WithField ("path" , r .URL .Path ).
145- Error ("Failed to get account from sso header" )
146135 return nil , err
147136 }
148137
0 commit comments