pat

package
v1.0.54 Latest Latest
Warning

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

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

Documentation

Overview

Package pat implements the "dws pat" command group for PAT (Personal Action Token) authorization management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EffectiveOpenBrowser added in v1.0.18

func EffectiveOpenBrowser(configDir string) bool

func RegisterCommands

func RegisterCommands(root *cobra.Command, c edition.ToolCaller)

RegisterCommands adds the pat command tree to rootCmd.

func RunLoginRecommendAuthorization added in v1.0.42

func RunLoginRecommendAuthorization(ctx context.Context, c edition.ToolCaller, output io.Writer) error

RunLoginRecommendAuthorization plans the server-owned recommended scope set after a successful dws auth login, then starts a batch Device Code Flow for the server-selected grantable scopes. The actual browser open, polling, and retry are handled by the shared PAT runner once PAT_BATCH_AUTH_PENDING is classified as a PAT auth check.

func RunLoginRecommendAuthorizationWithOptions added in v1.0.42

func RunLoginRecommendAuthorizationWithOptions(ctx context.Context, c edition.ToolCaller, output io.Writer, opts LoginRecommendOptions) error

Types

type BrowserPolicy added in v1.0.18

type BrowserPolicy struct {
	Default *browserPolicyValue           `json:"default,omitempty"`
	Agents  map[string]browserPolicyValue `json:"agents,omitempty"`
}

func LoadBrowserPolicy added in v1.0.18

func LoadBrowserPolicy(configDir string) (*BrowserPolicy, error)

type BrowserPolicySelection added in v1.0.18

type BrowserPolicySelection struct {
	Scope       string `json:"scope"`
	AgentCode   string `json:"agentCode,omitempty"`
	OpenBrowser bool   `json:"openBrowser"`
	Source      string `json:"source"`
}

func ResolveBrowserPolicy added in v1.0.18

func ResolveBrowserPolicy(configDir, explicitAgentCode string) (BrowserPolicySelection, error)

func SetBrowserPolicy added in v1.0.18

func SetBrowserPolicy(configDir, explicitAgentCode string, enabled bool) (BrowserPolicySelection, error)

type LoginRecommendOptions added in v1.0.42

type LoginRecommendOptions struct {
	// ProductCodes limits the recommend plan to service-owned product domains.
	ProductCodes []string
	// Confirmed grants the server-selected recommend scopes directly. When
	// false, recommend authorization starts the batch confirmation page.
	Confirmed bool
	// ScopeMode controls whether the plan uses the safe recommended set or
	// all scopes under the selected product domains. Empty means recommended.
	ScopeMode LoginRecommendScopeMode
	// ProductSelector lets interactive callers present the service-owned domain
	// list before the final plan. It receives products extracted from the
	// initial recommend plan and must return the product codes to grant.
	ProductSelector func([]LoginRecommendProduct) ([]string, error)
	// InitialPlan lets callers preflight the default recommend plan before any
	// interactive selector and then reuse the same dry-run result.
	InitialPlan *LoginRecommendPlan
}

type LoginRecommendPlan added in v1.0.42

type LoginRecommendPlan struct {
	Result     *edition.ToolResult
	Scopes     []string
	Products   []LoginRecommendProduct
	AllGranted bool
}

func PlanLoginRecommendAuthorization added in v1.0.42

func PlanLoginRecommendAuthorization(ctx context.Context, c edition.ToolCaller) (*LoginRecommendPlan, error)

type LoginRecommendProduct added in v1.0.42

type LoginRecommendProduct struct {
	ProductCode        string
	ProductName        string
	Summary            string
	ScopeCount         int
	SelectedScopeCount int
}

type LoginRecommendScopeMode added in v1.0.42

type LoginRecommendScopeMode string
const (
	LoginRecommendScopeRecommended LoginRecommendScopeMode = "recommend"
	LoginRecommendScopeAll         LoginRecommendScopeMode = "all"
)

Jump to

Keyboard shortcuts

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