Versions in this module Expand all Collapse all v1 v1.0.0 Jan 16, 2021 Changes in this version + const TOKEN_TYPE + 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 interface + type AuthorizationCodeVerifier interface + ValidateCode func(appid, secret, code string, req *http.Request) error + type BearerAuthentication struct + func NewBearerAuthentication(secretKey string, formatter TokenSecureFormatter) *BearerAuthentication + func (ba *BearerAuthentication) Authorize(ctx *gin.Context) + type CredentialsVerifier interface + AddClaims func(credential, tokenID, tokenType, scope string) (map[string]string, error) + StoreTokenId func(credential, tokenID, refreshTokenID, tokenType string) error + ValidateClient func(appid, secret, scope string, req *http.Request) error + ValidateResponseCode func(appid, redirectURI, state, scope string) (int, interface{}) + ValidateTokenId func(credential, tokenID, refreshTokenID, tokenType string) error + ValidateUser func(username, password, scope string, req *http.Request) error + type OAuthBearerServer struct + TokenTTL time.Duration + func NewOAuthBearerServer(secretKey string, ttl time.Duration, verifier CredentialsVerifier, ...) *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 struct + func NewRC4TokenSecurityProvider(key []byte) *RC4TokenSecureFormatter + func (sc *RC4TokenSecureFormatter) CryptToken(source []byte) ([]byte, error) + func (sc *RC4TokenSecureFormatter) DecryptToken(source []byte) ([]byte, error) + type RefreshToken struct + CreationDate time.Time + Credential string + RefreshTokenId string + Scope string + TokenId string + TokenType string + type SHA256RC4TokenSecureFormatter struct + func NewSHA256RC4TokenSecurityProvider(key []byte) *SHA256RC4TokenSecureFormatter + func (sc *SHA256RC4TokenSecureFormatter) CryptToken(source []byte) ([]byte, error) + func (sc *SHA256RC4TokenSecureFormatter) DecryptToken(source []byte) ([]byte, error) + type Token struct + Claims map[string]string + CreationDate time.Time + Credential string + ExperesIn time.Duration + Id string + Scope string + TokenType string + type TokenProvider struct + func NewTokenProvider(formatter TokenSecureFormatter) *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 struct + ExperesIn int64 + RefreshToken string + Token string + TokenType string + type TokenSecureFormatter interface + CryptToken func(source []byte) ([]byte, error) + DecryptToken func(source []byte) ([]byte, error)