Akamai {OPEN} EdgeGrid Authentication for PHP
  • Namespace
  • Class
  • Tree

Namespaces

  • Akamai
    • Open
      • EdgeGrid
        • Authentication
          • Exception
            • SignerException
        • Exception
          • HandlerException
        • Handler

Classes

  • Authentication
  • Cli
  • Client

Exceptions

  • Exception

Class Authentication

Akamai {OPEN} EdgeGrid Request Signer

Namespace: Akamai\Open\EdgeGrid
Package: \Akamai\Open\EdgeGrid\Authentication
Located at Authentication.php

Methods summary

public string
# createAuthHeader( )

Create the Authentication header

Create the Authentication header

Returns

string

Throws

Akamai\Open\EdgeGrid\Authentication\Exception\SignerException\InvalidSignDataException

Link

https://developer.akamai.com/introduction/Client_Auth.html
public Akamai\Open\EdgeGrid\Authentication
# setHttpMethod( string $method )

Set request HTTP method

Set request HTTP method

Parameters

$method

Returns

Akamai\Open\EdgeGrid\Authentication
public string
# getHttpMethod( )

Get request HTTP method

Get request HTTP method

Returns

string
public Akamai\Open\EdgeGrid\Authentication
# setHost( mixed $host )

Set request host

Set request host

Parameters

$host

Returns

Akamai\Open\EdgeGrid\Authentication
public string
# getHost( )

Get the request host

Get the request host

Returns

string
public Akamai\Open\EdgeGrid\Authentication
# setConfig( array $config )

Set Guzzle config

Set Guzzle config

This is a convenient way to pass in the body/query/headers options

Parameters

$config

Returns

Akamai\Open\EdgeGrid\Authentication
public array
# getConfig( )

Get Authentication config array

Get Authentication config array

Returns

array
public
# setQuery( array|string $query, boolean $ensure_encoding = true )

Set GET args

Set GET args

If setting to a string, you MUST encode using RFC3986 http_build_query(). When passing in a string, this method will re-encode using RFC3986 unless you explicitly pass in false as the second argument.

Parameters

$query
$ensure_encoding

Returns


$this
public string|array
# getQuery( )

Get request query string

Get request query string

The return value will match the type passed in to setQuery().

Returns

string|array
public
# setBody( string $body )

Set request body

Set request body

Parameters

$body

Returns


$this
public string
# getBody( boolean $truncate = false )

Get request body

Get request body

Parameters

$truncate

Returns

string
public
# setHeaders( array $headers )

Set request headers

Set request headers

Parameters

$headers

Returns


$this
public array
# getHeaders( )

Get request headers

Get request headers

Returns

array
public
# setPath( mixed $path )

Set request path

Set request path

Parameters

$path

Returns


$this
public string
# getPath( )

Get request path

Get request path

Returns

string
public
# setTimestamp( Akamai\Open\EdgeGrid\Authentication\Timestamp|string $timestamp = null )

Set signing timestamp

Set signing timestamp

Parameters

$timestamp

Returns


$this
public
# setNonce( Akamai\Open\EdgeGrid\Authentication\Nonce|string $nonce = null )

Set signing nonce

Set signing nonce

Parameters

$nonce

Returns


$this
public
# setHeadersToSign( array $headers_to_sign )

Set headers to sign

Set headers to sign

Parameters

$headers_to_sign

Returns


$this
public
# setMaxBodySize( integer $max_body_size )

Set max body size to sign

Set max body size to sign

Parameters

$max_body_size
Size (in bytes)

Returns


$this
public
# setAuth( string $client_token, string $client_secret, string $access_token )

Set Akamai EdgeGrid Authentication Tokens/Secret

Set Akamai EdgeGrid Authentication Tokens/Secret

Parameters

$client_token
$client_secret
$access_token

Returns


$this
public static Akamai\Open\EdgeGrid\Authentication
# createInstance( string $section = 'default', null $path = null )

Create instance using environment (prefered) or .edgerc file (fallback) automatically.

Create instance using environment (prefered) or .edgerc file (fallback) automatically.

This method will check in order: - AKAMAI_{SECTION}* environment variables - if using the "default" section, AKAMAI* environment variables - the specified (or "default" if none) section in .edgerc - if not using the "default" section, AKAMAI_* environment variables

Parameters

$section
$path

Returns

Akamai\Open\EdgeGrid\Authentication

Throws

Akamai\Open\EdgeGrid\Authentication\Exception\ConfigException
public static Akamai\Open\EdgeGrid\Authentication
# createFromEnv( string $section = 'default' )

Create instance using environment variables

Create instance using environment variables

Parameters

$section

Returns

Akamai\Open\EdgeGrid\Authentication

Throws

Akamai\Open\EdgeGrid\Authentication\Exception\ConfigException
public static Akamai\Open\EdgeGrid\Authentication
# createFromEdgeRcFile( string $section = 'default', string|null $path = null )

Create instance using an .edgerc configuration file

Create instance using an .edgerc configuration file

Parameters

$section
$path

Returns

Akamai\Open\EdgeGrid\Authentication

Throws

Akamai\Open\EdgeGrid\Authentication\Exception\ConfigException
protected string
# canonicalizeHeaders( )

Returns headers in normalized form

Returns headers in normalized form

Returns

string
protected string
# makeBase64HmacSha256( string $data, string $key )

Returns Base64 encoded HMAC-SHA256 Hash

Returns Base64 encoded HMAC-SHA256 Hash

Parameters

$data
$key

Returns

string
protected string
# makeBase64Sha256( string $data )

Returns Base64 encoded SHA256 Hash

Returns Base64 encoded SHA256 Hash

Parameters

$data

Returns

string
protected string
# makeContentHash( )

Returns a hash of the HTTP POST body

Returns a hash of the HTTP POST body

Returns

string
protected string
# makeDataToSign( string $auth_header )

Returns a string with all data that will be signed

Returns a string with all data that will be signed

Parameters

$auth_header

Returns

string
protected string
# makeSigningKey( )

Creates a signing key based on the secret and timestamp

Creates a signing key based on the secret and timestamp

Returns

string
protected string
# signRequest( string $auth_header )

Returns a signature of the given request, timestamp and auth_header

Returns a signature of the given request, timestamp and auth_header

Parameters

$auth_header

Returns

string
protected static array
# parseEdgeRcFile( $path )

Parse a .edgerc File

Parse a .edgerc File

Parameters

$path

Returns

array

Throws

Akamai\Open\EdgeGrid\Authentication\Exception\ConfigException
protected string
# buildQueryString( $query )

Parameters

$query

Returns

string

Properties summary

protected array $auth

Authentication tokens

Authentication tokens

#
protected string $httpMethod

HTTP method

HTTP method

#
protected string $host

HTTP host

HTTP host

#
protected array $config

Guzzle config

Guzzle config

# array()
protected string $path

Request path

Request path

#
protected Akamai\Open\EdgeGrid\Authentication\Timestamp $timestamp

Request timestamp

Request timestamp

#
protected Akamai\Open\EdgeGrid\Authentication\Nonce $nonce

Request nonce

Request nonce

#
protected integer $max_body_size

Maximum body size for signing

Maximum body size for signing

# 131072
protected array $headers_to_sign

A list of headers to be included in the signature

A list of headers to be included in the signature

# array()
Akamai {OPEN} EdgeGrid Authentication for PHP API documentation generated by ApiGen