README.md: Corrected a mistake in the symfony firewall section - #32
Conversation
|
Hi, thanks for the contribution! Just to clarify, is this the fix for the problem you experienced in #33 or is this intended to be separate from that? |
|
Hi, no it's another one. I'll push the merge request when it will be ready. |
|
OK so now it's ready. My proposed changes are for Symfony:
|
itafroma
left a comment
There was a problem hiding this comment.
Thanks a lot for this! This is very appreciated. In general, I am for these fixes.
If you don't mind, there's some formatting changes, and a couple of minor changes to the HmacClient, I'd like to see get in before merging.
|
|
||
| // A key consists of your UUID and a MIME base64 encoded shared secret. | ||
| $key = new Key('e7fe97fa-a0c8-4a42-ab8e-2c26d52df059', base64_encode('secret')); | ||
| $key = new Key('e7fe97fa-a0c8-4a42-ab8e-2c26d52df059', 'secret'); |
There was a problem hiding this comment.
I'd prefer we have a note here instead of indicating that the secret should be send unencoded. Something like:
// A key consists of your UUID and a Base64-encoded shared secret.
// Note: the API provider may have already encoded the secret. In this case, it should not be re-encoded.
$key = new Key('e7fe97fa-a0c8-4a42-ab8e-2c26d52df059', base64_encode('secret'));| @@ -0,0 +1,78 @@ | |||
| <?php | |||
|
|
|||
| namespace Acquia\Hmac\Symfony\Tests; | |||
There was a problem hiding this comment.
Let's stick this in Acquia\Hmac\Test\Mocks\Symfony and tests/Mocks/Symfony instead: this isn't part of a Symfony bundle, so we don't need to follow that structure.
| use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory; | ||
| use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory; | ||
|
|
||
| class HmacClient extends Client |
There was a problem hiding this comment.
Can you add a docblock here briefly describing what this is class is for?
|
|
||
| class HmacClient extends Client | ||
| { | ||
|
|
| * @param Key $key | ||
| * @return Key | ||
| */ | ||
| public function setKey(Key $key) { |
There was a problem hiding this comment.
Opening brace should be on its own line
|
|
||
| //set the key from the consumer | ||
| $this->client->setKey(new Key("my-key", "my-not-really-secret")); | ||
|
|
| $this->client = static::createClient(); | ||
|
|
||
| //set the key from the consumer | ||
| $this->client->setKey(new Key("my-key", "my-not-really-secret")); |
There was a problem hiding this comment.
Use single quotation marks for strings
| { | ||
| $this->client = static::createClient(); | ||
|
|
||
| //set the key from the consumer |
There was a problem hiding this comment.
I don't think we need this comment: the code is self-documenting.
| } | ||
| ``` | ||
|
|
||
| PHPUnit testing a controller behind HMAC HTTP authentification in Symfony : |
There was a problem hiding this comment.
Remove space before the colon.
| PHPUnit testing a controller behind HMAC HTTP authentification in Symfony : | ||
|
|
||
| 1. Add the service declaration: | ||
|
|
|
Merged with some changes. Thanks again! |
The name of the firewall has been corrected from
wssetohmac_auth