Documentation
¶
Overview ¶
Package auth handles the AWS SSO OIDC device authorization flow.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeviceAuthInfo ¶
DeviceAuthInfo holds information displayed to the user during authorization.
type OIDCClient ¶
type OIDCClient interface {
RegisterClient(ctx context.Context, params *ssooidc.RegisterClientInput, optFns ...func(*ssooidc.Options)) (*ssooidc.RegisterClientOutput, error)
StartDeviceAuthorization(ctx context.Context, params *ssooidc.StartDeviceAuthorizationInput, optFns ...func(*ssooidc.Options)) (*ssooidc.StartDeviceAuthorizationOutput, error)
CreateToken(ctx context.Context, params *ssooidc.CreateTokenInput, optFns ...func(*ssooidc.Options)) (*ssooidc.CreateTokenOutput, error)
}
OIDCClient defines the interface for SSO OIDC operations (for testability).
func NewOIDCClient ¶
func NewOIDCClient(ctx context.Context, region string) (OIDCClient, error)
NewOIDCClient creates a real SSO OIDC client for the given region.
func NewOIDCClientFromConfig ¶
func NewOIDCClientFromConfig(cfg aws.Config) OIDCClient
NewOIDCClientFromConfig creates a real SSO OIDC client from an existing AWS config. Use this to share a single LoadDefaultConfig call across multiple clients.
type StatusCallback ¶
type StatusCallback func(status string)
StatusCallback is called during the auth flow to report status to the UI.
type TokenResult ¶
TokenResult holds the access token obtained from SSO OIDC.
func Authenticate ¶
func Authenticate( ctx context.Context, client OIDCClient, startURL string, onDeviceAuth func(DeviceAuthInfo), onStatus StatusCallback, ) (*TokenResult, error)
Authenticate performs the full SSO OIDC device authorization flow. It returns the access token needed to call GetRoleCredentials.
The onDeviceAuth callback is called with the device auth info so the caller can display the verification URL and user code to the user. The onStatus callback is called with status messages during polling.