Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrDeviceLoginStartFail = errors.New("failed to start device code flow login")
Functions ¶
This section is empty.
Types ¶
type OAuthManager ¶
type OAuthManager struct {
// contains filtered or unexported fields
}
OAuthManager is the manager responsible for handling authentication flows with the oauth tenant.
func New ¶
func New(options OAuthManagerOptions) *OAuthManager
func NewManager ¶
func NewManager(store credentials.Store) *OAuthManager
func (*OAuthManager) LoginDevice ¶
func (m *OAuthManager) LoginDevice(ctx context.Context, w io.Writer) (*types.AuthConfig, error)
LoginDevice launches the device authentication flow with the tenant, printing instructions to the provided writer and attempting to open the browser for the user to authenticate. After the user completes the browser login, LoginDevice uses the retrieved tokens to create a Hub PAT which is returned to the caller. The retrieved tokens are stored in the credentials store (under a separate key), and the refresh token is concatenated with the client ID.
func (*OAuthManager) Logout ¶
func (m *OAuthManager) Logout(ctx context.Context) error
Logout fetches the refresh token from the store and revokes it with the configured oauth tenant. The stored access and refresh tokens are then erased from the store. If the refresh token is not found in the store, an error is not returned.