authn

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	// Authenticate is used to validate the user's identity.
	// If the user is authenticated, the function returns user information.
	// Otherwise, empty information with the corresponding error.
	Authenticate(c *gin.Context) (*UserInfo, error)
}

type IDTokenClaims

type IDTokenClaims struct {
	Iss               string   `json:"iss"`
	Sub               string   `json:"sub"`
	Aud               string   `json:"aud"`
	Exp               int      `json:"exp"`
	Iat               int      `json:"iat"`
	AtHash            string   `json:"at_hash"`
	CHash             string   `json:"c_hash"`
	Email             string   `json:"email"`
	EmailVerified     bool     `json:"email_verified"`
	Groups            []string `json:"groups"`
	Name              string   `json:"name"`
	PreferredUsername string   `json:"preferred_username"`
}

IDTokenClaims is the claims extract from the IDToken.

type UserInfo

type UserInfo struct {
	IDTokenClaims *IDTokenClaims `json:"id_token_claims,omitempty"`
	IDToken       string         `json:"id_token"`
	RefreshToken  string         `json:"refresh_token"`
}

UserInfo includes information about the user identity It holds the IDTokenClaims, IDToken and RefreshToken for the user

func NewUserInfo

func NewUserInfo(itc *IDTokenClaims, idToken string, refreshToken string) UserInfo

Jump to

Keyboard shortcuts

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