1 | <?php |
||
17 | class Client extends DataObject |
||
18 | { |
||
19 | private static $table_name = 'OauthClient'; |
||
|
|||
20 | |||
21 | private static $db = [ |
||
22 | 'Name' => 'Varchar(100)', |
||
23 | 'Grants' => 'Varchar(255)', |
||
24 | 'Secret' => 'Varchar(255)' |
||
25 | ]; |
||
26 | |||
27 | private static $summary_fields = [ |
||
28 | 'Name' |
||
29 | ]; |
||
30 | |||
31 | /** |
||
32 | * Checks whether this ClientEntity has the given grant type. |
||
33 | * |
||
34 | * @param string $grantType The grant type to check. |
||
35 | * |
||
36 | * @return boolean |
||
37 | */ |
||
38 | public function hasGrantType($grantType) |
||
44 | |||
45 | /** |
||
46 | * On before write. Generate a secret if we don't have one. |
||
47 | */ |
||
48 | public function onBeforeWrite() |
||
56 | |||
57 | /** |
||
58 | * Generate a random secret. |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | protected function generateSecret() |
||
66 | } |
||
67 |