Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add posibility HTTPS without apikey signature #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

munikes
Copy link

@munikes munikes commented Mar 17, 2016

Add the possibility to send otp code without apikey, behind only HTTPS protocol.

@enygma
Copy link
Owner

enygma commented Mar 18, 2016

Just curious, if this removes the API key how does the service verify who is making the request?

@munikes
Copy link
Author

munikes commented Mar 18, 2016

In this link
https://developers.yubico.com/yubikey-val/Getting_Started_Writing_Clients.html,
say that if you are using https, its not necessary to verify the request
only if you want. I supposed, because you send a request with ssl and
response is secure too.

Sorry for my english.

On 18/03/16 11:50, Chris Cornutt wrote:

Just curious, if this removes the API key how does the service verify
who is making the request?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#20 (comment)

@@ -328,8 +334,9 @@ public function request($url, array $hosts, $otp, $nonce)
for ($i = 0; $i < $responseCount; $i++) {
$responses[$i]->setInputOtp($otp)->setInputNonce($nonce);

if ($this->validateResponseSignature($responses[$i]) === false) {
unset($responses[$i]);
if ($this->getApiKey() and $this->getClientId())
Copy link
Owner

Choose a reason for hiding this comment

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

For clarity can you add the opening { here?

@munikes
Copy link
Author

munikes commented Mar 21, 2016

I think, I've already made all the changes you asked.

@@ -269,7 +269,10 @@ public function check($otp, $multi = false)

$clientId = $this->getClientId();
if ($clientId === null) {
throw new \InvalidArgumentException('Client ID cannot be null');
if (!$this->getUseSecure()){

Choose a reason for hiding this comment

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

It should have the white space before {.

@@ -328,8 +335,10 @@ public function request($url, array $hosts, $otp, $nonce)
for ($i = 0; $i < $responseCount; $i++) {
$responses[$i]->setInputOtp($otp)->setInputNonce($nonce);

if ($this->validateResponseSignature($responses[$i]) === false) {
unset($responses[$i]);
if ($this->getApiKey() and $this->getClientId()){

Choose a reason for hiding this comment

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

It should do that as the previous commit mentioned.

if (!$this->getUseSecure()){
throw new \InvalidArgumentException('Client ID cannot be null');
}
$clientId = rand(1,9999);

Choose a reason for hiding this comment

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

Is it proper to generate the random $clientId in that method?
I think it should use the original approach is appropriate 👍 .

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.

None yet

3 participants