Overview

Namespaces

  • Antavo
    • RestClient
      • Exceptions
    • SignedToken
      • Exceptions
  • PHP

Classes

  • ApiClient
  • CustomerToken

Exceptions

  • ApiClientException
  • Overview
  • Namespace
  • Class

Class CustomerToken

Manages customer authentication with a signed token.

Antavo\SignedToken\SignedToken
Extended by Antavo\CustomerToken
Namespace: Antavo
Located at CustomerToken.php
Methods summary
public static boolean
# auth( mixed $customer, string $secret, integer $expires_in = 0 )

Creates an authenticating token for customer and sets it in cookies.

Creates an authenticating token for customer and sets it in cookies.

Parameters

$customer
Unique customer ID. Scalar values only.
$secret
API secret.
$expires_in

Time-to-live value for cookie (less than 30 days in seconds) or Unix Timestamp of the expiration time. Default is 0 (it expires with the session).

Returns

boolean

Returns TRUE if cookie is set successfully, FALSE otherwise.

public static Antavo\CustomerToken
# createFromCookie( string $secret )

Creates token from cookie set previously.

Creates token from cookie set previously.

Since Antavo\SignedToken\SignedToken::setToken() is invoked during creation, exceptions may have thrown from here.

Parameters

$secret
API secret.

Returns

Antavo\CustomerToken

Returns token extracted from cookie or NULL if cookie not found.

public static
# deauth( )

Alias of Antavo\CustomerToken::removeCookie().

Alias of Antavo\CustomerToken::removeCookie().

public mixed
# getCustomer( )

Returns unique customer ID from payload.

Returns unique customer ID from payload.

Returns

mixed
Returns customer ID if set, NULL otherwise.
public static boolean
# removeCookie( )

Deletes cookie that identifies customer.

Deletes cookie that identifies customer.

Returns

boolean

Returns TRUE if cookie unset successfully, FALSE otherwise.

public boolean
# setCookie( )

Sets token in cookies.

Sets token in cookies.

Returns

boolean

Returns TRUE if cookie is set successfully, FALSE otherwise. Please note the difference from all other setter methods!

public Antavo\CustomerToken
# setCustomer( mixed $customer )

Sets unique customer ID for payload.

Sets unique customer ID for payload.

Parameters

$customer

Unique customer ID. Non-scalar values are discarded.

Returns

Antavo\CustomerToken
Object instance for method chaining.
Methods inherited from Antavo\SignedToken\SignedToken
__construct(), __toString(), getAlgorithm(), getCalculatedExpirationTime(), getExpirationTime(), getPayload(), getSecret(), getToken(), isExpired(), saltDigest(), setAlgorithm(), setExpirationTime(), setPayload(), setSecret(), setToken()
Constants summary
string COOKIE_NAME

Name of the cookie under which customer token is stored.

Name of the cookie under which customer token is stored.

# '__alc'
API documentation generated by ApiGen