Issues (37)

EndPoint/Introspection/IntrospectionResponse.php (2 issues)

1
<?php
2
3
namespace Parroauth2\Client\EndPoint\Introspection;
4
5
use Parroauth2\Client\Claim\Claims;
6
7
/**
8
 * Response of the introspection endpoint
9
 *
10
 * @see https://tools.ietf.org/html/rfc7662#section-2.2
11
 *
12
 * @psalm-immutable
13
 */
14
class IntrospectionResponse extends Claims
15
{
16
    /**
17
     * Does the current token is active ?
18
     *
19
     * If this value is false, the token should be considered as expired, and cannot be used,
20
     * and also all other claims may be null
21
     *
22
     * @return boolean
23
     */
24 11
    public function active(): bool
25
    {
26 11
        return $this['active'];
27
    }
28
29
    /**
30
     * Get the list of scope names
31
     *
32
     * @return list<string>|null
0 ignored issues
show
The type Parroauth2\Client\EndPoint\Introspection\list was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
33
     */
34 4
    public function scopes(): ?array
35
    {
36 4
        return isset($this['scope']) ? explode(' ', $this['scope']) : null;
0 ignored issues
show
Bug Best Practice introduced by
The expression return IssetNode ? explo... $this['scope']) : null also could return the type string[] which is incompatible with the documented return type Parroauth2\Client\EndPoint\Introspection\list.
Loading history...
37
    }
38
39
    /**
40
     * Get the requested client id
41
     *
42
     * @return string|null
43
     */
44 2
    public function clientId(): ?string
45
    {
46 2
        return $this->claim('client_id');
47
    }
48
49
    /**
50
     * Resource owner username
51
     *
52
     * @return string|null
53
     */
54
    public function username(): ?string
55
    {
56
        return $this->claim('username');
57
    }
58
59
    /**
60
     * Type of the token
61
     * Available values are "bearer" and "mac"
62
     *
63
     * @return string|null
64
     */
65 2
    public function tokenType(): ?string
66
    {
67 2
        return $this->claim('token_type');
68
    }
69
70
    /**
71
     * Unix timestamp indicating the token expiration date
72
     *
73
     * @return int|null
74
     */
75 1
    public function expireAt(): ?int
76
    {
77 1
        return $this->claim('exp');
78
    }
79
80
    /**
81
     * Unix timestamp indicating the token creation date
82
     *
83
     * @return int|null
84
     */
85 1
    public function issuedAt(): ?int
86
    {
87 1
        return $this->claim('iat');
88
    }
89
90
    /**
91
     * Unix timestamp indicating when the token can be used
92
     *
93
     * @return int|null
94
     */
95
    public function notBefore(): ?int
96
    {
97
        return $this->claim('nbf');
98
    }
99
100
    /**
101
     * Subject of the token
102
     * Usually identify the resource owner, like a user id
103
     *
104
     * @return string|null
105
     */
106 7
    public function subject(): ?string
107
    {
108 7
        return $this->claim('sub');
109
    }
110
111
    /**
112
     * @return string|string[]|null
113
     */
114 2
    public function audience()
115
    {
116 2
        return $this->claim('aud');
117
    }
118
119
    /**
120
     * The token issuer (i.e. oauth authority)
121
     * This value is usually an URI
122
     *
123
     * @return string|null
124
     */
125 1
    public function issuer(): ?string
126
    {
127 1
        return $this->claim('iss');
128
    }
129
130
    /**
131
     * Unique identifier of the JWT
132
     *
133
     * @return string|null
134
     */
135 2
    public function jwtId(): ?string
136
    {
137 2
        return $this->claim('jti');
138
    }
139
}
140