Skip to content

Commit

Permalink
fix: add Authenticated func to context
Browse files Browse the repository at this point in the history
  • Loading branch information
ken109 committed Nov 7, 2021
1 parent 3016839 commit 9cfb778
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

type Context interface {
RequestID() string
Authenticated() bool
UserID() uint

Validate(request interface{}) (ok bool)
Expand Down Expand Up @@ -44,6 +45,10 @@ func (c ctx) RequestID() string {
return c.id
}

func (c ctx) Authenticated() bool {
return c.userID != 0
}

func (c ctx) UserID() uint {
return c.userID
}

0 comments on commit 9cfb778

Please sign in to comment.