package internal
import "cloud.google.com/go/auth/internal"
Index ¶
- Constants
- func DefaultClient() *http.Client
- func DoRequest(client *http.Client, req *http.Request) (*http.Response, []byte, error)
- func FormatIAMServiceAccountResource(name string) string
- func GetProjectID(b []byte, override string) string
- func GetQuotaProject(b []byte, override string) string
- func ParseKey(key []byte) (crypto.Signer, error)
- func ReadAll(r io.Reader) ([]byte, error)
- type ComputeUniverseDomainProvider
- type StaticProperty
Constants ¶
const ( // TokenTypeBearer is the auth header prefix for bearer tokens. TokenTypeBearer = "Bearer" // QuotaProjectEnvVar is the environment variable for setting the quota // project. QuotaProjectEnvVar = "GOOGLE_CLOUD_QUOTA_PROJECT" // UniverseDomainEnvVar is the environment variable for setting the default // service domain for a given Cloud universe. UniverseDomainEnvVar = "GOOGLE_CLOUD_UNIVERSE_DOMAIN" // DefaultUniverseDomain is the default value for universe domain. // Universe domain is the default service domain for a given Cloud universe. DefaultUniverseDomain = "googleapis.com" )
Functions ¶
func DefaultClient ¶
DefaultClient returns an http.Client with some defaults set. If the current http.DefaultTransport is a [clonableTransport], as is the case for an *http.Transport, the clone will be used. Otherwise the http.DefaultTransport is used directly.
func DoRequest ¶
DoRequest executes the provided req with the client. It reads the response body, closes it, and returns it.
func FormatIAMServiceAccountResource ¶
FormatIAMServiceAccountResource sets a service account name in an IAM resource name.
func GetProjectID ¶
GetProjectID retrieves project with precedence being: override, environment variable, creds json file.
func GetQuotaProject ¶
GetQuotaProject retrieves quota project with precedence being: override, environment variable, creds json file.
func ParseKey ¶
ParseKey converts the binary contents of a private key file to an crypto.Signer. It detects whether the private key is in a PEM container or not. If so, it extracts the the private key from PEM container before conversion. It only supports PEM containers with no passphrase.
func ReadAll ¶
ReadAll consumes the whole reader and safely reads the content of its body with some overflow protection.
Types ¶
type ComputeUniverseDomainProvider ¶
type ComputeUniverseDomainProvider struct {
MetadataClient *metadata.Client
// contains filtered or unexported fields
}
ComputeUniverseDomainProvider fetches the credentials universe domain from the google cloud metadata service.
func (*ComputeUniverseDomainProvider) GetProperty ¶
func (c *ComputeUniverseDomainProvider) GetProperty(ctx context.Context) (string, error)
GetProperty fetches the credentials universe domain from the google cloud metadata service.
type StaticProperty ¶
type StaticProperty string
StaticProperty always returns that value of the underlying string.
func StaticCredentialsProperty ¶
func StaticCredentialsProperty(s string) StaticProperty
StaticCredentialsProperty is a helper for creating static credentials properties.
func (StaticProperty) GetProperty ¶
func (p StaticProperty) GetProperty(context.Context) (string, error)
GetProperty loads the properly value provided the given context.
Source Files ¶
internal.go
Directories ¶
| Path | Synopsis |
|---|---|
| internal/compute | |
| internal/credsfile | Package credsfile is meant to hide implementation details from the pubic surface of the detect package. |
| internal/jwt | |
| internal/testutil | |
| internal/testutil/testdns | Package testdns is a light DNS client used for testings to avoid pulling in dependencies. |
| internal/testutil/testgcs | Package testgcs is a light GCS client used for testings to avoid pulling in dependencies. |
| internal/transport | Package transport provided internal helpers for the two transport packages (grpctransport and httptransport). |
| internal/transport/cert | |
| internal/transport/cert/cmd | test_signer.go is a net/rpc server that listens on stdin/stdout, exposing mock methods for testing enterprise certificate proxy flow. |
- Version
- v0.16.3
- Published
- Jul 17, 2025
- Platform
- darwin/amd64
- Imports
- 13 packages
- Last checked
- 44 seconds ago –
Tools for package owners.