1 | <?php |
||
2 | |||
3 | use ByTIC\Hello\Oauth\Grants\PersonalAccessGrant; |
||
4 | use League\OAuth2\Server\Grant\AuthCodeGrant; |
||
5 | use League\OAuth2\Server\Grant\RefreshTokenGrant; |
||
6 | use League\OAuth2\Server\Grant\ImplicitGrant; |
||
7 | use League\OAuth2\Server\Grant\PasswordGrant; |
||
8 | use League\OAuth2\Server\Grant\ClientCredentialsGrant; |
||
9 | use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface; |
||
10 | use League\OAuth2\Server\Repositories\AuthCodeRepositoryInterface; |
||
11 | use League\OAuth2\Server\Repositories\ClientRepositoryInterface; |
||
12 | use League\OAuth2\Server\Repositories\RefreshTokenRepositoryInterface; |
||
13 | use League\OAuth2\Server\Repositories\ScopeRepositoryInterface; |
||
14 | use League\OAuth2\Server\Repositories\UserRepositoryInterface; |
||
15 | use function storage_path; |
||
16 | |||
17 | return [ |
||
18 | /* |
||
19 | |-------------------------------------------------------------------------- |
||
20 | | Key path. |
||
21 | |-------------------------------------------------------------------------- |
||
22 | | |
||
23 | | Path to the directory where the public and private keys used by the |
||
24 | | oauth service are. |
||
25 | | |
||
26 | */ |
||
27 | 'encryption_key' => env('OAUTH_AUTHORIZATION_KEY', storage_path('oauth')), |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
28 | 'key_path' => env('OAUTH_KEYS_PATH', storage_path('oauth')), |
||
29 | |||
30 | /* |
||
31 | |-------------------------------------------------------------------------- |
||
32 | | Repositories. |
||
33 | |-------------------------------------------------------------------------- |
||
34 | | |
||
35 | | Override the repositories that the models are fetched from. |
||
36 | | The default implementations uses the $entityManager->getRepository(entity) |
||
37 | | methods to fetch the given objects. |
||
38 | | |
||
39 | | Implementations must implement the interfaces they bind to. |
||
40 | | |
||
41 | */ |
||
42 | 'repositories' => [ |
||
43 | AccessTokenRepositoryInterface::class => null, |
||
44 | ClientRepositoryInterface::class => null, |
||
45 | RefreshTokenRepositoryInterface::class => null, |
||
46 | ScopeRepositoryInterface::class => null, |
||
47 | AuthCodeRepositoryInterface::class => null, |
||
48 | UserRepositoryInterface::class => null, |
||
49 | ], |
||
50 | |||
51 | /* |
||
52 | |-------------------------------------------------------------------------- |
||
53 | | Grant types. |
||
54 | |-------------------------------------------------------------------------- |
||
55 | | |
||
56 | | Grant types available to use. |
||
57 | | If one is not wanted, just comment it out and it will not be loaded |
||
58 | | in to the auth server. |
||
59 | | |
||
60 | */ |
||
61 | 'grant_types' => [ |
||
62 | 'PersonalAccess' => PersonalAccessGrant::class, |
||
63 | // 'AuthCode' => AuthCodeGrant::class, |
||
64 | // 'RefreshToken' => RefreshTokenGrant::class, |
||
65 | // 'Password' => PasswordGrant::class, |
||
66 | // 'Implicit' => ImplicitGrant::class, |
||
67 | // 'ClientCredentials' => ClientCredentialsGrant::class, |
||
68 | ], |
||
69 | |||
70 | /* |
||
71 | |-------------------------------------------------------------------------- |
||
72 | | Token lifetime. |
||
73 | |-------------------------------------------------------------------------- |
||
74 | | |
||
75 | | Lifetime of the auth tokens. |
||
76 | | Change to preferred lifetime. |
||
77 | | |
||
78 | */ |
||
79 | 'token_ttl' => Carbon\CarbonInterval::create(0, 0, 0, 0, 1, 0, 0), |
||
80 | |||
81 | /* |
||
82 | |-------------------------------------------------------------------------- |
||
83 | | User identification key. |
||
84 | |-------------------------------------------------------------------------- |
||
85 | | |
||
86 | | Key to use when fetching an existing user from the user repository. |
||
87 | | The user_identification will be the key of the entity that the repository |
||
88 | | searches for. Could be an email, username, identifier or anything. |
||
89 | | |
||
90 | */ |
||
91 | 'user_identification' => env('OAUTH_IDENTIFICATION', 'userName'), |
||
92 | |||
93 | /* |
||
94 | |-------------------------------------------------------------------------- |
||
95 | | Password hash. |
||
96 | |-------------------------------------------------------------------------- |
||
97 | | |
||
98 | | Hash implementation to use when verifying passwords. |
||
99 | | |
||
100 | */ |
||
101 | // 'password_hash' => Illuminate\Hashing\BcryptHasher::class, |
||
102 | |||
103 | /* |
||
104 | |-------------------------------------------------------------------------- |
||
105 | | Scope validator. |
||
106 | |-------------------------------------------------------------------------- |
||
107 | | |
||
108 | | Class which validates the scopes on auth requests. |
||
109 | | If you do not use scopes, default implementation can be used, else |
||
110 | | implement your own and bind it here. |
||
111 | | |
||
112 | */ |
||
113 | // Jitesoft\Loauthd\Contracts\ScopeValidatorInterface::class => Jitesoft\Loauthd\ScopeValidator::class, |
||
114 | |||
115 | /* |
||
116 | |-------------------------------------------------------------------------- |
||
117 | | User class. |
||
118 | |-------------------------------------------------------------------------- |
||
119 | | |
||
120 | | If you use another user class than the default provided by framework |
||
121 | | it can be changed here. |
||
122 | | |
||
123 | */ |
||
124 | // 'user_model' => Jitesoft\Loauthd\Entities\User::class, |
||
125 | ]; |
||
126 |