validator

package
v0.0.0-...-080e534 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APPLE_BASE_URL = "https://appleid.apple.com"
	JWKS_APPLE_URI = "/auth/keys"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppleKey

type AppleKey struct {
	Kty string `json:"kty"`
	Kid string `json:"kid"`
	Use string `json:"use"`
	Alg string `json:"alg"`
	N   string `json:"n"`
	E   string `json:"e"`
}

key object fetched from APPLE_KEYS_URL

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *Client

func (*Client) GetApplePublicKeyObject

func (c *Client) GetApplePublicKeyObject(kid string, alg string) *rsa.PublicKey

locally cache and get apple rsa.PublicKey object

func (*Client) VerifyIdToken

func (c *Client) VerifyIdToken(clientId, idToken string) (*IdTokenResponse, error)

type IdTokenResponse

type IdTokenResponse struct {
	Aud            string `json:"aud"`
	C_hash         string `json:"c_hash"           mapstructure:"c_hash"`
	Email          string `json:"email"`
	EmailVerified  bool   `json:"email_verified"   mapstructure:"email_verified"`
	IsPrivateEmail bool   `json:"is_private_email" mapstructure:"is_private_email"`
	AuthTime       int64  `json:"auth_time"        mapstructure:"auth_time"`
	Exp            int64  `json:"exp"`
	Iat            int64  `json:"iat"`
	Iss            string `json:"iss"`
	Nonce          string `json:"nonce"`
	NonceSupported bool   `json:"nonce_supported"  mapstructure:"nonce_supported"`
	Sub            string `json:"sub"`
}

Jump to

Keyboard shortcuts

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