Documentation
¶
Index ¶
- func ClearDiscoveryCache()
- func GetDeviceAuthorizationEndpoint(idpDomain string) (string, error)
- func GetRevocationEndpoint(idpDomain string) (string, error)
- func GetTokenEndpoint(idpDomain string) (string, error)
- func RefreshAccessToken(s *store.Store, idpClientID string) (string, error)
- func RequestClientCredentialsAuthorization(s *store.Store, cfg ClientCredentialsConfig) error
- func RequestDeviceAuthorization(s *store.Store, cfg DeviceAuthConfig) error
- func RequestIdentityFileAuthorization(s *store.Store, identityFile string) error
- func RequestIdentityJSONAuthorization(s *store.Store, jsonContent string) error
- func RevokeRefreshToken(s *store.Store, idpClientID string) error
- func StoreTokens(s *store.Store, tr *TokenResponse) error
- func StoreUPDBCredentials(s *store.Store, controllerHost, username, password string) error
- type ClientCredentialsConfig
- type DeviceAuthConfig
- type DeviceCodeResult
- type OIDCDiscoveryDocument
- type TokenResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearDiscoveryCache ¶
func ClearDiscoveryCache()
ClearDiscoveryCache empties the OIDC discovery cache.
func GetDeviceAuthorizationEndpoint ¶
GetDeviceAuthorizationEndpoint returns the device auth endpoint from discovery.
func GetRevocationEndpoint ¶
GetRevocationEndpoint returns the revocation endpoint, or "" if not supported.
func GetTokenEndpoint ¶
GetTokenEndpoint returns the token endpoint from OIDC discovery.
func RefreshAccessToken ¶
RefreshAccessToken uses a stored refresh token to obtain a new access token.
func RequestClientCredentialsAuthorization ¶
func RequestClientCredentialsAuthorization(s *store.Store, cfg ClientCredentialsConfig) error
RequestClientCredentialsAuthorization performs the client credentials flow.
func RequestDeviceAuthorization ¶
func RequestDeviceAuthorization(s *store.Store, cfg DeviceAuthConfig) error
RequestDeviceAuthorization runs the full device authorization flow: discover endpoints, request device code, open browser, poll for token.
func RequestIdentityFileAuthorization ¶
RequestIdentityFileAuthorization reads a Ziti identity JSON file, validates it, and stores the certificate material in the credential store.
func RequestIdentityJSONAuthorization ¶
RequestIdentityJSONAuthorization takes raw identity JSON content (not a file path), validates it, and stores the certificate material in the credential store.
func RevokeRefreshToken ¶
RevokeRefreshToken revokes the stored refresh token via the IdP's revocation endpoint.
func StoreTokens ¶
func StoreTokens(s *store.Store, tr *TokenResponse) error
StoreTokens saves token data from a token response into the credential store.
Types ¶
type ClientCredentialsConfig ¶
type ClientCredentialsConfig struct {
ZitiControllerHost string
IDPDomain string
IDPClientID string
IDPClientSecret string
Audience string
Scopes []string
}
ClientCredentialsConfig holds parameters for client credentials flow.
type DeviceAuthConfig ¶
DeviceAuthConfig holds parameters for the device authorization flow.
type DeviceCodeResult ¶
type DeviceCodeResult struct {
DeviceCode string
UserCode string
VerificationURI string
VerificationURIComplete string
TokenEndpoint string
ClientID string
Interval int
ExpiresIn int
}
DeviceCodeResult holds the result of requesting a device code (non-blocking step 1).
func RequestDeviceCode ¶
func RequestDeviceCode(cfg DeviceAuthConfig) (*DeviceCodeResult, error)
RequestDeviceCode performs step 1 of the device auth flow: requests a device code without blocking. Returns the result for the caller to present to the user.
type OIDCDiscoveryDocument ¶
type OIDCDiscoveryDocument struct {
Issuer string `json:"issuer"`
AuthorizationEndpoint string `json:"authorization_endpoint,omitempty"`
TokenEndpoint string `json:"token_endpoint"`
UserinfoEndpoint string `json:"userinfo_endpoint,omitempty"`
JwksURI string `json:"jwks_uri,omitempty"`
RegistrationEndpoint string `json:"registration_endpoint,omitempty"`
ScopesSupported []string `json:"scopes_supported,omitempty"`
ResponseTypesSupported []string `json:"response_types_supported,omitempty"`
GrantTypesSupported []string `json:"grant_types_supported,omitempty"`
SubjectTypesSupported []string `json:"subject_types_supported,omitempty"`
IDTokenSigningAlgValuesSupported []string `json:"id_token_signing_alg_values_supported,omitempty"`
TokenEndpointAuthMethods []string `json:"token_endpoint_auth_methods_supported,omitempty"`
RevocationEndpoint string `json:"revocation_endpoint,omitempty"`
IntrospectionEndpoint string `json:"introspection_endpoint,omitempty"`
DeviceAuthorizationEndpoint string `json:"device_authorization_endpoint,omitempty"`
}
OIDCDiscoveryDocument represents the OpenID Connect discovery response.
func FetchOIDCDiscoveryDocument ¶
func FetchOIDCDiscoveryDocument(idpDomain string) (*OIDCDiscoveryDocument, error)
FetchOIDCDiscoveryDocument fetches and caches the OIDC discovery document.
type TokenResponse ¶
type TokenResponse struct {
AccessToken string
RefreshToken string
ExpiresIn int64
Error string
ErrorDescription string
}
TokenResponse is the exported version of tokenResponse for use by meta-tools.
func PollDeviceTokenOnce ¶
func PollDeviceTokenOnce(tokenEndpoint, deviceCode, clientID string) (*TokenResponse, error)
PollDeviceTokenOnce polls the token endpoint once (non-blocking). Returns the token response. Check .Error for "authorization_pending".