add Token authentication support

Added CRUD methods for Tokens.
Extend Auth Handler to check for the presence of a Bearer Authorization
header to authenticate against. If there is no header, or the token is not
valid, the Auth Handler falls back to looking for a Session.
This commit is contained in:
woodsaj
2015-01-14 16:33:34 +08:00
parent e58cd91487
commit 7b17e38f5d
8 changed files with 311 additions and 36 deletions

View File

@ -26,6 +26,12 @@ func Register(m *macaron.Macaron) {
m.Post("/api/account/using/:id", auth, SetUsingAccount)
m.Get("/api/account/others", auth, GetOtherAccounts)
// Token
m.Get("/api/tokens/list", auth, GetTokens)
m.Put("/api/tokens", auth, AddToken)
m.Post("/api/tokens", auth, UpdateToken)
m.Delete("/api/tokens/:id", auth, DeleteToken)
// data sources
m.Get("/acount/datasources/", auth, Index)
m.Get("/api/datasources/list", auth, GetDataSources)