Skip to content

Commit b44cbb6

Browse files
committed
fix: #225: update documentation to add usage of AutoconfigureTag attribute
1 parent 0ffa806 commit b44cbb6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/implementing-custom-grant-type.md

+15
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@ And the service must be tagged with the `league.oauth2_server.authorization_serv
6363
- {name: league.oauth2_server.authorization_server.grant, accessTokenTTL: PT5H}
6464
```
6565

66+
If you prefer php configuration, you could use `AutoconfigureTag` symfony attribute for the same result :
67+
68+
```php
69+
<?php
70+
...
71+
72+
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
73+
74+
#[AutoconfigureTag(name: 'league.oauth2_server.authorization_server.grant', attributes: [accessTokenTTL: 'PT5H'])]
75+
final class FakeGrant extends AbstractGrant implements GrantTypeInterface
76+
{
77+
...
78+
}
79+
```
80+
6681
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). \
6782
`null` is considered as defined, to allow to unset ttl. \
6883
`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.

0 commit comments

Comments
 (0)