You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you prefer php configuration, you could use `AutoconfigureTag` symfony attribute for the same result :
85
+
- or via `AutoconfigureTag` :
67
86
68
87
```php
69
88
<?php
@@ -78,7 +97,22 @@ And the service must be tagged with the `league.oauth2_server.authorization_serv
78
97
}
79
98
```
80
99
81
-
If `accessTokenTTL` tag attribute is not defined, then bundle config is used `league_oauth2_server.authorization_server.access_token_ttl` (same as `league.oauth2_server.access_token_ttl.default` service container parameter). \
100
+
- and last option is usage of `\League\Bundle\OAuth2ServerBundle\Attribute\WithAccessTokenTTL` attribute (note: service must be registered with correct tag before, this is already done if autoconfiguration is activated):
101
+
102
+
```php
103
+
<?php
104
+
...
105
+
106
+
use League\Bundle\OAuth2ServerBundle\Attribute\WithAccessTokenTTL;
107
+
108
+
#[WithAccessTokenTTL(accessTokenTTL: 'PT5H')]
109
+
final class FakeGrant extends AbstractGrant implements GrantTypeInterface
110
+
{
111
+
...
112
+
}
113
+
```
114
+
115
+
For all of these options, if `accessTokenTTL` is not defined, then bundle config is used `league_oauth2_server.authorization_server.access_token_ttl` (same as `league.oauth2_server.access_token_ttl.default` service container parameter). \
82
116
`null` is considered as defined, to allow to unset ttl. \
83
117
`league_oauth2_server.authorization_server.refresh_token_ttl` is also accessible for your implementation using `league.oauth2_server.refresh_token_ttl.default` service container parameter.
$this->assertGrantConfig('fake_grant', new \DateInterval('PT5H'), $enabledGrantTypes, $grantTypeAccessTokenTTL, FakeGrant::class);
37
+
$this->assertGrantConfig(FakeGrantNullAccessTokenTTL::class, new \DateInterval('PT1H'), $enabledGrantTypes, $grantTypeAccessTokenTTL);
38
+
$this->assertGrantConfig(FakeGrantUndefinedAccessTokenTTL::class, new \DateInterval('PT2H'), $enabledGrantTypes, $grantTypeAccessTokenTTL);
39
+
40
+
$this->assertGrantConfig(FakeGrantWithAttribute::class, new \DateInterval('PT5H'), $enabledGrantTypes, $grantTypeAccessTokenTTL);
41
+
$this->assertGrantConfig(FakeGrantNullAccessTokenTTLWithAttribute::class, new \DateInterval('PT1H'), $enabledGrantTypes, $grantTypeAccessTokenTTL);
42
+
$this->assertGrantConfig(FakeGrantUndefinedAccessTokenTTLOnlyAutoconfigured::class, new \DateInterval('PT2H'), $enabledGrantTypes, $grantTypeAccessTokenTTL);
35
43
36
44
// TODO remove code bloc when bundle interface and configurator will be deleted
0 commit comments