Project Name : code coverage of AuthStack\OIDC\IDToken

# Code coverage of Project Name: AuthStack\OIDC\IDToken

## Class code coverage 83.33%

### Methods

- 100% __construct
- 0% getJWT
- 100% getToken
- 100% verify

### Source

Line | Code
--- | ---
1 |
    <?php
2 |
3 |
    namespace AuthStack\OIDC;
4 |
5 |
    use Lcobucci\JWT\Token;
6 |
    use Lcobucci\JWT\Signer;
7 |
    use Lcobucci\JWT\Parser;
8 |
    use Lcobucci\JWT\Signer\Key;
9 |
    use Lcobucci\JWT\Signer\Rsa\Sha256;
10 |
11 |
    class IDToken
12 |
    {
13 |
        protected $jwt;
14 |
        protected $token;
15 |
16 |
        public function __construct(string $jwt)
17 |
        {
18 |
            $this->jwt = $jwt;
19 |
20 |
            $this->token = (new Parser())->parse($jwt);
21 |
        }
22 |
23 |
        public function getJWT(): string
24 |
        {
25 |
            return $this->jwt;
26 |
        }
27 |
28 |
        /**
29 |
         * @return Token
30 |
         */
31 |
        public function getToken(): Token
32 |
        {
33 |
            return $this->token;
34 |
        }
35 |
36 |
        /**
37 |
         * @param Signer $signer
38 |
         * @param string $public_key
39 |
         * @return bool
40 |
         */
41 |
        public function verify(Signer $signer, string $public_key)
42 |
        {
43 |
            return $this->token->verify($signer, new Key($public_key));
44 |
        }
45 |
    }