Documentation ¶
Index ¶
Constants ¶
View Source
const ( C_ACCESS_TOKEN = "access_token" C_REFRESH_TOKEN = "refresh_token" )
Variables ¶
This section is empty.
Functions ¶
func NewMemoryTokenStoreInstance ¶
func NewMemoryTokenStoreInstance() *memoryTokenStore
NewMemoryTokenStoreInstance 实例化
Types ¶
type ClientInfo ¶
type ClientInfo struct { ClientId string ClientSecret string GrantType []common.GrantType Scope []string AccessTokenDuration time.Duration RefreshTokenDuration time.Duration }
ClientInfo 客户端信息
type ClientStore ¶
type ClientStore interface { // GetClient 获取客户端 GetClient(clientId string) (*ClientInfo, error) // AddClient 追加客户端信息 AddClient(clientInfo *ClientInfo) error // RemoveClient 删除客户端信息 RemoveClient(clientId string) error }
ClientStore 接口
func NewMemoryClientStoreInstance ¶
func NewMemoryClientStoreInstance() ClientStore
获取内存类型 Client Store
type TokenStore ¶
type TokenStore interface { // 生成token GenerateToken( clientInfo *ClientInfo, userName string, scope []string, roles []string, authorities []string, customPayload map[string]interface{}) (accessToken, refreshToken string, err error) // 刷新token RefreshToken( refreshToken string, clientInfo *ClientInfo, userName string, scope []string, roles []string, authorities []string, customPayload map[string]interface{}) (accessTokenRtn, refreshTokenRtn string, err error) // 检查AccessToken CheckAccessToken(accessToken string) bool }
TokenStore TokenStore接口
目前实现: 内存类型:store.memoryClientStore MySQL类型: store.mySQLClientStore
Click to show internal directories.
Click to hide internal directories.