Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
delete unnecessary type to define default user property
Browse files Browse the repository at this point in the history
  • Loading branch information
mfuentesg committed Aug 28, 2018
1 parent ca159b3 commit 6238fa7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions jwtmiddleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ var (
)

type (
// UserProperty default type to write jwt token to request context
UserProperty string
// MiddlewareOption used to define `functional options` approach
MiddlewareOption func(*options)
// TokenExtractor function to extract token and used to define custom extractors
Expand Down Expand Up @@ -107,7 +105,7 @@ func WithUserProperty(property interface{}) MiddlewareOption {
// New creates an instance of the jwt middleware
func New(opts ...MiddlewareOption) *Middleware {
defaults := &options{
userProperty: UserProperty("user"),
userProperty: "user",
signingMethod: jwt.SigningMethodHS256,
errorHandler: onError,
extractor: BearerExtractor,
Expand Down
2 changes: 1 addition & 1 deletion jwtmiddleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestNew(t *testing.T) {
t.Errorf("wrong default signingMethod got %v", m.options.signingMethod)
}

if reflect.TypeOf(m.options.userProperty) != reflect.TypeOf(UserProperty("")) {
if m.options.userProperty != "user" {
t.Errorf("expect an instance of jwtmiddleware.UserProperty type, got %v", reflect.TypeOf(m.options.userProperty))
}

Expand Down

0 comments on commit 6238fa7

Please sign in to comment.