auth

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const PrincipalTypeApplication = "application"

PrincipalTypeApplication is the whoami principal_type for service/application tokens.

Variables

This section is empty.

Functions

func CreateAPIToken

func CreateAPIToken(ac *client.AlpaconClient, tokenRequest APITokenRequest) (string, error)

func DeleteAPIToken

func DeleteAPIToken(ac *client.AlpaconClient, tokenID string) error

func DuplicateAPIToken added in v1.4.4

func DuplicateAPIToken(ac *client.AlpaconClient, tokenID, name string) (string, error)

func GetAPITokenIDByName

func GetAPITokenIDByName(ac *client.AlpaconClient, tokenName string) (string, error)

func LoginAndSaveCredentials

func LoginAndSaveCredentials(loginReq *LoginRequest, token string, insecure bool) error

func Logout added in v0.4.4

func Logout(ac *client.AlpaconClient) error

func ResolveTokenID added in v1.4.4

func ResolveTokenID(ac *client.AlpaconClient, nameOrID string) (string, error)

Types

type APITokenAttributes

type APITokenAttributes struct {
	ID        string `json:"id" table:"ID"`
	Name      string `json:"name"`
	Enabled   bool   `json:"enabled"`
	UpdatedAt string `json:"updated_at" table:"Updated At"`
	ExpiresAt string `json:"expires_at" table:"Expires At"`
	Scopes    string `json:"scopes" table:"Scopes"`
}

func GetAPITokenList

func GetAPITokenList(ac *client.AlpaconClient) ([]APITokenAttributes, error)

type APITokenDuplicateRequest added in v1.4.4

type APITokenDuplicateRequest struct {
	Name string `json:"name,omitempty"`
}

type APITokenRequest

type APITokenRequest struct {
	Name      string   `json:"name"`
	ExpiresAt *string  `json:"expires_at"`
	Scopes    []string `json:"scopes,omitempty"`
}

type APITokenResponse

type APITokenResponse struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Enabled   bool      `json:"enabled"`
	Key       string    `json:"key"`
	UpdatedAt time.Time `json:"updated_at"`
	ExpiresAt time.Time `json:"expires_at"`
	Scopes    []string  `json:"scopes"`
}

type LoginRequest

type LoginRequest struct {
	WorkspaceURL  string `json:"workspace_url"`
	Username      string `json:"username"`
	Password      string `json:"password"`
	WorkspaceName string `json:"-"`
	BaseDomain    string `json:"-"`
}

type LoginResponse

type LoginResponse struct {
	Token     string `json:"token"`
	ExpiresAt string `json:"expires_at"`
}

type TokenScopeAttributes added in v1.4.4

type TokenScopeAttributes struct {
	Name    string `json:"name" table:"Resource"`
	Actions string `json:"actions" table:"Actions"`
	ACL     string `json:"acl" table:"ACL"`
}

func GetTokenScopes added in v1.4.4

func GetTokenScopes(ac *client.AlpaconClient) ([]TokenScopeAttributes, error)

type TokenScopeResource added in v1.4.4

type TokenScopeResource struct {
	Name    string   `json:"name"`
	Actions []string `json:"actions"`
	ACL     []string `json:"acl"`
}

type TokenScopesResponse added in v1.4.4

type TokenScopesResponse struct {
	Resources []TokenScopeResource `json:"resources"`
	Wildcards []string             `json:"wildcards"`
}

type WhoamiApplication added in v1.8.1

type WhoamiApplication struct {
	Name        string `json:"name"`
	ServiceType string `json:"service_type"`
	Username    string `json:"username"` // service account name
}

type WhoamiAuth added in v1.8.1

type WhoamiAuth struct {
	Scopes []string `json:"scopes"`
}

type WhoamiResponse added in v1.8.1

type WhoamiResponse struct {
	PrincipalType string             `json:"principal_type"`
	Auth          WhoamiAuth         `json:"auth"`
	Application   *WhoamiApplication `json:"application,omitempty"`
}

WhoamiResponse is the GET /api/auth/whoami/ identity. Only the application branch is consumed; user principals fall through to iam.GetCurrentUser.

func GetWhoami added in v1.8.1

func GetWhoami(ac *client.AlpaconClient) (*WhoamiResponse, error)

GetWhoami fetches the caller's identity; a 404 means the endpoint is absent (old server).

Jump to

Keyboard shortcuts

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