Implement bearer tokens

This commit is contained in:
Morgan Bazalgette
2017-06-17 18:11:10 +02:00
parent 155750b746
commit 1136738111
5 changed files with 146 additions and 11 deletions

View File

@@ -143,3 +143,8 @@ func (md MethodData) HasQuery(q string) bool {
func (md MethodData) Unmarshal(into interface{}) error {
return json.Unmarshal(md.Ctx.PostBody(), into)
}
// IsBearer tells whether the current token is a Bearer (oauth) token.
func (md MethodData) IsBearer() bool {
return md.User.ID == -1
}