Improvements for tokens
This commit is contained in:
parent
effa79aacd
commit
8ccd490bed
15 changed files with 34 additions and 30 deletions
|
|
@ -19,18 +19,18 @@ var (
|
|||
)
|
||||
|
||||
const (
|
||||
ScopeUserLoggedIn Scope = "login.user"
|
||||
ScopeUserValid Scope = "user.valid"
|
||||
)
|
||||
|
||||
func (*UserLoggedIn) Scope() component.ScopeInfo {
|
||||
return component.ScopeInfo{
|
||||
Scope: ScopeUserLoggedIn,
|
||||
Description: "session has an associated user",
|
||||
Scope: ScopeUserValid,
|
||||
Description: "session must have a valid user",
|
||||
TakesParam: false,
|
||||
}
|
||||
}
|
||||
|
||||
func (iu *UserLoggedIn) HasScope(param string, r *http.Request) (bool, error) {
|
||||
user, _, err := iu.Dependencies.Auth.SessionOf(r)
|
||||
_, user, err := iu.Dependencies.Auth.SessionOf(r)
|
||||
return user != nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue