for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Pushok package.
*
* (c) Arthur Edamov <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Pushok\AuthProvider;
use Pushok\AuthProviderInterface;
use Pushok\Request;
/**
* Class Certificate
* @package Pushok\AuthProvider
* @see http://bit.ly/communicating-with-apns
class Certificate implements AuthProviderInterface
{
* Path to certificate.
* @var string
private $certificatePath;
* Certificate secret.
private $certificateSecret;
* This provider accepts the following options:
* - certificate_path
* - certificate_secret
* @param array $options
private function __construct(array $options)
$this->certificatePath = $options['certificate_path'] ;
$this->certificateSecret = $options['certificate_secret'];
}
* Create Certificate Auth provider.
* @return Certificate
public static function create(array $options): Certificate
return new self($options);
* Authenticate client.
* @param Request $request
public function authenticateClient(Request $request)
$request->addOptions(
[
CURLOPT_SSLCERT => $this->certificatePath,
CURLOPT_SSLCERTPASSWD => $this->certificateSecret,
CURLOPT_SSL_VERIFYPEER => true
]
);