Documentation ¶
Index ¶
- Constants
- func APIKey(ctx context.Context) *string
- func Auth(ctx context.Context) jwt.MapClaims
- func CalculateFingerprint(pubKey *rsa.PublicKey) ([]byte, error)
- func CalculateThumbprint(pubKey *rsa.PublicKey, hashFunc hash.Hash) ([]byte, error)
- func ClientIP(ctx context.Context) *string
- func CreateJWKSFile(col *mongo.Collection) error
- func CreateToken(claims map[string]interface{}, kid string, key interface{}) (string, error)
- func GenerateRSAKeyPair(bits int) (*rsa.PrivateKey, error)
- func GoogleLogin(c context.Context, idToken string) (string, error)
- func Locale(ctx context.Context) *string
- func Middleware(client *grpc.ClientConn) gin.HandlerFunc
- func Token(claims jwt.MapClaims, k model.Key) (*string, error)
- func UserAgent(ctx context.Context) *string
- func ValidateToken(tokenString string, jwksURL string) (*jwt.Token, error)
- type JWKSKey
Constants ¶
View Source
const APIKeyContextKey contextKey = "APIKeyContextKey"
View Source
const AuthContextKey contextKey = "AuthContextKey"
View Source
const ClientIPContextKey contextKey = "ClientIPContextKey"
View Source
const GinContextKey contextKey = "GinContextKey"
Define the key you want to use to store the gin.Context in the request context
View Source
const LocaleContextKey contextKey = "LocaleContextKey"
View Source
const UserAgentContextKey contextKey = "UserAgentContextKey"
Variables ¶
This section is empty.
Functions ¶
func CalculateThumbprint ¶
func CreateJWKSFile ¶
func CreateJWKSFile(col *mongo.Collection) error
func CreateToken ¶
CreateToken takes some claims and a private key (either rsa or ec) and returns a signed json web token
func GenerateRSAKeyPair ¶
func GenerateRSAKeyPair(bits int) (*rsa.PrivateKey, error)
func Middleware ¶
func Middleware(client *grpc.ClientConn) gin.HandlerFunc
func ValidateToken ¶
Types ¶
type JWKSKey ¶
type JWKSKey struct { Kid string `json:"kid"` Kty string `json:"kty"` Use string `json:"use"` Alg string `json:"alg"` N string `json:"n"` E string `json:"e"` X5c []string `json:"x5c,omitempty"` X5t string `json:"x5t,omitempty"` X5tS256 string `json:"x5t#S256,omitempty"` }
JWKSKey represents a JSON Web Key (JWK).
Click to show internal directories.
Click to hide internal directories.