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