Skip to content

Commit

Permalink
Merge pull request #26 from shadypierre/master
Browse files Browse the repository at this point in the history
Add support for 'auth' option
  • Loading branch information
Florian Preusner committed Oct 17, 2015
2 parents a7ded62 + 880b7a8 commit bc0c13d
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 62 deletions.
128 changes: 66 additions & 62 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,71 +83,75 @@ private function createClientsNode() {
};

$node->useAttributeAsKey('name')
->prototype('array')
->children()
->scalarNode('base_url')->defaultValue(null)->end()
->prototype('array')
->children()
->scalarNode('base_url')->defaultValue(null)->end()

->arrayNode('headers')
->prototype('scalar')
->end()
->end()

->arrayNode('options')
->children()
->scalarNode('cert')->end()
->scalarNode('connect_timeout')->end()
->booleanNode('debug')
->beforeNormalization()
->ifString()->then($boolFilter)
->end()
->end()
->booleanNode('decode_content')
->beforeNormalization()
->ifString()->then($boolFilter)
->end()
->end()
->scalarNode('delay')->end()
->booleanNode('http_errors')
->beforeNormalization()
->ifString()->then($boolFilter)
->end()
->end()
->scalarNode('expect')->end()
->scalarNode('ssl_key')->end()
->booleanNode('stream')
->beforeNormalization()
->ifString()->then($boolFilter)
->end()
->end()
->booleanNode('synchronous')
->beforeNormalization()
->ifString()->then($boolFilter)
->end()
->end()
->scalarNode('timeout')->end()
->booleanNode('verify')
->beforeNormalization()
->ifString()->then($boolFilter)
->end()
->end()
->scalarNode('version')->end()
->end()
->end()

->arrayNode('plugin')
->addDefaultsIfNotSet()
->children()
->arrayNode('wsse')
->addDefaultsIfNotSet()
->children()
->scalarNode('username')->defaultFalse()->end()
->scalarNode('password')->defaultValue('')->end()
->end()
->end()
->arrayNode('headers')
->prototype('scalar')
->end()
->end()

->arrayNode('options')
->children()
->arrayNode('auth')
->prototype('scalar')
->end()
->end()
->scalarNode('cert')->end()
->scalarNode('connect_timeout')->end()
->booleanNode('debug')
->beforeNormalization()
->ifString()->then($boolFilter)
->end()
->end()
->booleanNode('decode_content')
->beforeNormalization()
->ifString()->then($boolFilter)
->end()
->end()
->scalarNode('delay')->end()
->booleanNode('http_errors')
->beforeNormalization()
->ifString()->then($boolFilter)
->end()
->end()
->scalarNode('expect')->end()
->scalarNode('ssl_key')->end()
->booleanNode('stream')
->beforeNormalization()
->ifString()->then($boolFilter)
->end()
->end()
->booleanNode('synchronous')
->beforeNormalization()
->ifString()->then($boolFilter)
->end()
->end()
->scalarNode('timeout')->end()
->booleanNode('verify')
->beforeNormalization()
->ifString()->then($boolFilter)
->end()
->end()
->scalarNode('version')->end()
->end()
->end()
->end()

->arrayNode('plugin')
->addDefaultsIfNotSet()
->children()
->arrayNode('wsse')
->addDefaultsIfNotSet()
->children()
->scalarNode('username')->defaultFalse()->end()
->scalarNode('password')->defaultValue('')->end()
->end()
->end()
->end()
->end()
->end()
->end();
->end();

return $node;
} // end: createClientsNode()
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ guzzle:
# guzzle client options (full description here: http://guzzle.readthedocs.org/en/latest/request-options.html)
# NOTE: "headers" option is not accepted here as it is provided as described above.
options:
auth:
- acme # login
- pa55w0rd # password
timeout: 30

# plugin settings
Expand Down
4 changes: 4 additions & 0 deletions Tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public function testSingleClientConfigWithOptions()
'Accept' => 'application/json'
],
'options' => [
'auth' => [
'user',
'pass'
],
'cert' => 'path/to/cert',
'connect_timeout' => 5,
'debug' => false,
Expand Down

0 comments on commit bc0c13d

Please sign in to comment.