gjwt

package
v0.0.0-...-031e6a7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdateGoogleKeys

func UpdateGoogleKeys()

TODO: fetch keys/certs from: https://www.googleapis.com/oauth2/v3/certs according to docs they are updated regulary (see https://developers.google.com/identity/gsi/web/guides/verify-google-id-token)

func ValidateToken

func ValidateToken(t *jwt.Token, clientId string) error

aud is the client_id received from Google when registered the app based on https://developers.google.com/identity/gsi/web/guides/verify-google-id-token

Types

type GoogleOIDClaims

type GoogleOIDClaims struct {
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
	Name          string `json:"name"`
	Picture       string `json:"picture"`
	GivenName     string `json:"given_name"`
	FamilyName    string `json:"family_name"`
	Locale        string `json:"locale"`
	jwt.RegisteredClaims
}

func ParseToken

func ParseToken(tokenStr string) (*jwt.Token, *GoogleOIDClaims, error)

func ValidateGoogleJWT

func ValidateGoogleJWT(c *gin.Context, clientId string) (*GoogleOIDClaims, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL