function _bakery_validate_cookie in Bakery Single Sign-On System 7.4
Same name and namespace in other branches
- 6.2 bakery.module \_bakery_validate_cookie()
- 6 bakery.module \_bakery_validate_cookie()
- 7.2 bakery.module \_bakery_validate_cookie()
Function to validate cookies
Parameters
$type (string) CHOCOLATECHIP or OATMEAL, default CHOCOLATECHIP:
Return value
\Lcobucci\JWT\Token
Throws
\Exception If the cookie is not valid.
1 call to _bakery_validate_cookie()
- _bakery_taste_chocolatechip_cookie in ./
bakery.module - Test identification cookie
File
- ./
bakery.module, line 500
Code
function _bakery_validate_cookie($type = 'CHOCOLATECHIP') {
$key = variable_get('bakery_key', '');
$type = _bakery_cookie_name($type);
if (!isset($_COOKIE[$type]) || !$key || !variable_get('bakery_domain', '')) {
// No cookie is set or site is misconfigured. Return NULL so existing
// cookie is not deleted by _bakery_destroy_cookie().
return NULL;
}
return bakery_validate_data($_COOKIE[$type], $type);
}