public function validateCredentials(Credentials $credentials) { // Validate $credentials here, then assign to $claims an array // containing the JWT claims to associate with the generated token. // EKW: Successful validation assumed $tokenId = base64_encode(mcrypt_create_iv(32)); $issuedAt = time(); $notBefore = $issuedAt + 10; // Adding 10 seconds $expire = $notBefore + 864000; // Adding 30 days for example $serverName = gethostname(); // Retrieve the server name from config file $data = array(Constants::USER_ID => $credentials->getUserId(), Constants::ROLE => $credentials->getRole()); $claims = array('iat' => $issuedAt, 'jti' => $tokenId, 'iss' => $serverName, 'nbf' => $notBefore, 'exp' => $expire, 'data' => $data); return $this->generator->getToken($claims); }