From 82944aaa42ddc9c718ee072d5a11635ec982394d Mon Sep 17 00:00:00 2001 From: Aeneas Date: Mon, 5 Jun 2017 16:30:27 +0200 Subject: [PATCH] introspection: return with active set false on token error (#176) --- introspection_request_handler.go | 2 +- introspection_request_handler_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/introspection_request_handler.go b/introspection_request_handler.go index c80217dec..6afbb7e47 100644 --- a/introspection_request_handler.go +++ b/introspection_request_handler.go @@ -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{ diff --git a/introspection_request_handler_test.go b/introspection_request_handler_test.go index 138dfcfbb..a49eb574f 100644 --- a/introspection_request_handler_test.go +++ b/introspection_request_handler_test.go @@ -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 @@ -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",