Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



google/appengine/api/app_identity/AppIdentityService.php

Table of Contents
Copyright 2007 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.

\google\appengine\api\app_identity\AppIdentityService

Package: Default
The AppIdentityService allows you to sign arbitrary byte array using per app private key maintained by App Engine.

You can also retrieve a list of public certificates which can be used to verify the signature.

App Engine is responsible for maintaining per-application private key. App Engine will keep rotating private keys periodically. App Engine never releases these private keys externally.

Since private keys are rotated periodically, getPublicCertificates() could return a list of public certificates. It's the caller's responsibility to try these certificates one by one when doing signature verification.

Constants

> V Constant PACKAGE_NAME = 'app_identity_service'
> V Constant PARTITION_SEPARATOR = "~"
> V Constant DOMAIN_SEPARATOR = ":"
> V Constant MEMCACHE_KEY_PREFIX = '_ah_app_identity_'

Methods

method public getAccessToken (array $scopes) : array
static

Gets an OAuth2 access token for the application's service account from memcache or generates and caches one by calling getAccessTokenUncached($scopes)

Each application has an associated Google account. This function returns OAuth2 access token corresponding to the running app. Access tokens are safe to cache and reuse until they expire.

Parameters
Name Type Description
$scopes array

The scopes to acquire the access token for. Can be either a single string or an array of strings.

Returns
Type Description
array An array with the following key/value pairs. 'access_token' - The access token for the application. 'expiration_time' - The expiration time for the access token.
Throws
Exception Description
\InvalidArgumentException If $scopes is not a string or an array of strings.
\google\appengine\api\app_identity\AppIdentityException If there is an error using the AppIdentity service.
method public getApplicationId () : string
static

Get the application id of an app.

Returns
Type Description
string The application id of the app.
method public getDefaultVersionHostname () : string
static

Get the standard hostname of the default version of the app.

Returns
Type Description
string The standard hostname of the default version of the application, or FALSE if the call failed.
method public getPublicCertificates () : \google\appengine\api\app_identity\PublicCertificate[]
static

Get the list of public certifates for the application.

Returns
Type Description
\google\appengine\api\app_identity\PublicCertificate[] An array of the applications public certificates.
Throws
Exception Description
\google\appengine\api\app_identity\AppIdentityException If there is an error using the AppIdentity service.
method public getServiceAccountName () : string
static

Get the service account name for the application.

Returns
Type Description
string The service account name.
Throws
Exception Description
\google\appengine\api\app_identity\AppIdentityException If there is an error using the AppIdentity service.
method public signForApp (string $bytes_to_sign) : array
static

Signs arbitrary byte array using per app private key.

Parameters
Name Type Description
$bytes_to_sign string

The bytes to generate the signature for.

Returns
Type Description
array An array containing the elements 'key_name' - the name of the key used to sign the bytes 'signature' - the signature of the bytes.
Throws
Exception Description
\InvalidArgumentException If $bytes_to_sign is not a string.
\google\appengine\api\app_identity\AppIdentityException If there is an error using the AppIdentity service.
Documentation was generated by phpDocumentor 2.0.0a12 .