Skip to content

Commit

Permalink
Merge pull request #7 from clearbooks/SUB-868-improve-authenticator-e…
Browse files Browse the repository at this point in the history
…xtensibility

SUB-868
  • Loading branch information
creomant authored Aug 21, 2017
2 parents 56d9abc + 3d03d73 commit 18831e8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/JwtGuard/JwtTokenAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ class JwtTokenAuthenticator implements RequestAuthoriser, IdentityProvider
/**
* @var AlgorithmInterface
*/
private $algorithm;
protected $algorithm;

/**
* @var Token
*/
private $token;
protected $token;

/**
* @var AppIdProvider
*/
private $appIdProvider;
protected $appIdProvider;

/**
* @param Jwt $jwt
Expand All @@ -54,7 +54,7 @@ public function __construct( Jwt $jwt, AlgorithmInterface $algorithm, AppIdProvi
* @param string $claim the name of the claim
* @return mixed
*/
private function getClaimOrNull( $claim )
protected function getClaimOrNull( $claim )
{
$claim = $this->token->getPayload()->findClaimByName( $claim );
return $claim ? $claim->getValue() : null;
Expand All @@ -64,7 +64,7 @@ private function getClaimOrNull( $claim )
* Is this token expired
* @return bool
*/
private function isExpired()
protected function isExpired()
{
$exp = \DateTime::createFromFormat( 'U', $this->getClaimOrNull( self::EXPIRY ) );
return !$exp || $exp <= ( new DateTime );
Expand All @@ -74,7 +74,7 @@ private function isExpired()
* Does this token have a user id
* @return bool
*/
private function hasUserId()
protected function hasUserId()
{
return (bool)$this->getClaimOrNull( self::USER_ID );
}
Expand All @@ -83,7 +83,7 @@ private function hasUserId()
* Is this token for labs
* @return bool
*/
private function isAllowedAppId()
protected function isAllowedAppId()
{
return in_array( $this->getClaimOrNull( self::APP_ID ), $this->appIdProvider->getAppIds() );
}
Expand Down Expand Up @@ -156,7 +156,7 @@ public function getSegments()
return is_array( $segments ) ? $segments : [ ];
}

private function extractJwtFromHeader( $header )
protected function extractJwtFromHeader( $header )
{
if( strpos( $header, self::BEARER ) === 0 ){
return substr( $header, strlen( self::BEARER ) );
Expand Down

0 comments on commit 18831e8

Please sign in to comment.