account

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ProviderUnknown accountProvider = 0 // Unknown Provider
	ProviderM365    accountProvider = 1 // M365
)
View Source
const (
	// M365 config
	AccountProviderTypeKey = "account_provider"
	AzureTenantIDKey       = "azure_tenantid"
	AzureClientID          = "azure_client_id"
	AzureSecret            = "azure_secret"
)
View Source
const (
	AzureTenantID = "AZURE_TENANT_ID"
)

config exported name consts

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Provider accountProvider
	Config   map[string]string
}

Account defines an account provider, along with any credentials and identifiers required to set up or communicate with that provider.

func NewAccount

func NewAccount(p accountProvider, cfgs ...providerIDer) (Account, error)

NewAccount aggregates all the supplied configurations into a single configuration

func (Account) GetAccountConfigHash

func (a Account) GetAccountConfigHash() (string, error)

func (Account) GoString

func (a Account) GoString() string

GoString implements fmt.GoStringer, covering %#v specifically: fmt checks GoStringer separately from Stringer for that verb.

func (Account) ID

func (a Account) ID() string

ID returns the primary tenant ID held by its configuration. Ex: if the account uses an M365 provider, the M365 tenant ID is returned. If the account contains no ID info, returns an empty string.

func (Account) M365Config

func (a Account) M365Config() (M365Config, error)

M365Config retrieves the M365Config details from the Account config.

func (Account) MarshalJSON

func (a Account) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. encoding/json does not consult Stringer (or any other fmt interface) at all, so without this, json.Marshal(a) - or marshalling any struct that embeds or contains an Account field, directly or several layers down - emits Config, and so the Microsoft 365 application's client secret, in plain text. This matters beyond logging: a payload persisted to a job queue or any other store that round-trips through JSON carries this struct's fields as-is, with no special handling for this one.

func (Account) String

func (a Account) String() string

String implements fmt.Stringer, covering the %v, %+v, %s and %q verbs. Account.Config is a plain map[string]string that holds the Microsoft 365 application's client secret (among other, non-secret fields). Without this, every one of those verbs printed Config in full. Callers needing the real values should use M365Config directly - this type's own default formatting never includes them.

type M365Config

type M365Config struct {
	credentials.M365 // requires: ClientID, ClientSecret
	AzureTenantID    string
}

func (M365Config) StringConfig

func (c M365Config) StringConfig() (map[string]string, error)

StringConfig transforms a m365Config struct into a plain map[string]string. All values in the original struct which serialize into the map are expected to be strings.

Jump to

Keyboard shortcuts

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