Documentation
¶
Index ¶
Constants ¶
const ( ProviderUnknown accountProvider = 0 // Unknown Provider ProviderM365 accountProvider = 1 // M365 )
const ( // M365 config AccountProviderTypeKey = "account_provider" AzureTenantIDKey = "azure_tenantid" AzureClientID = "azure_client_id" AzureSecret = "azure_secret" )
const (
AzureTenantID = "AZURE_TENANT_ID"
)
config exported name consts
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
Account defines an account provider, along with any credentials and identifiers required to set up or communicate with that provider.
func NewAccount ¶
NewAccount aggregates all the supplied configurations into a single configuration
func (Account) GetAccountConfigHash ¶
func (Account) GoString ¶
GoString implements fmt.GoStringer, covering %#v specifically: fmt checks GoStringer separately from Stringer for that verb.
func (Account) ID ¶
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 ¶
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 ¶
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.