summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrent Shaffer <bshafs@gmail.com>2014-04-02 19:57:46 +0400
committerBrent Shaffer <bshafs@gmail.com>2014-04-02 19:57:46 +0400
commit5701d7712d22846976fb034f0287210da10aa6d8 (patch)
tree45535df738df7aea503c7efa56fccffa56280d9f /src
parent79080c96a5506aa5c2052517ac8702371df8c1af (diff)
downloadoauth2-server-php-5701d7712d22846976fb034f0287210da10aa6d8.tar.xz
addresses #363 - temporary fix, but this will require more thought later, as custom headers require a subclass
Diffstat (limited to 'src')
-rw-r--r--src/OAuth2/Encryption/Jwt.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/OAuth2/Encryption/Jwt.php b/src/OAuth2/Encryption/Jwt.php
index 5abd533..98b1a90 100644
--- a/src/OAuth2/Encryption/Jwt.php
+++ b/src/OAuth2/Encryption/Jwt.php
@@ -10,7 +10,7 @@ class Jwt implements EncryptionInterface
{
public function encode($payload, $key, $algo = 'HS256')
{
- $header = array('typ' => 'JWT', 'alg' => $algo);
+ $header = $this->generateJwtHeader($payload, $algo);
$segments = array(
$this->urlSafeB64Encode(json_encode($header)),
@@ -138,4 +138,15 @@ class Jwt implements EncryptionInterface
return base64_decode($b64);
}
+
+ /**
+ * Override to create a custom header
+ */
+ protected function generateJwtHeader($payload, $algorithm)
+ {
+ return array(
+ 'typ' => 'JWT',
+ 'alg' => $algorithm,
+ );
+ }
}