func GetAccessByToken(tx *sql.Tx, token string) (*osin.AccessData, error) { access, err := datastore.GetAccessByToken(tx, token) if err != nil { return nil, err } client, err := GetClientByUID(tx, access.ClientID) if err != nil { return nil, err } a := &osin.AccessData{ Client: client, AuthorizeData: nil, AccessData: nil, AccessToken: access.AccessToken, RefreshToken: access.RefreshToken, ExpiresIn: access.ExpiresIn, Scope: access.Scope, RedirectUri: access.RedirectUri, CreatedAt: access.CreatedAt, } return a, nil }
func InvalidateToken(tx *sql.Tx, r *http.Request) error { token := server.AccessToken(r) _, err := datastore.GetAccessByToken(tx, token) if err != nil { return err } err = server.Server.Storage.RemoveAccess(token) if err != nil { return err } return nil }