Documentation ¶
Index ¶
- func CalcBs160() string
- func CalcBs32() string
- type Store
- func (sess Store) Authorize(h httprouter.Handle, _ ...string) httprouter.Handle
- func (sess *Store) GetAccessToken() string
- func (sess Store) Log(logLine string) (errorArray []error)
- func (sess *Store) RegenerateToken() string
- func (sess Store) RegisterClient(r *http.Request) (string, error)
- func (sess Store) RevokeClient(r *http.Request) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Store ¶
type Store struct { Logger []io.Writer //logging interface // contains filtered or unexported fields }
Store is session token storage with in-memory data. That holds uniq server session id for the LDAP connection, and a map of client session which is keyed by hashed set of ip address and client user agent string.
func NewStore ¶
NewStore generates new token.Store instance, which represents in-memory temporary token store. FIXME: implement salt and regenerate accessToken in effective sequence (against rainbow table attack)
func (Store) Authorize ¶
func (sess Store) Authorize(h httprouter.Handle, _ ...string) httprouter.Handle
Authorize provides local authorization handler for httprouter.Handle handlers. This method searches client information in Store and matches header value with the secret registered in userSessions.
If the matched result is success, it provides protected route for the client.
[Note] customHeader is used for the authentication.
func (*Store) GetAccessToken ¶
GetAccessToken returns preset access token.
func (*Store) RegenerateToken ¶
RegenerateToken recreates access token with CalcBs32 and returns it.
func (Store) RegisterClient ¶
RegisterClient generates new secret and registers client and its secret in Store.