forked from filsh/yii2-oauth2-server
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
femike
committed
Oct 26, 2015
1 parent
19ca9d8
commit 1a02afa
Showing
6 changed files
with
809 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
namespace filsh\yii2\oauth2server\models\mongodb; | ||
|
||
use Yii; | ||
|
||
/** | ||
* This is the model class for table "oauth_access_tokens". | ||
* | ||
* @property \mongoId |string $_id | ||
* @property \mongoId |string $client_id | ||
* @property \mongoId |string $user_id | ||
* @property string $access_token | ||
* @property string $expires | ||
* @property string $scope | ||
* | ||
* @property OauthClients $client | ||
*/ | ||
class OauthAccessTokens extends \yii\mongodb\ActiveRecord | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function collectionName() | ||
{ | ||
return 'oauth_access_tokens'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
* @return array | ||
*/ | ||
public function attributes() | ||
{ | ||
return [ | ||
'_id', | ||
'access_token', | ||
'client_id', | ||
'user_id', | ||
'expires', | ||
'scope' | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function rules() | ||
{ | ||
return [ | ||
[['access_token', 'client_id', 'expires'], 'required'], | ||
[['user_id'], 'integer'], | ||
[['expires'], 'safe'], | ||
[['access_token'], 'string', 'max' => 40], | ||
[['client_id'], 'string', 'max' => 32], | ||
[['scope'], 'string', 'max' => 2000] | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function attributeLabels() | ||
{ | ||
return [ | ||
'access_token' => 'Access Token', | ||
'client_id' => 'Client ID', | ||
'user_id' => 'User ID', | ||
'expires' => 'Expires', | ||
'scope' => 'Scope', | ||
]; | ||
} | ||
|
||
/** | ||
* @return \yii\db\ActiveQuery | ||
*/ | ||
public function getClient() | ||
{ | ||
return $this->hasOne(OauthClients::className(), ['client_id' => 'client_id']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
namespace filsh\yii2\oauth2server\models\mongodb; | ||
|
||
use Yii; | ||
|
||
/** | ||
* This is the model class for table "oauth_authorization_codes". | ||
* | ||
* @property \mongoId |string $_id | ||
* @property \mongoId |string $user_id | ||
* @property string $authorization_code | ||
* @property string $client_id | ||
* @property string $redirect_uri | ||
* @property string $expires | ||
* @property string $scope | ||
* | ||
* @property OauthClients $client | ||
*/ | ||
class OauthAuthorizationCodes extends \yii\mongodb\ActiveRecord | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function collectionName() | ||
{ | ||
return 'oauth_authorization_codes'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
* @return array | ||
*/ | ||
public function attributes() | ||
{ | ||
return [ | ||
'_id', | ||
'authorization_code', | ||
'client_id', | ||
'user_id', | ||
'redirect_uri', | ||
'expires', | ||
'scope' | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function rules() | ||
{ | ||
return [ | ||
[['authorization_code', 'client_id', 'redirect_uri', 'expires'], 'required'], | ||
[['user_id'], 'integer'], | ||
[['expires'], 'safe'], | ||
[['authorization_code'], 'string', 'max' => 40], | ||
[['client_id'], 'string', 'max' => 32], | ||
[['redirect_uri'], 'string', 'max' => 1000], | ||
[['scope'], 'string', 'max' => 2000] | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function attributeLabels() | ||
{ | ||
return [ | ||
'authorization_code' => 'Authorization Code', | ||
'client_id' => 'Client ID', | ||
'user_id' => 'User ID', | ||
'redirect_uri' => 'Redirect Uri', | ||
'expires' => 'Expires', | ||
'scope' => 'Scope', | ||
]; | ||
} | ||
|
||
/** | ||
* @return \yii\db\ActiveQuery | ||
*/ | ||
public function getClient() | ||
{ | ||
return $this->hasOne(OauthClients::className(), ['client_id' => 'client_id']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?php | ||
|
||
namespace filsh\yii2\oauth2server\models\mongodb; | ||
|
||
use Yii; | ||
|
||
/** | ||
* This is the model class for table "oauth_clients". | ||
* | ||
* @property \mongoId |string $_id | ||
* @property \mongoId |string $client_id | ||
* @property \MongoId |string $user_id | ||
* @property string $client_secret | ||
* @property string $redirect_uri | ||
* @property string $grant_types | ||
* @property string $scope | ||
* | ||
* @property OauthAccessTokens[] $oauthAccessTokens | ||
* @property OauthAuthorizationCodes[] $oauthAuthorizationCodes | ||
* @property OauthRefreshTokens[] $oauthRefreshTokens | ||
*/ | ||
class OauthClients extends \yii\mongodb\ActiveRecord | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function collectionName() | ||
{ | ||
return 'oauth_clients'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
* @return array | ||
*/ | ||
public function attributes() | ||
{ | ||
return [ | ||
'_id', | ||
'client_id', | ||
'client_secret', | ||
'redirect_uri', | ||
'grant_types', | ||
'scope', | ||
'user_id' | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function rules() | ||
{ | ||
return [ | ||
[['client_id', 'client_secret', 'redirect_uri', 'grant_types'], 'required'], | ||
[['user_id'], 'string'], | ||
[['client_id', 'client_secret'], 'string', 'max' => 32], | ||
[['redirect_uri'], 'string', 'max' => 1000], | ||
[['grant_types'], 'string', 'max' => 100], | ||
[['scope'], 'string', 'max' => 2000] | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function attributeLabels() | ||
{ | ||
return [ | ||
'client_id' => 'Client ID', | ||
'client_secret' => 'Client Secret', | ||
'redirect_uri' => 'Redirect Uri', | ||
'grant_types' => 'Grant Types', | ||
'scope' => 'Scope', | ||
'user_id' => 'User ID', | ||
]; | ||
} | ||
|
||
/** | ||
* @return \yii\db\ActiveQuery | ||
*/ | ||
public function getOauthAccessTokens() | ||
{ | ||
return $this->hasMany(OauthAccessTokens::className(), ['client_id' => 'client_id']); | ||
} | ||
|
||
/** | ||
* @return \yii\db\ActiveQuery | ||
*/ | ||
public function getOauthAuthorizationCodes() | ||
{ | ||
return $this->hasMany(OauthAuthorizationCodes::className(), ['client_id' => 'client_id']); | ||
} | ||
|
||
/** | ||
* @return \yii\db\ActiveQuery | ||
*/ | ||
public function getOauthRefreshTokens() | ||
{ | ||
return $this->hasMany(OauthRefreshTokens::className(), ['client_id' => 'client_id']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
namespace filsh\yii2\oauth2server\models\mongodb; | ||
|
||
use Yii; | ||
|
||
/** | ||
* This is the model class for table "oauth_refresh_tokens". | ||
* | ||
* @property \mongoId |string $_id | ||
* @property \mongoId |string $client_id | ||
* @property \mongoId |string $user_id | ||
* @property string $refresh_token | ||
* @property string $expires | ||
* @property string $scope | ||
* | ||
* @property OauthClients $client | ||
*/ | ||
class OauthRefreshTokens extends \yii\mongodb\ActiveRecord | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function collectionName() | ||
{ | ||
return 'oauth_refresh_tokens'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function rules() | ||
{ | ||
return [ | ||
[['refresh_token', 'client_id', 'expires'], 'required'], | ||
[['user_id'], 'integer'], | ||
[['expires'], 'safe'], | ||
[['refresh_token'], 'string', 'max' => 40], | ||
[['client_id'], 'string', 'max' => 32], | ||
[['scope'], 'string', 'max' => 2000] | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function attributeLabels() | ||
{ | ||
return [ | ||
'refresh_token' => 'Refresh Token', | ||
'client_id' => 'Client ID', | ||
'user_id' => 'User ID', | ||
'expires' => 'Expires', | ||
'scope' => 'Scope', | ||
]; | ||
} | ||
|
||
/** | ||
* @return \yii\db\ActiveQuery | ||
*/ | ||
public function getClient() | ||
{ | ||
return $this->hasOne(OauthClients::className(), ['client_id' => 'client_id']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace filsh\yii2\oauth2server\models\mongodb; | ||
|
||
use Yii; | ||
|
||
/** | ||
* This is the model class for table "oauth_scopes". | ||
* | ||
* @property \mongoId |string $_id | ||
* @property string $scope | ||
* @property integer $is_default | ||
* | ||
*/ | ||
class OauthScopes extends \yii\mongodb\ActiveRecord | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function collectionName() | ||
{ | ||
return 'oauth_scopes'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function rules() | ||
{ | ||
return [ | ||
[['scope', 'is_default'], 'required'], | ||
[['is_default'], 'integer'], | ||
[['scope'], 'string', 'max' => 2000] | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function attributeLabels() | ||
{ | ||
return [ | ||
'scope' => 'Scope', | ||
'is_default' => 'Is Default', | ||
]; | ||
} | ||
} |
Oops, something went wrong.