Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dex
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hdacloud
dex
Commits
86e92aaf
Unverified
Commit
86e92aaf
authored
1 year ago
by
Romain Caire
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: wrong error code returned in case of inactive token (#3441)
Signed-off-by:
Romain Caire
<
super.cairos@gmail.com
>
parent
7225198a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/introspectionhandler.go
+1
-1
1 addition, 1 deletion
server/introspectionhandler.go
server/introspectionhandler_test.go
+4
-4
4 additions, 4 deletions
server/introspectionhandler_test.go
with
5 additions
and
5 deletions
server/introspectionhandler.go
+
1
−
1
View file @
86e92aaf
...
...
@@ -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
})
...
...
This diff is collapsed.
Click to expand it.
server/introspectionhandler_test.go
+
4
−
4
View file @
86e92aaf
...
...
@@ -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
.
Status
Unauthorized
,
resStatusCode
:
http
.
Status
OK
,
resBody
:
"{
\"
active
\"
:false}
\n
"
,
},
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment