-
Notifications
You must be signed in to change notification settings - Fork 949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Phalcon storage #743
Open
lucasantarella
wants to merge
19
commits into
bshaffer:develop
Choose a base branch
from
lucasantarella:phalcon-storage
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Phalcon storage #743
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
d68233e
Added all Phalcon models and the storage controller
lucasantarella 074d366
Updated Oauth logic to be compliant with the standard
lucasantarella eedce8f
Updated namespaces
lucasantarella 04f183e
Cleaned up code to be consistent and pretty
lucasantarella a0a289e
Added PRIMARY KEY to the Build SQL
lucasantarella 2173560
Fixed syntax error
lucasantarella ced15f3
Reformatted for consistency
lucasantarella 835b318
Fixed namespace problem
lucasantarella cf3a157
Changed table names to conform to the PDO class table names
lucasantarella 4d77748
Added base Phalcon test
lucasantarella f18eb47
Phalcon travis ci config (#1)
lucasantarella cfd5166
Revert "Phalcon travis ci config (#1)"
lucasantarella fa994c1
Phalcon travis ci config (#2)
lucasantarella 5d1cf4b
Using function instead of class object (#3)
lucasantarella 4f90609
Using old array syntax for compatibility with PHP 5.3
lucasantarella 97d6f14
Updated travis config
lucasantarella ab1d2bd
All php 5.3 versions
lucasantarella 122aebd
Requiring Phalcon extension
lucasantarella a016904
Requiring Phalcon extension for autoload
lucasantarella File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,97 @@ | ||
<?php | ||
|
||
namespace OAuth2\Storage\Phalcon\Models; | ||
|
||
class OauthAccessTokens extends \Phalcon\Mvc\Model | ||
{ | ||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $access_token; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $client_id; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $user_id; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $expires; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $scope; | ||
|
||
/** | ||
* Allows to query a set of records that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return OauthAccessTokens[] | ||
*/ | ||
public static function find($parameters = null) | ||
{ | ||
return parent::find($parameters); | ||
} | ||
|
||
/** | ||
* Allows to query the first record that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return OauthAccessTokens | ||
*/ | ||
public static function findFirst($parameters = null) | ||
{ | ||
return parent::findFirst($parameters); | ||
} | ||
|
||
/** | ||
* Initialize method for model. | ||
*/ | ||
public function initialize() | ||
{ | ||
$this->setSource("'oauth__access_tokens'"); | ||
$this->belongsTo('user_id', 'OAuth2\Storage\Models\OauthUsers', 'username', array("alias" => "User")); | ||
$this->belongsTo('client_id', 'OAuth2\Storage\Models\OauthClients', 'client_id', array("alias" => "Client")); | ||
} | ||
|
||
/** | ||
* Returns table name mapped in the model. | ||
* | ||
* @return string | ||
*/ | ||
public function getSource() | ||
{ | ||
return 'oauth__access_tokens'; | ||
} | ||
|
||
/** | ||
* @param mixed $parameters | ||
* @return \OAuth2\Storage\Models\OauthUsers | ||
*/ | ||
public function getUser($parameters = null) | ||
{ | ||
return $this->getRelated('User', $parameters); | ||
} | ||
|
||
/** | ||
* @param mixed $parameters | ||
* @return \OAuth2\Storage\Models\OauthClients | ||
*/ | ||
public function getClient($parameters = null) | ||
{ | ||
return $this->getRelated('Client', $parameters); | ||
} | ||
|
||
} |
82 changes: 82 additions & 0 deletions
82
src/OAuth2/Storage/Phalcon/Models/OauthAuthorizationCodes.php
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,82 @@ | ||
<?php | ||
|
||
namespace OAuth2\Storage\Phalcon\Models; | ||
|
||
class OauthAuthorizationCodes extends \Phalcon\Mvc\Model | ||
{ | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $authorization_code; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $client_id; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $user_id; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $redirect_uri; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $expires; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $scope; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $id_token; | ||
|
||
/** | ||
* Returns table name mapped in the model. | ||
* | ||
* @return string | ||
*/ | ||
public function getSource() | ||
{ | ||
return 'oauth__authorization_codes'; | ||
} | ||
|
||
/** | ||
* Allows to query a set of records that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return OauthAuthorizationCodes[] | ||
*/ | ||
public static function find($parameters = null) | ||
{ | ||
return parent::find($parameters); | ||
} | ||
|
||
/** | ||
* Allows to query the first record that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return OauthAuthorizationCodes | ||
*/ | ||
public static function findFirst($parameters = null) | ||
{ | ||
return parent::findFirst($parameters); | ||
} | ||
|
||
} |
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,92 @@ | ||
<?php | ||
|
||
namespace OAuth2\Storage\Phalcon\Models; | ||
|
||
class OauthClients extends \Phalcon\Mvc\Model | ||
{ | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $client_id; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $client_secret; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $redirect_uri; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $grant_types; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $scope; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $user_id; | ||
|
||
/** | ||
* Initialize method for model. | ||
*/ | ||
public function initialize() | ||
{ | ||
$this->setSource("'oauth__clients'"); | ||
$this->belongsTo('user_id', 'OAuth2\Storage\Models\OauthUsers', 'username', array("alias" => "User")); | ||
} | ||
|
||
/** | ||
* Returns table name mapped in the model. | ||
* | ||
* @return string | ||
*/ | ||
public function getSource() | ||
{ | ||
return 'oauth__clients'; | ||
} | ||
|
||
/** | ||
* Allows to query a set of records that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return OauthClients[] | ||
*/ | ||
public static function find($parameters = null) | ||
{ | ||
return parent::find($parameters); | ||
} | ||
|
||
/** | ||
* Allows to query the first record that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return OauthClients | ||
*/ | ||
public static function findFirst($parameters = null) | ||
{ | ||
return parent::findFirst($parameters); | ||
} | ||
|
||
/** | ||
* @param mixed $parameters | ||
* @return OauthUsers | ||
*/ | ||
public function getUser($parameters = null){ | ||
return $this->getRelated('User', $parameters); | ||
} | ||
} |
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,70 @@ | ||
<?php | ||
|
||
namespace OAuth2\Storage\Phalcon\Models; | ||
|
||
class OauthJti extends \Phalcon\Mvc\Model | ||
{ | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $issuer; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $subject; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $audience; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $expires; | ||
|
||
/** | ||
* | ||
* @var string | ||
*/ | ||
public $jti; | ||
|
||
/** | ||
* Returns table name mapped in the model. | ||
* | ||
* @return string | ||
*/ | ||
public function getSource() | ||
{ | ||
return 'oauth__jti'; | ||
} | ||
|
||
/** | ||
* Allows to query a set of records that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return OauthJti[] | ||
*/ | ||
public static function find($parameters = null) | ||
{ | ||
return parent::find($parameters); | ||
} | ||
|
||
/** | ||
* Allows to query the first record that match the specified conditions | ||
* | ||
* @param mixed $parameters | ||
* @return OauthJti | ||
*/ | ||
public static function findFirst($parameters = null) | ||
{ | ||
return parent::findFirst($parameters); | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
brace should be on a new line