Documentation
¶
Overview ¶
Package authgateway encapsulates outbound calls to authenticate a User
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoogleOauth2TokenConverter ¶ added in v0.39.0
type GoogleOauth2TokenConverter struct{}
GoogleOauth2TokenConverter is used to convert an oauth2.Token to a User through Google's API
func (GoogleOauth2TokenConverter) Convert ¶ added in v0.39.0
func (c GoogleOauth2TokenConverter) Convert(ctx context.Context, realm string, token oauth2.Token) (ProviderUserInfo, error)
Convert calls the Google Userinfo API with the access token and converts the Userinfo struct to a User struct
type ProviderUserInfo ¶ added in v0.40.0
type ProviderUserInfo struct {
// Username: For most providers, the username is the email.
Username string
// Email: The user's email address.
Email string `json:"email,omitempty"`
// FamilyName: The user's last name.
FamilyName string `json:"family_name,omitempty"`
// Gender: The user's gender.
Gender string `json:"gender,omitempty"`
// GivenName: The user's first name.
GivenName string `json:"given_name,omitempty"`
// Hd: The hosted domain e.g. example.com if the user is Google apps
// user.
Hd string `json:"hd,omitempty"`
// Id: The obfuscated ID of the user.
Id string `json:"id,omitempty"`
// Link: URL of the profile page.
Link string `json:"link,omitempty"`
// Locale: The user's preferred locale.
Locale string `json:"locale,omitempty"`
// Name: The user's full name.
Name string `json:"name,omitempty"`
// Picture: URL of the user's picture image.
Picture string `json:"picture,omitempty"`
}
ProviderUserInfo contains common fields from the various Oauth2 providers. Currently only using Google, so looks exactly like Google's. TODO - maybe make this look like an OpenID Connect struct
Click to show internal directories.
Click to hide internal directories.