App Engine PHP SDK  v1 rev.445
The PHP runtime is available as an experimental Preview feature.
Static Public Member Functions | Public Attributes | List of all members
google\appengine\api\app_identity\AppIdentityService Class Reference

Static Public Member Functions

static signForApp ($bytes_to_sign)
 
static getServiceAccountName ()
 
static getPublicCertificates ()
 
static getAccessToken ($scopes)
 
static getApplicationId ()
 
static getDefaultVersionHostname ()
 

Public Attributes

const PACKAGE_NAME = 'app_identity_service'
 
const PARTITION_SEPARATOR = "~"
 
const DOMAIN_SEPARATOR = ":"
 
const MEMCACHE_KEY_PREFIX = '_ah_app_identity_'
 

Detailed Description

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.

Member Function Documentation

static google\appengine\api\app_identity\AppIdentityService::getAccessToken (   $scopes)
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
array$scopesThe scopes to acquire the access token for. Can be either a single string or an array of strings.
Exceptions
InvalidArgumentException If $scopes is not a string or an array of strings.
AppIdentityExceptionIf there is an error using the AppIdentity service.
Returns
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.
static google\appengine\api\app_identity\AppIdentityService::getApplicationId ( )
static

Get the application id of an app.

Returns
string The application id of the app.
static google\appengine\api\app_identity\AppIdentityService::getDefaultVersionHostname ( )
static

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

Returns
string The standard hostname of the default version of the application, or FALSE if the call failed.
static google\appengine\api\app_identity\AppIdentityService::getPublicCertificates ( )
static

Get the list of public certifates for the application.

Exceptions
AppIdentityExceptionIf there is an error using the AppIdentity service.
Returns
PublicCertificate[] An array of the applications public certificates.
static google\appengine\api\app_identity\AppIdentityService::getServiceAccountName ( )
static

Get the service account name for the application.

Exceptions
AppIdentityExceptionIf there is an error using the AppIdentity service.
Returns
string The service account name.
static google\appengine\api\app_identity\AppIdentityService::signForApp (   $bytes_to_sign)
static

Signs arbitrary byte array using per app private key.

Parameters
string$bytes_to_signThe bytes to generate the signature for.
Exceptions
InvalidArgumentException If $bytes_to_sign is not a string.
AppIdentityExceptionIf there is an error using the AppIdentity service.
Returns
array An array containing the elements 'key_name' - the name of the key used to sign the bytes 'signature' - the signature of the bytes.

The documentation for this class was generated from the following file: