Skip to content

Commit

Permalink
use bcrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Dec 27, 2019
1 parent ccbcfeb commit 1c40ae0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Bridge/ClientRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected function handlesGrant($record, $grantType)
protected function verifySecret($clientSecret, $storedHash)
{
return Passport::$hashesClientSecrets
? hash_equals($storedHash, hash('sha256', $clientSecret))
? password_verify($clientSecret, $storedHash)
: hash_equals($storedHash, $clientSecret);
}
}
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function setSecretAttribute($value)
return;
}

$this->attributes['secret'] = hash('sha256', $value);
$this->attributes['secret'] = password_hash($value, PASSWORD_BCRYPT);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/BridgeClientRepositoryHashedSecretsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ protected function setUp(): void

class BridgeClientRepositoryHashedTestClientStub extends BridgeClientRepositoryTestClientStub
{
public $secret = '2bb80d537b1da3e38bd30361aa855686bde0eacd7162fef6a25fe97bf527a25b';
public $secret = '$2y$10$WgqU4wQpfsARCIQk.nPSOOiNkrMpPVxQiLCFUt8comvQwh1z6WFMG';
}

0 comments on commit 1c40ae0

Please sign in to comment.