Documentation ¶
Index ¶
- type AuthCfg
- type JsonWebKeys
- type Jwks
- type OpenidConfiguration
- func (oic *OpenidConfiguration) DeviceAuthEndpointURL() string
- func (oic *OpenidConfiguration) Get() ([]byte, error)
- func (oic *OpenidConfiguration) IssuerURL() string
- func (oic *OpenidConfiguration) JwksURI() string
- func (oic *OpenidConfiguration) TokenEndpointURL() string
- func (oic *OpenidConfiguration) UserinfoURL() string
- type Userinfo
- type UserinfoMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthCfg ¶
type AuthCfg struct { OpenidWellKnownConfigUrl string `json:"OpenidWellKnownConfigUrl"` OpenIdClientId string `json:"ClientId"` OpenIdScope string `json:"Scope"` OpenIdAudience string `json:"Audience"` OpenIdSecretSubdir string `json:"SecretSubdir"` OpenIdSecretFile string `json:"SecretFile"` }
AuthCfg drives the oauth flows, and determines where the token is stored
func NewAuthCfg ¶
func NewAuthCfg(openidConfigurationUrl, clientId, scope, audience, secretSubdir, secretFile string) AuthCfg
build AuthCfg object from parameters
func NewAuthCfgFromFile ¶
build AuthCfg object from a json formatted file
func (*AuthCfg) OpenidConfigurationUrl ¶
func (*AuthCfg) SecretFile ¶
func (*AuthCfg) SecretSubdir ¶
type JsonWebKeys ¶
type JsonWebKeys struct { Kty string `json:"kty"` Kid string `json:"kid"` Use string `json:"use"` Alg string `json:"alg"` N string `json:"n"` E string `json:"e"` X5c []string `json:"x5c"` }
Individual jsonwebkeys in the result from a call to the OpenId jwks_uri endpoint
type Jwks ¶
type Jwks struct {
Keys []JsonWebKeys `json:"keys"`
}
map of jsonwebkeys to contain the result from a call to the OpenId jwks_uri endpoint
func (*Jwks) ExtractPublicKeyMatchingToken ¶
func (jwks *Jwks) ExtractPublicKeyMatchingToken(logger logger.LoggerInterface, token *jwt.Token) (pubkey *rsa.PublicKey, err error)
Extract the public key from the array of jsonwebkeys provided at oic.JwksURI() using matching the token key id
type OpenidConfiguration ¶
type OpenidConfiguration struct { Issuer string `json:"issuer"` Authorization_endpoint string `json:"authorization_endpoint"` Token_endpoint string `json:"token_endpoint"` Userinfo_endpoint string `json:"userinfo_endpoint"` Mfa_challenge_endpoint string `json:"mfa_challenge_endpoint"` Jwks_uri string `json:"jwks_uri"` Registration_endpoint string `json:"registration_endpoint"` Revocation_endpoint string `json:"revocation_endpoint"` Scopes_supported []string `json:"scopes_supported"` Response_types_supported []string `json:"response_types_supported"` Code_challenge_methods_supported []string `json:"code_challenge_methods_supported"` Response_modes_supported []string `json:"response_modes_supported"` Subject_types_supported []string `json:"subject_types_supported"` Id_token_signing_alg_values_supported []string `json:"id_token_signing_alg_values_supported"` Token_endpoint_auth_methods_supported []string `json:"token_endpoint_auth_methods_supported"` Claims_supported []string `json:"claims_supported"` Request_url_parameter_supported bool `json:"request_url_parameter_supported"` }
OpenidConfiguration is a struct to contain the result received from an OpenId well_known endpoint
func NewOpenIdConfigurationFromURL ¶
func NewOpenIdConfigurationFromURL(ctx context.Context, logger logger.LoggerInterface, wellKnownOpenidConfigurationUrl string) (oic *OpenidConfiguration, err error)
build a new OpenidConfiguration by calling out to the openId well known endpoint
func (*OpenidConfiguration) DeviceAuthEndpointURL ¶
func (oic *OpenidConfiguration) DeviceAuthEndpointURL() string
return object value for...
func (*OpenidConfiguration) Get ¶
func (oic *OpenidConfiguration) Get() ([]byte, error)
return object value for...
func (*OpenidConfiguration) IssuerURL ¶
func (oic *OpenidConfiguration) IssuerURL() string
return object value for...
func (*OpenidConfiguration) JwksURI ¶
func (oic *OpenidConfiguration) JwksURI() string
return object value for...
func (*OpenidConfiguration) TokenEndpointURL ¶
func (oic *OpenidConfiguration) TokenEndpointURL() string
return object value for...
func (*OpenidConfiguration) UserinfoURL ¶
func (oic *OpenidConfiguration) UserinfoURL() string
type Userinfo ¶
type Userinfo struct { Sub string `json:"sub"` Name string `json:"name"` Given_name string `json:"given_name"` Family_name string `json:"family_name"` Middle_name string `json:"middle_name"` Nickname string `json:"nickname"` Preferred_username string `json:"preferred_username"` Profile string `json:"profile"` Picture string `json:"picture"` Website string `json:"website"` Email string `json:"email"` Email_verified bool `json:"email_verified"` Gender string `json:"gender"` Birthdate string `json:"birthdate"` Zoneinfo string `json:"zoneinfo"` Locale string `json:"locale"` Phone_number string `json:"phone_number"` Phone_number_verified bool `json:"phone_number_verified"` Address map[string]string `json:"address"` Updated_at string `json:"updated_at"` }
userinfo is a struct to receive the result from the url provided by the OpenId well_known endpoint
func NewUserInfo ¶
func NewUserInfo(ctx context.Context, logger logger.LoggerInterface, userinfoURL, tokenType, accessToken string) (ui *Userinfo, err error)
makes an authenticated call out to an openId userinfo url and returns a userinfo object
type UserinfoMap ¶
type UserinfoMap struct {
// contains filtered or unexported fields
}
cache of email address to an openId userinfo record
func New ¶
func New() *UserinfoMap
Build a new map of userinfo to reduce calls to the openId endpoint
func (*UserinfoMap) Get ¶
func (um *UserinfoMap) Get(ctx context.Context, logger logger.LoggerInterface, userinfoURL, tokenType, accessToken string) (u *Userinfo, err error)
Check our map for the userinfoURL contents; if cache miss call out to get the details