diff options
| author | Marcus Eibrink-Lunzenauer <lunzenauer@elan-ev.de> | 2022-07-15 11:47:35 +0000 |
|---|---|---|
| committer | Marcus Eibrink-Lunzenauer <lunzenauer@elan-ev.de> | 2022-07-15 11:47:35 +0000 |
| commit | 55852ef4819e5eafce9ae53dc4de2d84cdad1778 (patch) | |
| tree | 9aedcdf89f416a7936f7df80da339a537082b5d5 /lib/classes/OAuth2/Models/AuthCode.php | |
| parent | a9585dad3547a4ebbadd00f44065f95017d18684 (diff) | |
StEP-366: Add OAuth2 support to Stud.IP
Closes #1035 and #1198
Merge request studip/studip!635
Diffstat (limited to 'lib/classes/OAuth2/Models/AuthCode.php')
| -rw-r--r-- | lib/classes/OAuth2/Models/AuthCode.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/classes/OAuth2/Models/AuthCode.php b/lib/classes/OAuth2/Models/AuthCode.php new file mode 100644 index 0000000..1a43c8c --- /dev/null +++ b/lib/classes/OAuth2/Models/AuthCode.php @@ -0,0 +1,35 @@ +<?php + +namespace Studip\OAuth2\Models; + +/** + * @property int $id + * @property string $user_id + * @property string $client_id + * @property string $scopes + * @property bool $revoked + * @property int $expires_at + * @property int $mkdate + * @property int $chdate + */ +class AuthCode extends \SimpleORMap +{ + use RevokedHelper; + + protected static function configure($config = []) + { + $config['db_table'] = 'oauth2_auth_codes'; + + $config['belongs_to']['client'] = [ + 'class_name' => Client::class, + 'foreign_key' => 'client_id', + ]; + + $config['belongs_to']['user'] = [ + 'class_name' => \User::class, + 'foreign_key' => 'user_id', + ]; + + parent::configure($config); + } +} |
