concrete/src/Api/OAuth/Server/IdTokenResponse.php
protected function createIdToken(AccessTokenEntityInterface $accessToken, ClaimsSet $claims)
    {
        $issuer = $this->site->getSite();

        // Initialize the builder
        $builder = (new Builder())
            ->setAudience($accessToken->getClient()->getIdentifier())
            ->setIssuer($issuer->getSiteCanonicalURL())
            ->setIssuedAt(time())
            ->setNotBefore(time())
            ->setExpiration($accessToken->getExpiryDateTime()->getTimestamp())
            ->setSubject($accessToken->getUserIdentifier());

        // Apply claims
        foreach ($claims->jsonSerialize() as $key => $claim) {
            $builder->set($key, $claim);
        }

        // Return the newly signed token
        return $builder
            ->sign(new Sha256(), new Key($this->privateKey->getKeyPath(), $this->privateKey->getPassPhrase()))
            ->getToken();
    }
protected function createIdToken(AccessTokenEntityInterface $accessToken, ClaimsSet $claims)
    {
        $issuer = $this->site->getSite();

        // Initialize the builder
        $builder = (new Builder())
            ->setAudience($accessToken->getClient()->getIdentifier())
            ->setIssuer($issuer->getSiteCanonicalURL())
            ->setIssuedAt(time())
            ->setNotBefore(time())
            ->setExpiration($accessToken->getExpiryDateTime()->getTimestamp())
            ->setSubject($accessToken->getUserIdentifier());

        // Apply claims
        foreach ($claims->jsonSerialize() as $key => $claim) {
            $builder->set($key, $claim);
        }

        // Return the newly signed token
        return $builder
            ->sign(new Sha256(), new Key($this->privateKey->getKeyPath(), $this->privateKey->getPassPhrase()))
            ->getToken();
    }
protected function createIdToken ( AccessTokenEntityInterface $ accessToken , ClaimsSet $ claims ) { $ issuer = $ this -> site -> getSite ( ) ; // Initialize the builder $ builder = ( new Builder ( ) ) -> setAudience ( $ accessToken -> getClient ( ) -> getIdentifier ( ) ) -> setIssuer ( $ issuer -> getSiteCanonicalURL ( ) ) -> setIssuedAt ( time ( ) ) -> setNotBefore ( time ( ) ) -> setExpiration ( $ accessToken -> getExpiryDateTime ( ) -> getTimestamp ( ) ) -> setSubject ( $ accessToken -> getUserIdentifier ( ) ) ; // Apply claims foreach ( $ claims -> jsonSerialize ( ) as $ key => $ claim ) { $ builder -> set ( $ key , $ claim ) ; } // Return the newly signed token return $ builder -> sign ( new Sha256 ( ) , new Key ( $ this -> privateKey -> getKeyPath ( ) , $ this -> privateKey -> getPassPhrase ( ) ) ) -> getToken ( ) ; }
Create an ID token to include with our response

@param \League\OAuth2\Server\Entities\AccessTokenEntityInterface $accessToken
@param \League\OpenIdConnectClaims\ClaimsSet $claims

@return \Lcobucci\JWT\Token
Create an ID token to include with our response