Merge pull request #288 from fnordahl/change-to-status-found

Change status code used for redirects from StatusTemporaryRedirect (3…
This commit is contained in:
Eric Chiang 2016-01-23 16:46:32 -08:00
commit 26fa124efd
7 changed files with 12 additions and 12 deletions

View file

@ -170,7 +170,7 @@ func handleLoginFunc(lf oidc.LoginFunc, tpl *template.Template, idp *LocalIdenti
} }
w.Header().Set("Location", redirectURL) w.Header().Set("Location", redirectURL)
w.WriteHeader(http.StatusTemporaryRedirect) w.WriteHeader(http.StatusFound)
} }
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {

View file

@ -101,7 +101,7 @@ func (c *OAuth2Connector) handleCallbackFunc(lf oidc.LoginFunc, errorURL url.URL
return return
} }
w.Header().Set("Location", redirectURL) w.Header().Set("Location", redirectURL)
w.WriteHeader(http.StatusTemporaryRedirect) w.WriteHeader(http.StatusFound)
return return
} }
} }

View file

@ -171,7 +171,7 @@ func (c *OIDCConnector) handleCallbackFunc(lf oidc.LoginFunc, errorURL url.URL)
} }
w.Header().Set("Location", redirectURL) w.Header().Set("Location", redirectURL)
w.WriteHeader(http.StatusTemporaryRedirect) w.WriteHeader(http.StatusFound)
return return
} }
} }

View file

@ -81,5 +81,5 @@ func redirectAuthError(w http.ResponseWriter, err error, state string, redirectU
redirectURL.RawQuery = q.Encode() redirectURL.RawQuery = q.Encode()
w.Header().Set("Location", redirectURL.String()) w.Header().Set("Location", redirectURL.String())
w.WriteHeader(http.StatusTemporaryRedirect) w.WriteHeader(http.StatusFound)
} }

View file

@ -211,7 +211,7 @@ func TestWriteAuthError(t *testing.T) {
} }
func TestRedirectAuthError(t *testing.T) { func TestRedirectAuthError(t *testing.T) {
wantCode := http.StatusTemporaryRedirect wantCode := http.StatusFound
tests := []struct { tests := []struct {
err error err error

View file

@ -383,7 +383,7 @@ func handleAuthFunc(srv OIDCServer, idpcs []connector.Connector, tpl *template.T
q.Set("code", key) q.Set("code", key)
ru := httpPathRegister + "?" + q.Encode() ru := httpPathRegister + "?" + q.Encode()
w.Header().Set("Location", ru) w.Header().Set("Location", ru)
w.WriteHeader(http.StatusTemporaryRedirect) w.WriteHeader(http.StatusFound)
return return
} }
} }
@ -404,7 +404,7 @@ func handleAuthFunc(srv OIDCServer, idpcs []connector.Connector, tpl *template.T
http.SetCookie(w, createLastSeenCookie()) http.SetCookie(w, createLastSeenCookie())
w.Header().Set("Location", lu) w.Header().Set("Location", lu)
w.WriteHeader(http.StatusTemporaryRedirect) w.WriteHeader(http.StatusFound)
return return
} }
} }

View file

@ -104,7 +104,7 @@ func TestHandleAuthFuncResponsesSingleRedirectURL(t *testing.T) {
"connector_id": []string{"fake"}, "connector_id": []string{"fake"},
"scope": []string{"openid"}, "scope": []string{"openid"},
}, },
wantCode: http.StatusTemporaryRedirect, wantCode: http.StatusFound,
wantLocation: "http://fake.example.com", wantLocation: "http://fake.example.com",
}, },
@ -117,7 +117,7 @@ func TestHandleAuthFuncResponsesSingleRedirectURL(t *testing.T) {
"connector_id": []string{"fake"}, "connector_id": []string{"fake"},
"scope": []string{"openid"}, "scope": []string{"openid"},
}, },
wantCode: http.StatusTemporaryRedirect, wantCode: http.StatusFound,
wantLocation: "http://fake.example.com", wantLocation: "http://fake.example.com",
}, },
@ -153,7 +153,7 @@ func TestHandleAuthFuncResponsesSingleRedirectURL(t *testing.T) {
"connector_id": []string{"fake"}, "connector_id": []string{"fake"},
"scope": []string{"openid"}, "scope": []string{"openid"},
}, },
wantCode: http.StatusTemporaryRedirect, wantCode: http.StatusFound,
wantLocation: "http://client.example.com/callback?error=unsupported_response_type&state=", wantLocation: "http://client.example.com/callback?error=unsupported_response_type&state=",
}, },
@ -229,7 +229,7 @@ func TestHandleAuthFuncResponsesMultipleRedirectURLs(t *testing.T) {
"connector_id": []string{"fake"}, "connector_id": []string{"fake"},
"scope": []string{"openid"}, "scope": []string{"openid"},
}, },
wantCode: http.StatusTemporaryRedirect, wantCode: http.StatusFound,
wantLocation: "http://fake.example.com", wantLocation: "http://fake.example.com",
}, },
@ -242,7 +242,7 @@ func TestHandleAuthFuncResponsesMultipleRedirectURLs(t *testing.T) {
"connector_id": []string{"fake"}, "connector_id": []string{"fake"},
"scope": []string{"openid"}, "scope": []string{"openid"},
}, },
wantCode: http.StatusTemporaryRedirect, wantCode: http.StatusFound,
wantLocation: "http://fake.example.com", wantLocation: "http://fake.example.com",
}, },