Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) GetToken(ctx context.Context, audience string) (string, error)
- func (c *Client) GetUser(ctx context.Context, sub string) (UserInfo, error)
- func (c *Client) SendVerificationEmail(ctx context.Context, sub string) error
- func (c *Client) UpdateUser(ctx context.Context, sub string, info UserInfo, metadata UserMetadata) (UserInfo, error)
- func (c *Client) ValidateToken() gin.HandlerFunc
- type Config
- type UserInfo
- type UserMetadata
Constants ¶
View Source
const ( CtxAuthenticated = "authenticated" CtxAudience = "audience" CtxUserID = "user_id" CtxPersonID = "person_id" CtxIsBCCMember = "bcc_member" )
Ctx keys
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the auth client
func (*Client) GetToken ¶
GetToken returns a token to be used towards other apis with the client credentials
func (*Client) SendVerificationEmail ¶
SendVerificationEmail sends a verification email to the specified user
func (*Client) UpdateUser ¶
func (c *Client) UpdateUser(ctx context.Context, sub string, info UserInfo, metadata UserMetadata) (UserInfo, error)
UpdateUser updates user
func (*Client) ValidateToken ¶
func (c *Client) ValidateToken() gin.HandlerFunc
ValidateToken is a middleware that will check the validity of our JWT.
type Config ¶
type Config struct { ClientID string ClientSecret string Domain string ManagementAudience string Audiences []string }
Config is the configuration for the client
type UserInfo ¶
type UserInfo struct { UserId string `json:"user_id"` Email string `json:"email"` EmailVerified bool `json:"email_verified"` Username string `json:"username"` PhoneNumber string `json:"phone_number"` PhoneVerified bool `json:"phone_verified"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` Identities []struct { Connection string `json:"connection"` UserId string `json:"user_id"` Provider string `json:"provider"` IsSocial bool `json:"isSocial"` } `json:"identities"` AppMetadata struct { } `json:"app_metadata"` UserMetadata map[string]string `json:"user_metadata"` Picture string `json:"picture"` Name string `json:"name"` Nickname string `json:"nickname"` Multifactor []string `json:"multifactor"` LastIp string `json:"last_ip"` LastLogin string `json:"last_login"` LoginsCount int `json:"logins_count"` Blocked bool `json:"blocked"` GivenName string `json:"given_name"` FamilyName string `json:"family_name"` }
UserInfo contains information about a user
func (UserInfo) CompletedRegistration ¶
CompletedRegistration returns true if the user has completed registration
type UserMetadata ¶
type UserMetadata struct { BirthYear string `json:"birth_year"` MediaSubscriber string `json:"media_subscriber"` }
UserMetadata is the user metadata
Click to show internal directories.
Click to hide internal directories.