Documentation
¶
Index ¶
- type JwtAccessTokenConverter
- func (c *JwtAccessTokenConverter) ConvertAccessToken(accessToken token.OAuth2AccessToken, ...) (map[string]interface{}, error)
- func (c *JwtAccessTokenConverter) Decode(tokenString string) (map[string]interface{}, error)
- func (c *JwtAccessTokenConverter) Encode(accessToken token.OAuth2AccessToken, auth *authentication.OAuth2Authentication) (string, error)
- func (c *JwtAccessTokenConverter) Enhance(accessToken token.OAuth2AccessToken, ...) (token.OAuth2AccessToken, error)
- func (c *JwtAccessTokenConverter) ExtractAccessToken(accessToken string, mapInfo map[string]interface{}) (token.OAuth2AccessToken, error)
- func (c *JwtAccessTokenConverter) ExtractAuthentication(mapInfo map[string]interface{}) (*authentication.OAuth2Authentication, error)
- func (c *JwtAccessTokenConverter) GetAccessTokenConverter() token.AccessTokenConverter
- func (c *JwtAccessTokenConverter) IsRefreshToken(token token.OAuth2AccessToken) bool
- func (c *JwtAccessTokenConverter) SetAccessTokenConverter(tokenConverter token.AccessTokenConverter)
- type JwtTokenStore
- func (store *JwtTokenStore) FindTokensByClientID(clientID string) ([]token.OAuth2AccessToken, error)
- func (store *JwtTokenStore) FindTokensByClientIDAndUserName(clientID string, username string) ([]token.OAuth2AccessToken, error)
- func (store *JwtTokenStore) GetAccessToken(authentication *authentication.OAuth2Authentication) (token.OAuth2AccessToken, error)
- func (store *JwtTokenStore) ReadAccessToken(tokenValue string) (token.OAuth2AccessToken, error)
- func (store *JwtTokenStore) ReadAuthentication(accessToken token.OAuth2AccessToken) (*authentication.OAuth2Authentication, error)
- func (store *JwtTokenStore) ReadAuthenticationForRefreshToken(refreshToken token.OAuth2RefreshToken) (*authentication.OAuth2Authentication, error)
- func (store *JwtTokenStore) ReadAuthenticationWith(tokenValue string) (*authentication.OAuth2Authentication, error)
- func (store *JwtTokenStore) ReadRefreshToken(tokenValue string) (token.OAuth2RefreshToken, error)
- func (store *JwtTokenStore) RemoveAccessToken(accessToken token.OAuth2AccessToken)
- func (store *JwtTokenStore) RemoveAccessTokenUsingRefreshToken(refreshToken token.OAuth2RefreshToken)
- func (store *JwtTokenStore) RemoveRefreshToken(refreshToken token.OAuth2RefreshToken)
- func (store *JwtTokenStore) StoreAccessToken(accessToken token.OAuth2AccessToken, ...)
- func (store *JwtTokenStore) StoreRefreshToken(accessToken token.OAuth2RefreshToken, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JwtAccessTokenConverter ¶
type JwtAccessTokenConverter struct { SigningMethod jwt.SigningMethod SigningKey interface{} Keyfunc jwt.Keyfunc // contains filtered or unexported fields }
JwtAccessTokenConverter jwt和oauth2身份验证信息转换器
func NewJwtAccessTokenConverter ¶
func NewJwtAccessTokenConverter(converter token.AccessTokenConverter, method jwt.SigningMethod, signingKey interface{}, keyfunc jwt.Keyfunc) *JwtAccessTokenConverter
NewJwtAccessTokenConverter 实例化
func (*JwtAccessTokenConverter) ConvertAccessToken ¶
func (c *JwtAccessTokenConverter) ConvertAccessToken(accessToken token.OAuth2AccessToken, authentication *authentication.OAuth2Authentication) (map[string]interface{}, error)
ConvertAccessToken 返回访问令牌映射内容
func (*JwtAccessTokenConverter) Decode ¶
func (c *JwtAccessTokenConverter) Decode(tokenString string) (map[string]interface{}, error)
Decode 解码
func (*JwtAccessTokenConverter) Encode ¶
func (c *JwtAccessTokenConverter) Encode(accessToken token.OAuth2AccessToken, auth *authentication.OAuth2Authentication) (string, error)
Encode 编码
func (*JwtAccessTokenConverter) Enhance ¶
func (c *JwtAccessTokenConverter) Enhance(accessToken token.OAuth2AccessToken, authentication *authentication.OAuth2Authentication) (token.OAuth2AccessToken, error)
Enhance Enhancer 接口实现
func (*JwtAccessTokenConverter) ExtractAccessToken ¶
func (c *JwtAccessTokenConverter) ExtractAccessToken(accessToken string, mapInfo map[string]interface{}) (token.OAuth2AccessToken, error)
ExtractAccessToken 根据token value和映射内容提取访问令牌
func (*JwtAccessTokenConverter) ExtractAuthentication ¶
func (c *JwtAccessTokenConverter) ExtractAuthentication(mapInfo map[string]interface{}) (*authentication.OAuth2Authentication, error)
ExtractAuthentication 根据token映射信息提取身份验证信息
func (*JwtAccessTokenConverter) GetAccessTokenConverter ¶
func (c *JwtAccessTokenConverter) GetAccessTokenConverter() token.AccessTokenConverter
GetAccessTokenConverter 获取访问令牌转换器
func (*JwtAccessTokenConverter) IsRefreshToken ¶
func (c *JwtAccessTokenConverter) IsRefreshToken(token token.OAuth2AccessToken) bool
IsRefreshToken 判断是否为 RefreshToken,如果包含 ati 那么为 RefreshToken
func (*JwtAccessTokenConverter) SetAccessTokenConverter ¶
func (c *JwtAccessTokenConverter) SetAccessTokenConverter(tokenConverter token.AccessTokenConverter)
SetAccessTokenConverter 设置访问令牌转换器
type JwtTokenStore ¶
type JwtTokenStore struct {
JwtTokenEnhancer *JwtAccessTokenConverter
}
JwtTokenStore TokenStore jwt 实现
func NewJwtTokenStore ¶
func NewJwtTokenStore(converter *JwtAccessTokenConverter) *JwtTokenStore
NewJwtTokenStore 创建 JwtTokenStore
func (*JwtTokenStore) FindTokensByClientID ¶
func (store *JwtTokenStore) FindTokensByClientID(clientID string) ([]token.OAuth2AccessToken, error)
FindTokensByClientID 通过clientID获取所有访问令牌
func (*JwtTokenStore) FindTokensByClientIDAndUserName ¶
func (store *JwtTokenStore) FindTokensByClientIDAndUserName(clientID string, username string) ([]token.OAuth2AccessToken, error)
FindTokensByClientIDAndUserName 通过clientID和用户名获取所有访问令牌
func (*JwtTokenStore) GetAccessToken ¶
func (store *JwtTokenStore) GetAccessToken(authentication *authentication.OAuth2Authentication) (token.OAuth2AccessToken, error)
GetAccessToken 通过身份验证信息获取访问令牌
func (*JwtTokenStore) ReadAccessToken ¶
func (store *JwtTokenStore) ReadAccessToken(tokenValue string) (token.OAuth2AccessToken, error)
ReadAccessToken 读取访问令牌
func (*JwtTokenStore) ReadAuthentication ¶
func (store *JwtTokenStore) ReadAuthentication(accessToken token.OAuth2AccessToken) (*authentication.OAuth2Authentication, error)
ReadAuthentication 根据token读取身份验证信息
func (*JwtTokenStore) ReadAuthenticationForRefreshToken ¶
func (store *JwtTokenStore) ReadAuthenticationForRefreshToken(refreshToken token.OAuth2RefreshToken) (*authentication.OAuth2Authentication, error)
ReadAuthenticationForRefreshToken 通过刷新令牌读取身份验证信息
func (*JwtTokenStore) ReadAuthenticationWith ¶
func (store *JwtTokenStore) ReadAuthenticationWith(tokenValue string) (*authentication.OAuth2Authentication, error)
ReadAuthenticationWith 根据token读取身份验证信息
func (*JwtTokenStore) ReadRefreshToken ¶
func (store *JwtTokenStore) ReadRefreshToken(tokenValue string) (token.OAuth2RefreshToken, error)
ReadRefreshToken 读取刷新令牌
func (*JwtTokenStore) RemoveAccessToken ¶
func (store *JwtTokenStore) RemoveAccessToken(accessToken token.OAuth2AccessToken)
RemoveAccessToken 移除访问令牌
func (*JwtTokenStore) RemoveAccessTokenUsingRefreshToken ¶
func (store *JwtTokenStore) RemoveAccessTokenUsingRefreshToken(refreshToken token.OAuth2RefreshToken)
RemoveAccessTokenUsingRefreshToken 通过刷新令牌移除访问令牌
func (*JwtTokenStore) RemoveRefreshToken ¶
func (store *JwtTokenStore) RemoveRefreshToken(refreshToken token.OAuth2RefreshToken)
RemoveRefreshToken 移除刷新令牌
func (*JwtTokenStore) StoreAccessToken ¶
func (store *JwtTokenStore) StoreAccessToken(accessToken token.OAuth2AccessToken, authentication *authentication.OAuth2Authentication)
StoreAccessToken 存储访问令牌
func (*JwtTokenStore) StoreRefreshToken ¶
func (store *JwtTokenStore) StoreRefreshToken(accessToken token.OAuth2RefreshToken, authentication *authentication.OAuth2Authentication)
StoreRefreshToken 存储刷新令牌