Documentation ¶
Index ¶
- Constants
- type Authenticator
- type AuthorizationResponse
- type CallbackResponse
- type CallbackService
- type Challenge
- type DeviceAuthenticator
- func (d *DeviceAuthenticator) GetAuthorization(ctx context.Context, openURLFunc func(URL string), states ...string) (interface{}, error)
- func (d *DeviceAuthenticator) GetToken(ctx context.Context, authorization interface{}) (*TokenResponse, error)
- func (d *DeviceAuthenticator) GetUserInfo(ctx context.Context, token string) (*UserInfoResponse, error)
- func (d *DeviceAuthenticator) Logout(ctx context.Context, token string, openURLFunc func(URL string)) error
- func (d *DeviceAuthenticator) RefreshToken(ctx context.Context, refreshToken string) (*TokenResponse, error)
- type DeviceCodeResponse
- type DeviceVerification
- type ErrorResponse
- type HTTPServer
- type OIDCWellKnownEndpoints
- type PKCEAuthenticator
- func (p *PKCEAuthenticator) GetAuthorization(ctx context.Context, openURLFunc func(URL string), states ...string) (interface{}, error)
- func (p *PKCEAuthenticator) GetToken(ctx context.Context, authorization interface{}) (*TokenResponse, error)
- func (p *PKCEAuthenticator) GetUserInfo(ctx context.Context, token string) (*UserInfoResponse, error)
- func (p *PKCEAuthenticator) Logout(ctx context.Context, token string, openURLFunc func(URL string)) error
- func (p *PKCEAuthenticator) RefreshToken(ctx context.Context, refreshToken string) (*TokenResponse, error)
- type RefreshTokenResponse
- type TokenResponse
- type UserInfoResponse
Constants ¶
View Source
const ( PKCE = "pkce" Device = "device" )
View Source
const ( ListenerAddress = "127.0.0.1" DIR = "./internal/cli/cmd/auth/authorize/callback_html/" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator interface { GetAuthorization(ctx context.Context, openURLFunc func(URL string), states ...string) (interface{}, error) GetToken(ctx context.Context, authorization interface{}) (*TokenResponse, error) GetUserInfo(ctx context.Context, token string) (*UserInfoResponse, error) Logout(ctx context.Context, token string, openURLFunc func(URL string)) error RefreshToken(ctx context.Context, refreshToken string) (*TokenResponse, error) }
func NewAuthenticator ¶
type AuthorizationResponse ¶
type CallbackResponse ¶
CallbackResponse holds the code gotten from the authorization callback. Error will hold an error struct if an error occurred.
type CallbackService ¶
type CallbackService struct {
// contains filtered or unexported fields
}
CallbackService is used to handle the callback received in the PKCE flow
type DeviceAuthenticator ¶
type DeviceAuthenticator struct { AuthURL *url.URL AuthAudience string Clock clock.Clock ClientID string // contains filtered or unexported fields }
DeviceAuthenticator performs the authentication flow for logging in.
func (*DeviceAuthenticator) GetAuthorization ¶
func (d *DeviceAuthenticator) GetAuthorization(ctx context.Context, openURLFunc func(URL string), states ...string) (interface{}, error)
GetAuthorization performs the device verification API calls.
func (*DeviceAuthenticator) GetToken ¶
func (d *DeviceAuthenticator) GetToken(ctx context.Context, authorization interface{}) (*TokenResponse, error)
func (*DeviceAuthenticator) GetUserInfo ¶
func (d *DeviceAuthenticator) GetUserInfo(ctx context.Context, token string) (*UserInfoResponse, error)
func (*DeviceAuthenticator) RefreshToken ¶
func (d *DeviceAuthenticator) RefreshToken(ctx context.Context, refreshToken string) (*TokenResponse, error)
RefreshToken The device authenticator needs the clientSecret when refreshing the token, and the kbcli client does not hold it, so this method does not need to be implemented.
type DeviceCodeResponse ¶
type DeviceVerification ¶
type DeviceVerification struct { // DeviceCode is the unique code for the device. When the user goes to the VerificationURL in their browser-based device, this code will be bound to their session. DeviceCode string // UserCode contains the code that should be input at the VerificationURL to authorize the device. UserCode string // VerificationURL contains the URL the user should visit to authorize the device. VerificationURL string // VerificationCompleteURL contains the complete URL the user should visit to authorize the device. This allows your app to embed the user_code in the URL, if you so choose. VerificationCompleteURL string // CheckInterval indicates the interval (in seconds) at which the app should poll the token URL to request a token. Interval time.Duration // ExpiresAt indicates the lifetime (in seconds) of the device_code and user_code. ExpiresAt time.Time }
type ErrorResponse ¶
type ErrorResponse struct { ErrorCode string `json:"error"` Description string `json:"error_description"` }
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
type HTTPServer ¶
type HTTPServer interface {
// contains filtered or unexported methods
}
type OIDCWellKnownEndpoints ¶
type PKCEAuthenticator ¶
type PKCEAuthenticator struct { Clock clock.Clock ClientID string AuthURL string AuthAudience string Challenge Challenge WellKnownEndpoints *OIDCWellKnownEndpoints // contains filtered or unexported fields }
func (*PKCEAuthenticator) GetAuthorization ¶
func (*PKCEAuthenticator) GetToken ¶
func (p *PKCEAuthenticator) GetToken(ctx context.Context, authorization interface{}) (*TokenResponse, error)
func (*PKCEAuthenticator) GetUserInfo ¶
func (p *PKCEAuthenticator) GetUserInfo(ctx context.Context, token string) (*UserInfoResponse, error)
func (*PKCEAuthenticator) RefreshToken ¶
func (p *PKCEAuthenticator) RefreshToken(ctx context.Context, refreshToken string) (*TokenResponse, error)
type RefreshTokenResponse ¶
type TokenResponse ¶
Click to show internal directories.
Click to hide internal directories.