Skip to content
Snippets Groups Projects
Unverified Commit 86e92aaf authored by Romain Caire's avatar Romain Caire Committed by GitHub
Browse files

fix: wrong error code returned in case of inactive token (#3441)

parent 7225198a
Branches
Tags
No related merge requests found
......@@ -340,7 +340,7 @@ func introspectInactiveErr(w http.ResponseWriter) {
w.Header().Set("Cache-Control", "no-store")
w.Header().Set("Pragma", "no-cache")
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(401)
w.WriteHeader(200)
json.NewEncoder(w).Encode(struct {
Active bool `json:"active"`
}{Active: false})
......
......@@ -300,7 +300,7 @@ func TestHandleIntrospect(t *testing.T) {
testName: "Access Token: wrong",
token: "fake-token",
response: inactiveResponse,
responseStatusCode: 401,
responseStatusCode: 200,
},
// Refresh token tests
{
......@@ -313,13 +313,13 @@ func TestHandleIntrospect(t *testing.T) {
testName: "Refresh Token: expired",
token: expiredRefreshToken,
response: inactiveResponse,
responseStatusCode: 401,
responseStatusCode: 200,
},
{
testName: "Refresh Token: active => false (wrong)",
token: "fake-token",
response: inactiveResponse,
responseStatusCode: 401,
responseStatusCode: 200,
},
}
......@@ -380,7 +380,7 @@ func TestIntrospectErrHelper(t *testing.T) {
{
testName: "Inactive Token",
err: newIntrospectInactiveTokenError(),
resStatusCode: http.StatusUnauthorized,
resStatusCode: http.StatusOK,
resBody: "{\"active\":false}\n",
},
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment