Skip to content
This repository has been archived by the owner on Jul 5, 2022. It is now read-only.

Commit

Permalink
#19 implement configuration to disable guzzle ssl verification (#20)
Browse files Browse the repository at this point in the history
* #19 add support to disable ssl verification at guzzle client

* #19 set verify ssl to default true

* Update configuration
  • Loading branch information
DZunke committed Dec 14, 2016
1 parent 04a660e commit 711972e
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
SlackBundle v2.1.0
==================
- Add Support to disable SSL Verification at Guzzle Client

SlackBundle v2.0.0
==================
- (NOT BC) Feature: Upgrade to Guzzle 6 (thanks for Support @alister)
Expand Down
3 changes: 3 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public function getConfigTreeBuilder()
->min(1)
->info('The amount of retries for the connection if the Rate Limits of Slack are reached')
->end()
->booleanNode('verify_ssl')
->defaultTrue()
->end()
->end();

$rootNode->append($this->addIdentities());
Expand Down
1 change: 1 addition & 0 deletions DependencyInjection/DZunkeSlackExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ protected function configureSlackConnection(array $config, ContainerBuilder $con
$definition->addMethodCall('setEndpoint', [$config['endpoint']]);
$definition->addMethodCall('setToken', [$config['token']]);
$definition->addMethodCall('setLimitRetries', [$config['limit_retries']]);
$definition->addMethodCall('setVerifySsl', [$config['verify_ssl']]);
}

}
1 change: 1 addition & 0 deletions Resources/doc/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
d_zunke_slack:
endpoint: slack.com/api/
token: null # Required
verify_ssl: true # ssl verification at guzzle client

# The amount of retries for the connection if the Rate Limits of Slack are reached
limit_retries: 3
Expand Down
2 changes: 1 addition & 1 deletion Slack/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected function buildUri(Actions\ActionsInterface $action, array $requestPara
*/
protected function executeRequest(Uri $uri)
{
$guzzle = new GuzzleClient();
$guzzle = new GuzzleClient(['verify' => $this->connection->getVerifySsl()]);

return $guzzle->request('GET', $uri);
}
Expand Down
25 changes: 25 additions & 0 deletions Slack/Client/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ class Connection
*/
protected $limitRetries = 3;

/**
* @var bool
*/
private $verifySsl = true;

/**
* @param string $endpoint
* @return $this
Expand Down Expand Up @@ -76,6 +81,26 @@ public function getLimitRetries()
return $this->limitRetries;
}

/**
* @param bool $verifySsl
*
* @return $this
*/
public function setVerifySsl($verifySsl)
{
$this->verifySsl = (bool) $verifySsl;

return $this;
}

/**
* @return bool
*/
public function getVerifySsl()
{
return $this->verifySsl;
}

/**
* @return bool
*/
Expand Down

0 comments on commit 711972e

Please sign in to comment.