|
| 1 | +<?php |
| 2 | + |
| 3 | +return [ |
| 4 | + |
| 5 | + /* |
| 6 | + |-------------------------------------------------------------------------- |
| 7 | + | Database Connection to use |
| 8 | + |-------------------------------------------------------------------------- |
| 9 | + | |
| 10 | + | Set the default database connection to use for the repositories, |
| 11 | + | when set to default, it uses whatever connection you specified in your laravel db config. |
| 12 | + | |
| 13 | + */ |
| 14 | + 'database' => 'mysql', |
| 15 | + |
| 16 | + /* |
| 17 | + |-------------------------------------------------------------------------- |
| 18 | + | Supported Grant Types |
| 19 | + |-------------------------------------------------------------------------- |
| 20 | + | |
| 21 | + | Your OAuth2 Server can issue an access token based on different grant types |
| 22 | + | you can even provide your own grant type. |
| 23 | + | To choose which grant type suits your scenario, see |
| 24 | + | https://github.com/php-loep/oauth2-server/wiki/Which-OAuth-2.0-grant-should-I-use%3F |
| 25 | + | |
| 26 | + | Available grant types are: |
| 27 | + | |
| 28 | + | 'grant_types' => [ |
| 29 | + | |
| 30 | + | 'authorization_code' => [ |
| 31 | + | 'class' => 'League\OAuth2\Server\Grant\AuthCodeGrant', |
| 32 | + | 'access_token_ttl' => 3600, |
| 33 | + | |
| 34 | + | // the authorization code time to live |
| 35 | + | 'auth_token_ttl' => 3600, |
| 36 | + | ], |
| 37 | + | |
| 38 | + | 'password' => [ |
| 39 | + | 'class' => 'League\OAuth2\Server\Grant\PasswordGrant', |
| 40 | + | 'access_token_ttl' => 604800, |
| 41 | + | |
| 42 | + | // the code to run in order to verify the user's identity |
| 43 | + | 'callback' => function($username, $password){ |
| 44 | + | $credentials = [ |
| 45 | + | 'email' => $username, |
| 46 | + | 'password' => $password, |
| 47 | + | ]; |
| 48 | + | |
| 49 | + | if (Auth::once($credentials)) { |
| 50 | + | return Auth::user()->id; |
| 51 | + | } else { |
| 52 | + | return false; |
| 53 | + | } |
| 54 | + | } |
| 55 | + | ], |
| 56 | + | |
| 57 | + | 'client_credentials' => [ |
| 58 | + | 'class' => 'League\OAuth2\Server\Grant\ClientCredentialsGrant', |
| 59 | + | 'access_token_ttl' => 3600, |
| 60 | + | ], |
| 61 | + | |
| 62 | + | 'refresh_token' => [ |
| 63 | + | 'class' => 'League\OAuth2\Server\Grant\RefreshTokenGrant', |
| 64 | + | 'access_token_ttl' => 3600, |
| 65 | + | |
| 66 | + | // the refresh token time to live |
| 67 | + | 'refresh_token_ttl' => 604800, |
| 68 | + | |
| 69 | + | // whether or not to issue a new refresh token when a new access token is issued |
| 70 | + | 'rotate_refresh_tokens' => false, |
| 71 | + | ], |
| 72 | + | |
| 73 | + | ], |
| 74 | + | |
| 75 | + */ |
| 76 | + |
| 77 | + 'grant_types' => [ |
| 78 | + 'client_credentials' => [ |
| 79 | + 'class' => '\League\OAuth2\Server\Grant\ClientCredentialsGrant', |
| 80 | + 'access_token_ttl' => 3600 |
| 81 | + ] |
| 82 | + ], |
| 83 | + |
| 84 | + /* |
| 85 | + |-------------------------------------------------------------------------- |
| 86 | + | Output Token Type |
| 87 | + |-------------------------------------------------------------------------- |
| 88 | + | |
| 89 | + | This will tell the authorization server the output format for the access token |
| 90 | + | and will tell the resource server how to parse the access token used. |
| 91 | + | |
| 92 | + | Default value is League\OAuth2\Server\TokenType\Bearer |
| 93 | + | |
| 94 | + */ |
| 95 | + 'token_type' => 'League\OAuth2\Server\TokenType\Bearer', |
| 96 | + |
| 97 | + /* |
| 98 | + |-------------------------------------------------------------------------- |
| 99 | + | State Parameter |
| 100 | + |-------------------------------------------------------------------------- |
| 101 | + | |
| 102 | + | Whether or not the state parameter is required in the query string |
| 103 | + | |
| 104 | + */ |
| 105 | + 'state_param' => false, |
| 106 | + |
| 107 | + /* |
| 108 | + |-------------------------------------------------------------------------- |
| 109 | + | Scope Parameter |
| 110 | + |-------------------------------------------------------------------------- |
| 111 | + | |
| 112 | + | Whether or not the scope parameter is required in the query string |
| 113 | + | |
| 114 | + */ |
| 115 | + 'scope_param' => false, |
| 116 | + |
| 117 | + /* |
| 118 | + |-------------------------------------------------------------------------- |
| 119 | + | Scope Delimiter |
| 120 | + |-------------------------------------------------------------------------- |
| 121 | + | |
| 122 | + | Which character to use to split the scope parameter in the query string |
| 123 | + | |
| 124 | + */ |
| 125 | + 'scope_delimiter' => ',', |
| 126 | + |
| 127 | + /* |
| 128 | + |-------------------------------------------------------------------------- |
| 129 | + | Default Scope |
| 130 | + |-------------------------------------------------------------------------- |
| 131 | + | |
| 132 | + | The default scope to use if not present in the query string |
| 133 | + | |
| 134 | + */ |
| 135 | + 'default_scope' => null, |
| 136 | + |
| 137 | + /* |
| 138 | + |-------------------------------------------------------------------------- |
| 139 | + | Access Token TTL |
| 140 | + |-------------------------------------------------------------------------- |
| 141 | + | |
| 142 | + | For how long the issued access token is valid (in seconds) |
| 143 | + | this can be also set on a per grant-type basis |
| 144 | + | |
| 145 | + */ |
| 146 | + 'access_token_ttl' => 3600, |
| 147 | + |
| 148 | + /* |
| 149 | + |-------------------------------------------------------------------------- |
| 150 | + | Limit clients to specific grants |
| 151 | + |-------------------------------------------------------------------------- |
| 152 | + | |
| 153 | + | Whether or not to limit clients to specific grant types |
| 154 | + | This is useful to allow only trusted clients to access your API differently |
| 155 | + | |
| 156 | + */ |
| 157 | + 'limit_clients_to_grants' => false, |
| 158 | + |
| 159 | + /* |
| 160 | + |-------------------------------------------------------------------------- |
| 161 | + | Limit clients to specific scopes |
| 162 | + |-------------------------------------------------------------------------- |
| 163 | + | |
| 164 | + | Whether or not to limit clients to specific scopes |
| 165 | + | This is useful to only allow specific clients to use some scopes |
| 166 | + | |
| 167 | + */ |
| 168 | + 'limit_clients_to_scopes' => false, |
| 169 | + |
| 170 | + /* |
| 171 | + |-------------------------------------------------------------------------- |
| 172 | + | Limit scopes to specific grants |
| 173 | + |-------------------------------------------------------------------------- |
| 174 | + | |
| 175 | + | Whether or not to limit scopes to specific grants |
| 176 | + | This is useful to allow certain scopes to be used only with certain grant types |
| 177 | + | |
| 178 | + */ |
| 179 | + 'limit_scopes_to_grants' => false, |
| 180 | + |
| 181 | + /* |
| 182 | + |-------------------------------------------------------------------------- |
| 183 | + | HTTP Header Only |
| 184 | + |-------------------------------------------------------------------------- |
| 185 | + | |
| 186 | + | This will tell the resource server where to check for the access_token. |
| 187 | + | By default it checks both the query string and the http headers |
| 188 | + | |
| 189 | + */ |
| 190 | + 'http_headers_only' => false, |
| 191 | +]; |
0 commit comments