Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildLoginURL ¶
func BuildLoginURL(domain, clientID, callbackURL, state, connectionName, audience, prompt string, scopes []string) (string, error)
BuildLoginURL constructs a URL + query string that can be used to initiate a user-facing login-flow from the CLI.
func WaitForBrowserCallback ¶
WaitForBrowserCallback lauches a new HTTP server listening on the provided address and waits for a request. Once received, the code is extracted from the query string (if any), and returned it to the caller.
Types ¶
type TokenResponse ¶
type TokenResponse struct { AccessToken string `json:"access_token,omitempty"` RefreshToken string `json:"refresh_token,omitempty"` IDToken string `json:"id_token,omitempty"` TokenType string `json:"token_type,omitempty"` ExpiresIn int64 `json:"expires_in,omitempty"` }
TokenResponse stores token information as retrieved from the /oauth/token endpoint when exchanging a code.
func ExchangeCodeForToken ¶
func ExchangeCodeForToken(httpClient *http.Client, baseDomain, clientID, clientSecret, code, cbURL string) (*TokenResponse, error)
ExchangeCodeForToken fetches an access token for the given application using the provided code.
type UserInfo ¶
type UserInfo struct { Sub *string `json:"sub,omitempty"` Name *string `json:"name,omitempty"` GivenName *string `json:"given_name,omitempty"` MiddleName *string `json:"middle_name,omitempty"` FamilyName *string `json:"family_name,omitempty"` Nickname *string `json:"nickname,omitempty"` PreferredUsername *string `json:"preferred_username,omitempty"` Profile *string `json:"profile,omitempty"` Picture *string `json:"picture,omitempty"` Website *string `json:"website,omitempty"` PhoneNumber *string `json:"phone_number,omitempty"` PhoneVerified *bool `json:"phone_verified,omitempty"` Email *string `json:"email,omitempty"` EmailVerified *bool `json:"email_verified,omitempty"` Gender *string `json:"gender,omitempty"` BirthDate *string `json:"birthdate,omitempty"` ZoneInfo *string `json:"zoneinfo,omitempty"` Locale *string `json:"locale,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` }
UserInfo contains profile information for a given OIDC user.
func FetchUserInfo ¶
FetchUserInfo fetches and parses user information with the provided access token.
func (*UserInfo) UnmarshalJSON ¶ added in v1.1.1
UnmarshalJSON is a custom deserializer for the UserInfo type. A custom solution is necessary due to possible inconsistencies in value types.