ssoauth

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package ssoauth wraps the AWS SSO OIDC device-authorization flow and the SSO portal APIs needed to list accounts and roles. The access token is cached under ~/.aws/sso/cache using the same filename hashing scheme the official aws CLI uses, so the cache is shared with `aws sso login`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID    string
	Name  string
	Email string
}

Account is a flattened view of the SSO portal account listing.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is bound to a single SSO start URL + region.

func New

func New(ctx context.Context, startURL, region, sessionName string) (*Client, error)

New constructs a Client. It loads AWS SDK config with the given region so SSO API endpoints resolve correctly even on a host with no profile.

func (*Client) ListAccountRoles

func (c *Client) ListAccountRoles(ctx context.Context, token, accountID string) ([]string, error)

ListAccountRoles returns the role names assigned to the SSO user for the given account, sorted alphabetically.

func (*Client) ListAccounts

func (c *Client) ListAccounts(ctx context.Context, token string) ([]Account, error)

ListAccounts walks the SSO portal pages and returns all accounts the access token is allowed to see, sorted by name.

func (*Client) Login

func (c *Client) Login(ctx context.Context) (string, error)

Login returns a valid access token, reusing the cache when possible. When the cache is expired or missing it runs the device-authorization flow, opens the verification URL in the browser, and polls for the token.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址