Skip to content

Commit

Permalink
introspection: return with active set false on token error (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
arekkas committed Jun 5, 2017
1 parent d26aa4a commit 82944aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion introspection_request_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (f *Fosite) NewIntrospectionRequest(ctx context.Context, r *http.Request, s

ar, err := f.IntrospectToken(ctx, token, TokenType(tokenType), session, strings.Split(scope, " ")...)
if err != nil {
return &IntrospectionResponse{Active: false}, err
return &IntrospectionResponse{Active: false}, errors.Wrapf(ErrInactiveToken, "Validator returned error %s", err.Error())
}

return &IntrospectionResponse{
Expand Down
4 changes: 2 additions & 2 deletions introspection_request_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestNewIntrospectionRequest(t *testing.T) {
Header: http.Header{},
Form: url.Values{},
}
newErr := errors.New("")
newErr := errors.New("asdf")

for k, c := range []struct {
description string
Expand Down Expand Up @@ -67,7 +67,7 @@ func TestNewIntrospectionRequest(t *testing.T) {
validator.EXPECT().IntrospectToken(nil, "introspect-token", gomock.Any(), gomock.Any(), gomock.Any()).Return(newErr)
},
isActive: false,
expectErr: newErr,
expectErr: ErrInactiveToken,
},
{
description: "should pass",
Expand Down

0 comments on commit 82944aa

Please sign in to comment.