PHP Class Lcobucci\JWT\Builder

Since: 0.1.0
Author: Luís Otávio Cobucci Oblonczyk ([email protected])
Exibir arquivo Open project: lcobucci/jwt Class Usage Examples

Public Methods

Method Description
__construct ( Lcobucci\Jose\Parsing\Encoder $encoder, Factory $claimFactory ) Initializes a new builder
canOnlyBeUsedAfter ( integer $notBefore, boolean $addHeader = false ) : Builder Configures the time before which the token cannot be accepted
canOnlyBeUsedBy ( string $audience, boolean $addHeader = false ) : Builder Configures the audience
expiresAt ( integer $expiration, boolean $addHeader = false ) : Builder Configures the expiration time
getToken ( ) : Token Returns the resultant token
identifiedBy ( string $id, boolean $addHeader = false ) : Builder Configures the token id
issuedAt ( integer $issuedAt, boolean $addHeader = false ) : Builder Configures the time that the token was issued
issuedBy ( string $issuer, boolean $addHeader = false ) : Builder Configures the issuer
relatedTo ( string $subject, boolean $addHeader = false ) : Builder Configures the subject
sign ( Lcobucci\JWT\Signer $signer, Lcobucci\JWT\Signer\Key $key ) : Builder Signs the data
unsign ( ) : Builder Removes the signature from the builder
with ( string $name, mixed $value ) : Builder Configures a claim item
withHeader ( string $name, mixed $value ) : Builder Configures a header item

Protected Methods

Method Description
setRegisteredClaim ( string $name, mixed $value, boolean $addHeader ) : Builder Configures a registed claim

Method Details

__construct() public method

Initializes a new builder
public __construct ( Lcobucci\Jose\Parsing\Encoder $encoder, Factory $claimFactory )
$encoder Lcobucci\Jose\Parsing\Encoder
$claimFactory Lcobucci\JWT\Claim\Factory

canOnlyBeUsedAfter() public method

Configures the time before which the token cannot be accepted
public canOnlyBeUsedAfter ( integer $notBefore, boolean $addHeader = false ) : Builder
$notBefore integer
$addHeader boolean
return Builder

canOnlyBeUsedBy() public method

Configures the audience
public canOnlyBeUsedBy ( string $audience, boolean $addHeader = false ) : Builder
$audience string
$addHeader boolean
return Builder

expiresAt() public method

Configures the expiration time
public expiresAt ( integer $expiration, boolean $addHeader = false ) : Builder
$expiration integer
$addHeader boolean
return Builder

getToken() public method

Returns the resultant token
public getToken ( ) : Token
return Token

identifiedBy() public method

Configures the token id
public identifiedBy ( string $id, boolean $addHeader = false ) : Builder
$id string
$addHeader boolean
return Builder

issuedAt() public method

Configures the time that the token was issued
public issuedAt ( integer $issuedAt, boolean $addHeader = false ) : Builder
$issuedAt integer
$addHeader boolean
return Builder

issuedBy() public method

Configures the issuer
public issuedBy ( string $issuer, boolean $addHeader = false ) : Builder
$issuer string
$addHeader boolean
return Builder

relatedTo() public method

Configures the subject
public relatedTo ( string $subject, boolean $addHeader = false ) : Builder
$subject string
$addHeader boolean
return Builder

setRegisteredClaim() protected method

Configures a registed claim
protected setRegisteredClaim ( string $name, mixed $value, boolean $addHeader ) : Builder
$name string
$value mixed
$addHeader boolean
return Builder

sign() public method

Signs the data
public sign ( Lcobucci\JWT\Signer $signer, Lcobucci\JWT\Signer\Key $key ) : Builder
$signer Lcobucci\JWT\Signer
$key Lcobucci\JWT\Signer\Key
return Builder

unsign() public method

Removes the signature from the builder
public unsign ( ) : Builder
return Builder

with() public method

Configures a claim item
public with ( string $name, mixed $value ) : Builder
$name string
$value mixed
return Builder

withHeader() public method

Configures a header item
public withHeader ( string $name, mixed $value ) : Builder
$name string
$value mixed
return Builder