sso

package
v0.0.0-...-f28940e Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const PUBLIC_KEY_ENDPOINT = "https://api.sso.cateiru.com/v1/oauth/jwt/key"
View Source
const SSO_ENDPOINT = "https://sso.cateiru.com/sso/login"
View Source
const TOKEN_ENDPOINT = "https://api.sso.cateiru.com/v1/oauth/token"

Variables

This section is empty.

Functions

func CreateURI

func CreateURI(clientId string, redirect string) string

Create Login URI

func GetPublicKey

func GetPublicKey() (string, error)

Get JWT Public key.

Types

type Claims

type Claims struct {
	Name                string `json:"name"`
	GivenName           string `json:"given_name"`
	FamilyName          string `json:"family_name"`
	MiddleName          string `json:"middle_name"`
	NickName            string `json:"nick_name"`
	PreferredUserName   string `json:"preferred_username"`
	Profile             string `json:"profile"`
	Picture             string `json:"picture"`
	Website             string `json:"website"`
	Email               string `json:"email"`
	EmailVerified       bool   `json:"email_verified"`
	Gender              string `json:"gender"`
	Birthdate           string `json:"birthdate"`
	Zoneinfo            string `json:"zoneinfo"`
	Locale              string `json:"locale"`
	PhoneNumber         string `json:"phone_number"`
	PhoneNumberVerified bool   `json:"phone_number_verified"`
	UpdatedAt           int64  `json:"updated_at"`

	ID    string `json:"id"`
	Role  string `json:"role"`
	Theme string `json:"theme"`

	Iat      int64 `json:"iat"`
	AuthTime int64 `json:"auth_time"`

	jwt.StandardClaims
}

func ValidateIDToken

func ValidateIDToken(idToken string) (*Claims, error)

type PublicKey

type PublicKey struct {
	Pkcs8 string `json:"pkcs8"`
}

type TokenResponse

type TokenResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int    `json:"expires_in"`
	IDToken      string `json:"id_token"`
}

func GetToken

func GetToken(code string, redirect string, tokenSecret string) (*TokenResponse, error)

func Refresh

func Refresh(refreshToken string, clientId string, clientSecret string, scope []string) (*TokenResponse, error)

Jump to

Keyboard shortcuts

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