auth

package
v0.0.436 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GithubJWTAudience = "nscloud.dev/inline-token"
)

Variables

View Source
var Workspace string

Functions

func DeleteStoredToken added in v0.0.430

func DeleteStoredToken() error

func EnsureTokenValidAt added in v0.0.192

func EnsureTokenValidAt(ctx context.Context, issue IssueShortTermFunc, target time.Time) error

func SetupFlags added in v0.0.197

func SetupFlags(flags *pflag.FlagSet)

func StoreMarshalledUser added in v0.0.136

func StoreMarshalledUser(ctx context.Context, userAuthData []byte) error

func StoreTenantToken added in v0.0.145

func StoreTenantToken(token string) error

func StoreToken added in v0.0.311

func StoreToken(token StoredToken) error

Types

type IssueCertFunc added in v0.0.395

type IssueCertFunc func(context.Context, string, string) (string, error)

type IssueShortTermFunc added in v0.0.424

type IssueShortTermFunc func(context.Context, *Token, time.Duration) (string, error)

type StoredToken added in v0.0.424

type StoredToken struct {
	TenantToken  string `json:"bearer_token,omitempty"`
	SessionToken string `json:"session_token,omitempty"`
}

func (*StoredToken) UnmarshalJSON added in v0.0.424

func (t *StoredToken) UnmarshalJSON(data []byte) error

TODO: remove when legacy token.json format is not used anymore.

type Token added in v0.0.145

type Token struct {
	ReIssue IssueShortTermFunc

	StoredToken
	// contains filtered or unexported fields
}

func FetchTokenFromSpec added in v0.0.198

func FetchTokenFromSpec(ctx context.Context, issue IssueShortTermFunc, spec string) (*Token, error)

func LoadTenantToken added in v0.0.145

func LoadTenantToken(ctx context.Context, issue IssueShortTermFunc) (*Token, error)

func LoadTokenFromPath added in v0.0.191

func LoadTokenFromPath(ctx context.Context, issue IssueShortTermFunc, path string, validAt time.Time) (*Token, error)

func (*Token) Claims added in v0.0.311

func (t *Token) Claims(ctx context.Context) (*auth.TokenClaims, error)

func (*Token) ExchangeForSessionClientCert added in v0.0.395

func (t *Token) ExchangeForSessionClientCert(ctx context.Context, publicKeyPem string, issueFromSession IssueCertFunc) (string, error)

func (*Token) IsSessionToken added in v0.0.314

func (t *Token) IsSessionToken() bool

func (*Token) IssueToken added in v0.0.311

func (t *Token) IssueToken(ctx context.Context, minDur time.Duration, skipCache bool) (string, error)

func (*Token) PreferredRegion added in v0.0.414

func (t *Token) PreferredRegion(ctx context.Context) (string, error)

type UserAuth added in v0.0.136

type UserAuth struct {
	Username       string `json:"username,omitempty"`
	Org            string `json:"org,omitempty"` // The organization this user is acting as. Only really relevant for robot accounts which authenticate against a repository.
	InternalOpaque []byte `json:"opaque,omitempty"`

	Clerk          *clerk.State `json:"clerk,omitempty"`
	IsGithubAction bool         `json:"is_github_action,omitempty"`
}

func LoadUser added in v0.0.136

func LoadUser() (*UserAuth, error)

Jump to

Keyboard shortcuts

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