Documentation
¶
Index ¶
- Constants
- Variables
- func BoolPointerToString(v *bool) string
- func BoolToString(v bool) string
- func CheckOrganizationApprobation(cmd *cobra.Command, disclaimer string, args ...any) bool
- func CheckStackApprobation(cmd *cobra.Command, disclaimer string, args ...any) bool
- func ContainValue[V comparable](array []V, value V) bool
- func DeleteProfile(cmd *cobra.Command, name string) error
- func EnsureStackAccess(cmd *cobra.Command, relyingParty client.RelyingParty, dialog Dialog, ...) (*AccessToken, *StackAccess, error)
- func FetchStackToken(ctx context.Context, httpClient *http.Client, stackURI, token string) (*oauth2.Token, error)
- func GetAuthRelyingParty(ctx context.Context, httpClient *http.Client, membershipURI string) (client.RelyingParty, error)
- func GetBool(cmd *cobra.Command, flagName string) bool
- func GetCurrentProfileName(cmd *cobra.Command, config Config) string
- func GetCursor(cmd *cobra.Command) (string, error)
- func GetDateTime(cmd *cobra.Command, flagName string) (*time.Time, error)
- func GetFilePath(cmd *cobra.Command, filename string) string
- func GetHttpClient(cmd *cobra.Command) *http.Client
- func GetInt(cmd *cobra.Command, flagName string) int
- func GetPageSize(cmd *cobra.Command) (int32, error)
- func GetSelectedOrganizationID(cmd *cobra.Command) string
- func GetSelectedStackID(cmd *cobra.Command, profile Profile) (string, error)
- func GetString(cmd *cobra.Command, flagName string) string
- func GetStringSlice(cmd *cobra.Command, flagName string) []string
- func IsInvalidAuthentication(err error) bool
- func ListProfiles(cmd *cobra.Command, filters ...func(string) bool) ([]string, error)
- func LoadAndAuthenticateCurrentProfile(cmd *cobra.Command) (*Config, *Profile, string, client.RelyingParty, error)
- func LoadConfigDir(cmd *cobra.Command) string
- func LoadConfigFilePath(cmd *cobra.Command) string
- func Map[SRC any, DST any](srcs []SRC, mapper func(SRC) DST) []DST
- func MapMap[KEY comparable, VALUE any, DST any](srcs map[KEY]VALUE, mapper func(KEY, VALUE) DST) []DST
- func MembershipServerInfo(ctx context.Context, apiClient *membershipclient.SDK) (*components.ServerInfo, error)
- func MetadataAsShortString[V any](metadata map[string]V) string
- func NeedConfirm(cmd *cobra.Command) bool
- func NewAppDeployClient(cmd *cobra.Command, relyingParty client.RelyingParty, dialog Dialog, ...) (*deployserverclient.DeployServer, error)
- func NewAppDeployClientFromFlags(cmd *cobra.Command, relyingParty client.RelyingParty, dialog Dialog, ...) (string, *deployserverclient.DeployServer, error)
- func NewCommand(use string, opts ...CommandOption) *cobra.Command
- func NewHTTPTransport(cmd *cobra.Command) http.RoundTripper
- func NewLazyRelyingParty(ctx context.Context, httpClient *http.Client, membershipURI string) client.RelyingParty
- func NewMembershipClient(cmd *cobra.Command, relyingParty client.RelyingParty, dialog Dialog, ...) (*membershipclient.SDK, error)
- func NewMembershipClientForOrganization(cmd *cobra.Command, relyingParty client.RelyingParty, dialog Dialog, ...) (*membershipclient.SDK, error)
- func NewMembershipClientForOrganizationFromFlags(cmd *cobra.Command, relyingParty client.RelyingParty, dialog Dialog, ...) (string, *membershipclient.SDK, error)
- func NewMembershipCommand(use string, opts ...CommandOption) *cobra.Command
- func NewStackClient(cmd *cobra.Command, relyingParty client.RelyingParty, dialog Dialog, ...) (*formance.Formance, error)
- func NewStackClientFromFlags(cmd *cobra.Command, relyingParty client.RelyingParty, dialog Dialog, ...) (*formance.Formance, error)
- func NewStackCommand(use string, opts ...CommandOption) *cobra.Command
- func NewStackTokenSource(stackToken AccessToken, stackAccess *StackAccess, ...) oauth2.TokenSource
- func OpenURL(urlString string) error
- func OrganizationCompletion(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective)
- func ParseMetadata(array []string) (metadata.Metadata, error)
- func Prepend[V any](array []V, items ...V) []V
- func PrintMetadata(out io.Writer, metadata metadata.Metadata) error
- func Printfln(fmt string, args ...any)
- func Println(args ...any)
- func Ptr[T any](t T) *T
- func ReadFile(cmd *cobra.Command, where string) (string, error)
- func ReadJSONFile[V any](cmd *cobra.Command, filePath string) (*V, error)
- func RenameProfile(cmd *cobra.Command, oldName, newName string) error
- func RenderCursor(writer io.Writer, cursor Cursor) error
- func ResetProfile(cmd *cobra.Command, name string) error
- func ResolveOrganizationID(cmd *cobra.Command, profile Profile) (string, error)
- func ResolveStackID(cmd *cobra.Command, profile Profile) (string, string, error)
- func StackCompletion(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective)
- func StringPointerToString(v *string) string
- func StructToMap(obj interface{}) (newMap map[string]interface{}, err error)
- func UpsertConfigDir(cmd *cobra.Command) error
- func WithRender[T any](cmd *cobra.Command, args []string, c Controller[T], r Renderable) error
- func WriteAppToken(cmd *cobra.Command, profileName, appAlias string, token AccessToken) error
- func WriteCachedStackAPIToken(cmd *cobra.Command, profileName, organizationID, stackID string, ...) error
- func WriteConfig(cmd *cobra.Command, config Config) error
- func WriteJSONFile(filePath string, data any) error
- func WriteOrganizationToken(cmd *cobra.Command, profileName string, token AccessToken) error
- func WriteProfile(cmd *cobra.Command, name string, profile Profile) error
- func WriteStackToken(cmd *cobra.Command, profileName, stackID string, token AccessToken) error
- type AccessToken
- func EnsureAppAccess(cmd *cobra.Command, relyingParty client.RelyingParty, dialog Dialog, ...) (*AccessToken, error)
- func EnsureMembershipAccess(cmd *cobra.Command, relyingParty client.RelyingParty, dialog Dialog, ...) (*AccessToken, error)
- func EnsureOrganizationAccess(cmd *cobra.Command, relyingParty client.RelyingParty, dialog Dialog, ...) (*AccessToken, error)
- func ReadAppToken(cmd *cobra.Command, profileName, organizationID, appAlias string) (*AccessToken, error)
- func ReadOrganizationToken(cmd *cobra.Command, profileName, organizationID string) (*AccessToken, error)
- func ReadStackToken(cmd *cobra.Command, profileName, organizationID, stackID string) (*AccessToken, error)
- func Refresh(ctx context.Context, relyingParty client.RelyingParty, token AccessToken) (*AccessToken, error)
- type AccessTokenClaims
- type ApplicationAccess
- type AuthenticationOption
- func AuthenticateWithIDTokenHint(idToken string) AuthenticationOption
- func AuthenticateWithOrganizationID(organization string) AuthenticationOption
- func AuthenticateWithPrompt(prompt ...string) AuthenticationOption
- func AuthenticateWithResource(resource string) AuthenticationOption
- func AuthenticateWithScopes(scopes ...string) AuthenticationOption
- type CachedStackAPIToken
- type CommandOption
- type CommandOptionFn
- func WithAliases(aliases ...string) CommandOptionFn
- func WithArgs(p cobra.PositionalArgs) CommandOptionFn
- func WithBoolFlag(name string, defaultValue bool, help string) CommandOptionFn
- func WithChildCommands(cmds ...*cobra.Command) CommandOptionFn
- func WithConfirmFlag() CommandOptionFn
- func WithController[T any](c Controller[T]) CommandOptionFn
- func WithCursorFlag() CommandOptionFn
- func WithDeprecated(message string) CommandOptionFn
- func WithDeprecatedFlag(name, message string) CommandOptionFn
- func WithDescription(v string) CommandOptionFn
- func WithHidden() CommandOptionFn
- func WithHiddenFlag(name string) CommandOptionFn
- func WithIntFlag(name string, defaultValue int, help string) CommandOptionFn
- func WithPageSizeFlag() CommandOptionFn
- func WithPersistentBoolFlag(name string, defaultValue bool, help string) CommandOptionFn
- func WithPersistentBoolPFlag(name, short string, defaultValue bool, help string) CommandOptionFn
- func WithPersistentPreRunE(fn func(cmd *cobra.Command, args []string) error) CommandOptionFn
- func WithPersistentStringFlag(name, defaultValue, help string) CommandOptionFn
- func WithPersistentStringPFlag(name, short, defaultValue, help string) CommandOptionFn
- func WithPreRunE(fn func(cmd *cobra.Command, args []string) error) CommandOptionFn
- func WithRunE(fn func(cmd *cobra.Command, args []string) error) CommandOptionFn
- func WithShortDescription(v string) CommandOptionFn
- func WithSilenceError() CommandOptionFn
- func WithStringArrayFlag(name string, defaultValue []string, help string) CommandOptionFn
- func WithStringFlag(name, defaultValue, help string) CommandOptionFn
- func WithStringSliceFlag(name string, defaultValue []string, help string) CommandOptionFn
- func WithValidArgs(validArgs ...string) CommandOptionFn
- func WithValidArgsFunction(...) CommandOptionFn
- type Config
- type Controller
- type CurrentProfile
- type Cursor
- type Dialog
- type ErrForbidden
- type ErrInvalidAuthentication
- type ErrUnauthorized
- type ExportedData
- type IDToken
- type IDTokenClaims
- func (i IDTokenClaims) GetAccessTokenHash() string
- func (i IDTokenClaims) GetAuthTime() time.Time
- func (i IDTokenClaims) GetExpiration() time.Time
- func (i IDTokenClaims) GetIssuedAt() time.Time
- func (i IDTokenClaims) GetOrganizationAccess(id string) *OrganizationAccess
- func (i IDTokenClaims) HasApplicationsAccess(organizationID string, alias string) bool
- func (i IDTokenClaims) HasOrganizationAccess(id string) bool
- func (i IDTokenClaims) HasStackAccess(organizationID string, stackID string) bool
- type OrganizationAccess
- type OrganizationsClaim
- type Profile
- func (p *Profile) GetClaims() (AccessTokenClaims, error)
- func (p *Profile) GetDefaultOrganization() string
- func (p *Profile) GetDefaultStack() string
- func (p *Profile) GetMembershipURI() string
- func (p *Profile) GetRootToken() (*AccessToken, error)
- func (p *Profile) IsConnected() bool
- func (p *Profile) SetDefaultOrganization(o string)
- func (p *Profile) UpdateRootToken(tokens *Tokens)
- type Renderable
- type RoundTripperFn
- type StackAccess
- type TokenOption
- type TokenWithClaims
- type Tokens
- type UnexpectedStatusCodeError
- type UserClaims
Constants ¶
View Source
const ( DefaultMembershipURI = "https://app.formance.cloud/api" DefaultConsoleURL = "https://portal.formance.cloud" )
View Source
const ( MembershipURIFlag = "membership-uri" ConfigDir = "config-dir" ProfileFlag = "profile" OutputFlag = "output" DebugFlag = "debug" InsecureTlsFlag = "insecure-tls" HTTPCloseOnErrorFlag = "http-close-on-error" TelemetryFlag = "telemetry" StackFlag = "stack" OrganizationFlag = "organization" FrameworkURIFlag = "framework-uri" )
View Source
const AuthClient = "fctl"
Variables ¶
View Source
var ( OrganizationScopes = []string{ "organization:Read", "organization:Create", "organization:Update", "organization:Delete", "organization:ListUsers", "organization:ReadUser", "organization:CreateUser", "organization:UpdateUser", "organization:DeleteUser", "organization:ListPolicies", "organization:ReadPolicy", "organization:CreatePolicy", "organization:UpdatePolicy", "organization:DeletePolicy", "organization:ListInvitations", "organization:ReadInvitation", "organization:CreateInvitation", "organization:UpdateInvitation", "organization:AcceptInvitation", "organization:RejectInvitation", "organization:DeleteInvitation", "organization:ListRegions", "organization:ReadRegion", "organization:CreateRegion", "organization:UpdateRegion", "organization:DeleteRegion", "organization:ListStacks", "organization:ReadStack", "organization:CreateStack", "organization:UpdateStack", "organization:DeleteStack", "organization:EnableStack", "organization:DisableStack", "organization:RestoreStack", "organization:UpgradeStack", "organization:ListStackUsers", "organization:ReadStackUser", "organization:CreateStackUser", "organization:UpdateStackUser", "organization:DeleteStackUser", "organization:ListStackModules", "organization:EnableStackModule", "organization:DisableStackModule", "organization:ListClients", "organization:ReadClient", "organization:CreateClient", "organization:UpdateClient", "organization:DeleteClient", "organization:ReadAuthProvider", "organization:UpdateAuthProvider", "organization:DeleteAuthProvider", "organization:ReadLogs", "organization:ListFeatures", "organization:ReadFeature", } StackScopes = []string{ "stack:Read", "stack:Write", } )
View Source
var ( ErrOrganizationNotSpecified = errors.New("organization not specified") ErrMultipleOrganizationsFound = errors.New("found more than one organization and no organization specified") ErrNoStackSpecified = errors.New("no stack specified: use --stack=<stack-id>") )
View Source
var ( StyleGreen = pterm.NewStyle(pterm.FgLightGreen) StyleRed = pterm.NewStyle(pterm.FgLightRed) StyleCyan = pterm.NewStyle(pterm.FgLightCyan) BasicText = pterm.DefaultBasicText BasicTextRed = pterm.DefaultBasicText.WithStyle(StyleRed) BasicTextCyan = pterm.DefaultBasicText.WithStyle(StyleCyan) Section = pterm.SectionPrinter{ Style: &pterm.ThemeDefault.SectionStyle, Level: 1, TopPadding: 0, BottomPadding: 0, IndentCharacter: "#", } )
View Source
var ErrMissingApproval = errors.New("Missing approval.")
View Source
var (
ErrOpeningBrowser = errors.New("opening browser")
)
Functions ¶
func BoolPointerToString ¶
func BoolToString ¶
func CheckStackApprobation ¶
func ContainValue ¶
func ContainValue[V comparable](array []V, value V) bool
func EnsureStackAccess ¶
func EnsureStackAccess( cmd *cobra.Command, relyingParty client.RelyingParty, dialog Dialog, profileName string, profile Profile, organizationID, stackID string, ) (*AccessToken, *StackAccess, error)
func FetchStackToken ¶
func GetAuthRelyingParty ¶
func GetSelectedStackID ¶
func IsInvalidAuthentication ¶
func ListProfiles ¶
func LoadConfigDir ¶
func LoadConfigFilePath ¶
func MapMap ¶
func MapMap[KEY comparable, VALUE any, DST any](srcs map[KEY]VALUE, mapper func(KEY, VALUE) DST) []DST
func MembershipServerInfo ¶
func MembershipServerInfo(ctx context.Context, apiClient *membershipclient.SDK) (*components.ServerInfo, error)
func MetadataAsShortString ¶
func NeedConfirm ¶
func NewAppDeployClient ¶
func NewAppDeployClient( cmd *cobra.Command, relyingParty client.RelyingParty, dialog Dialog, profileName string, profile Profile, organizationID string, ) (*deployserverclient.DeployServer, error)
func NewAppDeployClientFromFlags ¶
func NewAppDeployClientFromFlags( cmd *cobra.Command, relyingParty client.RelyingParty, dialog Dialog, profileName string, profile Profile, ) (string, *deployserverclient.DeployServer, error)
todo: deploy use membership token, we have to rely on membership applications
func NewCommand ¶
func NewCommand(use string, opts ...CommandOption) *cobra.Command
func NewHTTPTransport ¶
func NewHTTPTransport(cmd *cobra.Command) http.RoundTripper
func NewLazyRelyingParty ¶
func NewMembershipClient ¶
func NewMembershipClient( cmd *cobra.Command, relyingParty client.RelyingParty, dialog Dialog, profileName string, profile Profile, ) (*membershipclient.SDK, error)
func NewMembershipCommand ¶
func NewMembershipCommand(use string, opts ...CommandOption) *cobra.Command
func NewStackClient ¶
func NewStackClientFromFlags ¶
func NewStackCommand ¶
func NewStackCommand(use string, opts ...CommandOption) *cobra.Command
func NewStackTokenSource ¶
func NewStackTokenSource( stackToken AccessToken, stackAccess *StackAccess, relyingParty client.RelyingParty, onRefresh func(newToken AccessToken) error, cmd *cobra.Command, profileName string, organizationID string, stackID string, ) oauth2.TokenSource
func OrganizationCompletion ¶
func ResolveOrganizationID ¶
func ResolveStackID ¶
func StackCompletion ¶
func StringPointerToString ¶
func StructToMap ¶
func UpsertConfigDir ¶
func WithRender ¶
func WithRender[T any](cmd *cobra.Command, args []string, c Controller[T], r Renderable) error
func WriteAppToken ¶
func WriteAppToken(cmd *cobra.Command, profileName, appAlias string, token AccessToken) error
func WriteCachedStackAPIToken ¶
func WriteCachedStackAPIToken(cmd *cobra.Command, profileName, organizationID, stackID string, token CachedStackAPIToken) error
func WriteJSONFile ¶
func WriteOrganizationToken ¶
func WriteOrganizationToken(cmd *cobra.Command, profileName string, token AccessToken) error
func WriteStackToken ¶
func WriteStackToken(cmd *cobra.Command, profileName, stackID string, token AccessToken) error
Types ¶
type AccessToken ¶
type AccessToken struct {
TokenWithClaims[AccessTokenClaims]
Refresh string `json:"refreshToken"`
}
func EnsureAppAccess ¶
func EnsureMembershipAccess ¶
func EnsureMembershipAccess( cmd *cobra.Command, relyingParty client.RelyingParty, dialog Dialog, profileName string, profile Profile, ) (*AccessToken, error)
func EnsureOrganizationAccess ¶
func EnsureOrganizationAccess( cmd *cobra.Command, relyingParty client.RelyingParty, dialog Dialog, profileName string, profile Profile, organizationID string, ) (*AccessToken, error)
func ReadAppToken ¶
func ReadAppToken(cmd *cobra.Command, profileName, organizationID, appAlias string) (*AccessToken, error)
func ReadOrganizationToken ¶
func ReadOrganizationToken(cmd *cobra.Command, profileName, organizationID string) (*AccessToken, error)
func ReadStackToken ¶
func ReadStackToken(cmd *cobra.Command, profileName, organizationID, stackID string) (*AccessToken, error)
func Refresh ¶
func Refresh(ctx context.Context, relyingParty client.RelyingParty, token AccessToken) (*AccessToken, error)
func (AccessToken) Expired ¶
func (t AccessToken) Expired() bool
func (AccessToken) ToOAuth2 ¶
func (t AccessToken) ToOAuth2() *oauth2.Token
type AccessTokenClaims ¶
type AccessTokenClaims struct {
oidc.TokenClaims
Scopes oidc.SpaceDelimitedArray `json:"scope,omitempty"`
OrganizationID string `json:"organization_id"`
}
type ApplicationAccess ¶
type AuthenticationOption ¶
func AuthenticateWithIDTokenHint ¶
func AuthenticateWithIDTokenHint(idToken string) AuthenticationOption
func AuthenticateWithOrganizationID ¶
func AuthenticateWithOrganizationID(organization string) AuthenticationOption
func AuthenticateWithPrompt ¶
func AuthenticateWithPrompt(prompt ...string) AuthenticationOption
func AuthenticateWithResource ¶
func AuthenticateWithResource(resource string) AuthenticationOption
func AuthenticateWithScopes ¶
func AuthenticateWithScopes(scopes ...string) AuthenticationOption
type CachedStackAPIToken ¶
type CachedStackAPIToken struct {
AccessToken string `json:"accessToken"`
TokenType string `json:"tokenType"`
Expiry time.Time `json:"expiry"`
}
func ReadCachedStackAPIToken ¶
func ReadCachedStackAPIToken(cmd *cobra.Command, profileName, organizationID, stackID string) (*CachedStackAPIToken, error)
type CommandOption ¶
type CommandOption interface {
// contains filtered or unexported methods
}
type CommandOptionFn ¶
func WithAliases ¶
func WithAliases(aliases ...string) CommandOptionFn
func WithArgs ¶
func WithArgs(p cobra.PositionalArgs) CommandOptionFn
func WithBoolFlag ¶
func WithBoolFlag(name string, defaultValue bool, help string) CommandOptionFn
func WithChildCommands ¶
func WithChildCommands(cmds ...*cobra.Command) CommandOptionFn
func WithConfirmFlag ¶
func WithConfirmFlag() CommandOptionFn
func WithController ¶
func WithController[T any](c Controller[T]) CommandOptionFn
func WithCursorFlag ¶
func WithCursorFlag() CommandOptionFn
func WithDeprecated ¶
func WithDeprecated(message string) CommandOptionFn
func WithDeprecatedFlag ¶
func WithDeprecatedFlag(name, message string) CommandOptionFn
func WithDescription ¶
func WithDescription(v string) CommandOptionFn
func WithHidden ¶
func WithHidden() CommandOptionFn
func WithHiddenFlag ¶
func WithHiddenFlag(name string) CommandOptionFn
func WithIntFlag ¶
func WithIntFlag(name string, defaultValue int, help string) CommandOptionFn
func WithPageSizeFlag ¶
func WithPageSizeFlag() CommandOptionFn
func WithPersistentBoolFlag ¶
func WithPersistentBoolFlag(name string, defaultValue bool, help string) CommandOptionFn
func WithPersistentBoolPFlag ¶
func WithPersistentBoolPFlag(name, short string, defaultValue bool, help string) CommandOptionFn
func WithPersistentPreRunE ¶
func WithPersistentPreRunE(fn func(cmd *cobra.Command, args []string) error) CommandOptionFn
func WithPersistentStringFlag ¶
func WithPersistentStringFlag(name, defaultValue, help string) CommandOptionFn
func WithPersistentStringPFlag ¶
func WithPersistentStringPFlag(name, short, defaultValue, help string) CommandOptionFn
func WithPreRunE ¶
func WithPreRunE(fn func(cmd *cobra.Command, args []string) error) CommandOptionFn
func WithShortDescription ¶
func WithShortDescription(v string) CommandOptionFn
func WithSilenceError ¶
func WithSilenceError() CommandOptionFn
func WithStringArrayFlag ¶
func WithStringArrayFlag(name string, defaultValue []string, help string) CommandOptionFn
func WithStringFlag ¶
func WithStringFlag(name, defaultValue, help string) CommandOptionFn
func WithStringSliceFlag ¶
func WithStringSliceFlag(name string, defaultValue []string, help string) CommandOptionFn
func WithValidArgs ¶
func WithValidArgs(validArgs ...string) CommandOptionFn
func WithValidArgsFunction ¶
func WithValidArgsFunction(fn func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)) CommandOptionFn
type Config ¶
type Controller ¶
type CurrentProfile ¶
type CurrentProfile Profile
type Dialog ¶
func NewPTermDialog ¶
func NewPTermDialog() Dialog
type ErrForbidden ¶
type ErrForbidden struct {
}
func (*ErrForbidden) Error ¶
func (e *ErrForbidden) Error() string
func (ErrForbidden) Is ¶
func (e ErrForbidden) Is(target error) bool
type ErrInvalidAuthentication ¶
type ErrInvalidAuthentication struct {
// contains filtered or unexported fields
}
func (ErrInvalidAuthentication) Error ¶
func (e ErrInvalidAuthentication) Error() string
func (ErrInvalidAuthentication) Is ¶
func (e ErrInvalidAuthentication) Is(err error) bool
func (ErrInvalidAuthentication) Unwrap ¶
func (e ErrInvalidAuthentication) Unwrap() error
type ErrUnauthorized ¶
type ErrUnauthorized struct {
}
func (*ErrUnauthorized) Error ¶
func (e *ErrUnauthorized) Error() string
func (ErrUnauthorized) Is ¶
func (e ErrUnauthorized) Is(target error) bool
type ExportedData ¶
type ExportedData struct {
Data interface{} `json:"data"`
}
type IDToken ¶
type IDToken = TokenWithClaims[IDTokenClaims]
type IDTokenClaims ¶
type IDTokenClaims struct {
oidc.TokenClaims
NotBefore oidc.Time `json:"nbf,omitempty"`
AccessTokenHash string `json:"at_hash,omitempty"`
CodeHash string `json:"c_hash,omitempty"`
SessionID string `json:"sid,omitempty"`
oidc.UserInfoProfile
oidc.UserInfoEmail
oidc.UserInfoPhone
Address *oidc.UserInfoAddress `json:"address,omitempty"`
Organizations []OrganizationAccess `json:"org"`
}
func (IDTokenClaims) GetAccessTokenHash ¶
func (i IDTokenClaims) GetAccessTokenHash() string
func (IDTokenClaims) GetAuthTime ¶
func (i IDTokenClaims) GetAuthTime() time.Time
func (IDTokenClaims) GetExpiration ¶
func (i IDTokenClaims) GetExpiration() time.Time
func (IDTokenClaims) GetIssuedAt ¶
func (i IDTokenClaims) GetIssuedAt() time.Time
func (IDTokenClaims) GetOrganizationAccess ¶
func (i IDTokenClaims) GetOrganizationAccess(id string) *OrganizationAccess
func (IDTokenClaims) HasApplicationsAccess ¶
func (i IDTokenClaims) HasApplicationsAccess(organizationID string, alias string) bool
func (IDTokenClaims) HasOrganizationAccess ¶
func (i IDTokenClaims) HasOrganizationAccess(id string) bool
func (IDTokenClaims) HasStackAccess ¶
func (i IDTokenClaims) HasStackAccess(organizationID string, stackID string) bool
type OrganizationAccess ¶
type OrganizationAccess struct {
ID string `json:"id"`
DisplayName string `json:"displayName"`
Stacks []StackAccess `json:"stacks"`
Applications []ApplicationAccess `json:"applications"`
}
func (*OrganizationAccess) GetStackAccess ¶
func (o *OrganizationAccess) GetStackAccess(stackID string) *StackAccess
type OrganizationsClaim ¶
type OrganizationsClaim []OrganizationAccess
type Profile ¶
type Profile struct {
MembershipURI string `json:"membershipURI"`
RootTokens *Tokens `json:"rootTokens"`
DefaultOrganization string `json:"defaultOrganization"`
DefaultStack string `json:"defaultStack"`
}
func LoadCurrentProfile ¶
func (*Profile) GetClaims ¶
func (p *Profile) GetClaims() (AccessTokenClaims, error)
func (*Profile) GetDefaultOrganization ¶
func (*Profile) GetDefaultStack ¶
func (*Profile) GetMembershipURI ¶
func (*Profile) GetRootToken ¶
func (p *Profile) GetRootToken() (*AccessToken, error)
func (*Profile) IsConnected ¶
func (*Profile) SetDefaultOrganization ¶
func (*Profile) UpdateRootToken ¶
type RoundTripperFn ¶
type StackAccess ¶
type TokenOption ¶
func RequestResource ¶
func RequestResource(resource string) TokenOption
type TokenWithClaims ¶
type Tokens ¶
type Tokens struct {
Access AccessToken `json:"accessToken"`
ID IDToken `json:"idToken"`
}
func Authenticate ¶
func Authenticate( ctx context.Context, relyingParty client.RelyingParty, dialog Dialog, authenticationOptions []AuthenticationOption, tokenOptions []TokenOption, ) (*Tokens, error)
type UnexpectedStatusCodeError ¶
type UnexpectedStatusCodeError struct {
StatusCode int
}
func (*UnexpectedStatusCodeError) Error ¶
func (e *UnexpectedStatusCodeError) Error() string
func (UnexpectedStatusCodeError) Is ¶
func (e UnexpectedStatusCodeError) Is(target error) bool
type UserClaims ¶
type UserClaims struct {
Email string `json:"email"`
Subject string `json:"sub"`
Org OrganizationsClaim `json:"org"`
}
func UserInfo ¶
func UserInfo(cmd *cobra.Command, relyingParty client.RelyingParty, token AccessToken) (*UserClaims, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.