Documentation ¶
Overview ¶
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func AppEngineTokenSource(ctx context.Context, scope ...string) internal.TokenSource
- func ComputeTokenSource(account string) internal.TokenSource
- func DefaultTokenSource(ctx context.Context, scope string) (internal.TokenSource, error)
- func FindJSONCredentials(ctx context.Context, settings *Settings) (*credentials.Credentials, error)
- func JWTTokenSource(ctx context.Context, settings *Settings) (internal.TokenSource, error)
- func NewGrpcConn(ctx context.Context, settings *Settings, host string, port string) (*grpc.ClientConn, error)
- func NewHTTPClient(ctx context.Context, settings *Settings) (*http.Client, error)
- func OAuthJSONTokenSource(ctx context.Context, settings *Settings) (internal.TokenSource, error)
- type Settings
- type Token
Constants ¶
This section is empty.
Variables ¶
var DefaultScope = "https://www.googleapis.com/auth/cloud-platform"
var MethodAPIKey = "apikey"
var MethodJWT = "jwt"
var MethodOAuth = "oauth"
Functions ¶
func AppEngineTokenSource ¶
func AppEngineTokenSource(ctx context.Context, scope ...string) internal.TokenSource
AppEngineTokenSource returns a token source that fetches tokens issued to the current App Engine application's service account. If you are implementing a 3-legged OAuth 2.0 flow on App Engine that involves user accounts, see oauth2.Config instead.
The provided context must have come from appengine.NewContext.
func ComputeTokenSource ¶
func ComputeTokenSource(account string) internal.TokenSource
ComputeTokenSource returns a token source that fetches access tokens from Google Compute Engine (GCE)'s metadata server. It's only valid to use this token source if your program is running on a GCE instance. If no account is specified, "default" is used. Further information about retrieving access tokens from the GCE metadata server can be found at https://cloud.google.com/compute/docs/authentication.
func DefaultTokenSource ¶
DefaultTokenSource returns the token source for "Application Default Credentials". It is a shortcut for FindDefaultCredentials(ctx, scope).TokenSource.
func FindJSONCredentials ¶
func FindJSONCredentials(ctx context.Context, settings *Settings) (*credentials.Credentials, error)
func JWTTokenSource ¶
func NewGrpcConn ¶
func NewHTTPClient ¶
Returns the HTTP client using the given settings.
func OAuthJSONTokenSource ¶
Types ¶
type Settings ¶
type Settings struct { // The JSON credentials content downloaded from Google Cloud Console. CredentialsJSON string // If specified, use OAuth. Otherwise, JWT. Scope string // The audience field for JWT auth Audience string // The Google API key APIKey string // This is only used for domain-wide delegation. // UNIMPLEMENTED User string // The identifier to the user that the per-user quota will be charged // against. If not specified, the identifier to the authenticated account // is used. If there is no authenticated account too, the caller's network // IP address will be used. // UNIMPLEMENTED QuotaUser string // A user specified project that is responsible for the request quota and // billing charges. QuotaProject string // End-user OAuth Flow handler that redirects the user to the given URL // and returns the token. OAuthFlowHandler func(url string) (token string, err error) // The state string used for 3LO session verification. // UNIMPLEMENTED State string }
An extensible structure that holds the credentials for Google API authentication.