Documentation
¶
Overview ¶
Package credentialstype defines the CredType used for specifying the type of JSON credentials.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckCredentialType ¶
CheckCredentialType checks if the provided JSON bytes match the expected credential type and, if present, one of the allowed credential types. An error is returned if the JSON is invalid, the type field is missing, or the types do not match expected and (if present) allowed.
Types ¶
type CredType ¶
type CredType string
CredType specifies the type of JSON credentials.
const ( // Unknown represents an unknown JSON file type. Unknown CredType = "" // ServiceAccount represents a service account file type. ServiceAccount CredType = "service_account" // AuthorizedUser represents an authorized user credentials file type. AuthorizedUser CredType = "authorized_user" // ImpersonatedServiceAccount represents an impersonated service account file type. // // IMPORTANT: // This credential type does not validate the credential configuration. A security // risk occurs when a credential configuration configured with malicious urls // is used. // You should validate credential configurations provided by untrusted sources. // See [Security requirements when using credential configurations from an external // source] https://cloud.google.com/docs/authentication/external/externally-sourced-credentials // for more details. ImpersonatedServiceAccount CredType = "impersonated_service_account" // ExternalAccount represents an external account file type. // // IMPORTANT: // This credential type does not validate the credential configuration. A security // risk occurs when a credential configuration configured with malicious urls // is used. // You should validate credential configurations provided by untrusted sources. // See [Security requirements when using credential configurations from an external // source] https://cloud.google.com/docs/authentication/external/externally-sourced-credentials // for more details. ExternalAccount CredType = "external_account" // GDCHServiceAccount represents a GDCH service account file type. GDCHServiceAccount CredType = "gdc_service_account" // ExternalAccountAuthorizedUser represents an external account authorized user file type. ExternalAccountAuthorizedUser CredType = "external_account_authorized_user" )
func GetCredType ¶
GetCredType returns the credentials type or the Unknown type, or an error for empty data or failure to unmarshal JSON.
Click to show internal directories.
Click to hide internal directories.