Documentation ¶
Index ¶
- Constants
- func Authorize(secretKey string, formatter TokenSecureFormatter) gin.HandlerFunc
- func Fail(c *gin.Context, code, message interface{})
- func Successful(c *gin.Context, data interface{})
- type Any
- type AuthorizationCodeVerifier
- type BearerAuthentication
- type CredentialsVerifier
- type OAuthBearerServer
- func (s *OAuthBearerServer) AuthAccessToken(ctx *gin.Context)
- func (s *OAuthBearerServer) AuthRefreshToken(ctx *gin.Context)
- func (s *OAuthBearerServer) AuthorizationCode(ctx *gin.Context)
- func (s *OAuthBearerServer) Authorize(ctx *gin.Context)
- func (s *OAuthBearerServer) ClientCredentials(ctx *gin.Context)
- func (s *OAuthBearerServer) UserCredentials(ctx *gin.Context)
- type RC4TokenSecureFormatter
- type RefreshToken
- type SHA256RC4TokenSecureFormatter
- type Token
- type TokenProvider
- func (tp *TokenProvider) CryptRefreshToken(t *RefreshToken) (token string, err error)
- func (tp *TokenProvider) CryptToken(t *Token) (token string, err error)
- func (tp *TokenProvider) DecryptRefreshTokens(refreshToken string) (refresh *RefreshToken, err error)
- func (tp *TokenProvider) DecryptToken(token string) (t *Token, err error)
- type TokenResponse
- type TokenSecureFormatter
Constants ¶
View Source
const (
TOKEN_TYPE = "Bearer"
)
Variables ¶
This section is empty.
Functions ¶
func Authorize ¶
func Authorize(secretKey string, formatter TokenSecureFormatter) gin.HandlerFunc
func Successful ¶
Types ¶
type BearerAuthentication ¶
type BearerAuthentication struct {
// contains filtered or unexported fields
}
func NewBearerAuthentication ¶
func NewBearerAuthentication(secretKey string, formatter TokenSecureFormatter) *BearerAuthentication
func (*BearerAuthentication) Authorize ¶
func (ba *BearerAuthentication) Authorize(ctx *gin.Context)
type CredentialsVerifier ¶
type CredentialsVerifier interface { ValidateUser(username, password, scope string, req *http.Request) error ValidateClient(appid, secret, scope string, req *http.Request) error AddClaims(credential, tokenID, tokenType, scope string) (map[string]string, error) StoreTokenId(credential, tokenID, refreshTokenID, tokenType string) error ValidateTokenId(credential, tokenID, refreshTokenID, tokenType string) error ValidateResponseCode(appid, redirectURI, state, scope string) (int, interface{}) }
type OAuthBearerServer ¶
func NewOAuthBearerServer ¶
func NewOAuthBearerServer(secretKey string, ttl time.Duration, verifier CredentialsVerifier, formatter TokenSecureFormatter) *OAuthBearerServer
func (*OAuthBearerServer) AuthAccessToken ¶
func (s *OAuthBearerServer) AuthAccessToken(ctx *gin.Context)
func (*OAuthBearerServer) AuthRefreshToken ¶
func (s *OAuthBearerServer) AuthRefreshToken(ctx *gin.Context)
func (*OAuthBearerServer) AuthorizationCode ¶
func (s *OAuthBearerServer) AuthorizationCode(ctx *gin.Context)
func (*OAuthBearerServer) Authorize ¶
func (s *OAuthBearerServer) Authorize(ctx *gin.Context)
func (*OAuthBearerServer) ClientCredentials ¶
func (s *OAuthBearerServer) ClientCredentials(ctx *gin.Context)
func (*OAuthBearerServer) UserCredentials ¶
func (s *OAuthBearerServer) UserCredentials(ctx *gin.Context)
type RC4TokenSecureFormatter ¶
type RC4TokenSecureFormatter struct {
// contains filtered or unexported fields
}
func NewRC4TokenSecurityProvider ¶
func NewRC4TokenSecurityProvider(key []byte) *RC4TokenSecureFormatter
func (*RC4TokenSecureFormatter) CryptToken ¶
func (sc *RC4TokenSecureFormatter) CryptToken(source []byte) ([]byte, error)
func (*RC4TokenSecureFormatter) DecryptToken ¶
func (sc *RC4TokenSecureFormatter) DecryptToken(source []byte) ([]byte, error)
type RefreshToken ¶
type SHA256RC4TokenSecureFormatter ¶
type SHA256RC4TokenSecureFormatter struct {
// contains filtered or unexported fields
}
func NewSHA256RC4TokenSecurityProvider ¶
func NewSHA256RC4TokenSecurityProvider(key []byte) *SHA256RC4TokenSecureFormatter
func (*SHA256RC4TokenSecureFormatter) CryptToken ¶
func (sc *SHA256RC4TokenSecureFormatter) CryptToken(source []byte) ([]byte, error)
func (*SHA256RC4TokenSecureFormatter) DecryptToken ¶
func (sc *SHA256RC4TokenSecureFormatter) DecryptToken(source []byte) ([]byte, error)
type TokenProvider ¶
type TokenProvider struct {
// contains filtered or unexported fields
}
func NewTokenProvider ¶
func NewTokenProvider(formatter TokenSecureFormatter) *TokenProvider
func (*TokenProvider) CryptRefreshToken ¶
func (tp *TokenProvider) CryptRefreshToken(t *RefreshToken) (token string, err error)
func (*TokenProvider) CryptToken ¶
func (tp *TokenProvider) CryptToken(t *Token) (token string, err error)
func (*TokenProvider) DecryptRefreshTokens ¶
func (tp *TokenProvider) DecryptRefreshTokens(refreshToken string) (refresh *RefreshToken, err error)
func (*TokenProvider) DecryptToken ¶
func (tp *TokenProvider) DecryptToken(token string) (t *Token, err error)
type TokenResponse ¶
Click to show internal directories.
Click to hide internal directories.