Class CustomerToken
Manages customer authentication with a signed token.
-
Antavo\SignedToken\SignedToken
-
Antavo\CustomerToken
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
|
|
public static
|
|
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.
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
|
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.
|
|