Skip to content

README.md: Corrected a mistake in the symfony firewall section - #32

Merged
itafroma merged 12 commits into
acquia:masterfrom
EDSI-Tech:master
Mar 19, 2018
Merged

README.md: Corrected a mistake in the symfony firewall section#32
itafroma merged 12 commits into
acquia:masterfrom
EDSI-Tech:master

Conversation

@galphanet

Copy link
Copy Markdown
Contributor

The name of the firewall has been corrected from wsse to hmac_auth

@itafroma

itafroma commented Jan 2, 2018

Copy link
Copy Markdown
Contributor

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?

@galphanet

Copy link
Copy Markdown
Contributor Author

Hi, no it's another one. I'll push the merge request when it will be ready.

@galphanet

Copy link
Copy Markdown
Contributor Author

OK so now it's ready. My proposed changes are for Symfony:

  1. Added the ResponseSigner service declaration in documentation as it was never called (seems strange...)
  2. base66_encode the secret is not needed in Guzzle init (I send almost 2 days figuring this...)
  3. Added HmacClient to use in PHPUnit testing on a Symfony project

@itafroma itafroma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread README.md Outdated

// 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');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'));

Comment thread src/Symfony/Tests/HmacClient.php Outdated
@@ -0,0 +1,78 @@
<?php

namespace Acquia\Hmac\Symfony\Tests;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a docblock here briefly describing what this is class is for?

Comment thread src/Symfony/Tests/HmacClient.php Outdated

class HmacClient extends Client
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this space

Comment thread src/Symfony/Tests/HmacClient.php Outdated
* @param Key $key
* @return Key
*/
public function setKey(Key $key) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opening brace should be on its own line

Comment thread README.md Outdated

//set the key from the consumer
$this->client->setKey(new Key("my-key", "my-not-really-secret"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra line

Comment thread README.md Outdated
$this->client = static::createClient();

//set the key from the consumer
$this->client->setKey(new Key("my-key", "my-not-really-secret"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use single quotation marks for strings

Comment thread README.md Outdated
{
$this->client = static::createClient();

//set the key from the consumer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this comment: the code is self-documenting.

Comment thread README.md Outdated
}
```

PHPUnit testing a controller behind HMAC HTTP authentification in Symfony :

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space before the colon.

Comment thread README.md
PHPUnit testing a controller behind HMAC HTTP authentification in Symfony :

1. Add the service declaration:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra line

galphanet and others added 7 commits January 15, 2018 11:41
* master:
  Add PHP 7.2 support, change PHPUnit namespace, improve test coverage (acquia#38)
  Bump minor version in README.
  Update README
  ACM-484: Add a base64 key/secret encoder (acquia#37)
  Ensure response body is rewound after signing response (acquia#35)
@itafroma
itafroma dismissed their stale review March 19, 2018 18:07

Issues addressed

@itafroma itafroma added this to the 3.4.0 milestone Mar 19, 2018
@itafroma
itafroma merged commit ee04f68 into acquia:master Mar 19, 2018
@itafroma

Copy link
Copy Markdown
Contributor

Merged with some changes. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants