Skip to content
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

Implementation to use interfaces for actions, so that they may be ove… #22

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/base/Oauth2BaseModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,19 @@
use rhertogh\Yii2Oauth2Server\components\server\Oauth2AuthorizationServer;
use rhertogh\Yii2Oauth2Server\components\server\Oauth2ResourceServer;
use rhertogh\Yii2Oauth2Server\components\server\responses\Oauth2BearerTokenResponse;
use rhertogh\Yii2Oauth2Server\controllers\web\certificates\Oauth2JwksAction;
use rhertogh\Yii2Oauth2Server\controllers\web\consent\Oauth2AuthorizeClientAction;
use rhertogh\Yii2Oauth2Server\controllers\web\Oauth2CertificatesController;
use rhertogh\Yii2Oauth2Server\controllers\web\Oauth2ConsentController;
use rhertogh\Yii2Oauth2Server\controllers\web\Oauth2OidcController;
use rhertogh\Yii2Oauth2Server\controllers\web\Oauth2ServerController;
use rhertogh\Yii2Oauth2Server\controllers\web\Oauth2WellKnownController;
use rhertogh\Yii2Oauth2Server\controllers\web\openidconnect\Oauth2OidcEndSessionAction;
use rhertogh\Yii2Oauth2Server\controllers\web\openidconnect\Oauth2OidcUserinfoAction;
use rhertogh\Yii2Oauth2Server\controllers\web\server\Oauth2AccessTokenAction;
use rhertogh\Yii2Oauth2Server\controllers\web\server\Oauth2AuthorizeAction;
use rhertogh\Yii2Oauth2Server\controllers\web\server\Oauth2RevokeAction;
use rhertogh\Yii2Oauth2Server\controllers\web\wellknown\Oauth2OpenidConfigurationAction;
use rhertogh\Yii2Oauth2Server\interfaces\components\authorization\Oauth2ClientAuthorizationRequestInterface;
use rhertogh\Yii2Oauth2Server\interfaces\components\authorization\Oauth2ScopeAuthorizationRequestInterface;
use rhertogh\Yii2Oauth2Server\interfaces\components\encryption\Oauth2CryptographerInterface;
Expand Down Expand Up @@ -70,11 +78,19 @@
use rhertogh\Yii2Oauth2Server\interfaces\components\server\Oauth2AuthorizationServerInterface;
use rhertogh\Yii2Oauth2Server\interfaces\components\server\Oauth2ResourceServerInterface;
use rhertogh\Yii2Oauth2Server\interfaces\components\server\responses\Oauth2BearerTokenResponseInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\certificates\Oauth2JwksActionInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\consent\Oauth2AuthorizeClientActionInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\Oauth2CertificatesControllerInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\Oauth2ConsentControllerInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\Oauth2OidcControllerInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\Oauth2ServerControllerInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\Oauth2WellKnownControllerInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\openidconnect\Oauth2OidcEndSessionActionInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\openidconnect\Oauth2OidcUserinfoActionInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\server\Oauth2AccessTokenActionInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\server\Oauth2AuthorizeActionInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\server\Oauth2RevokeActionInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\wellknown\Oauth2OpenidConfigurationActionInterface;
use rhertogh\Yii2Oauth2Server\interfaces\models\external\user\Oauth2OidcUserInterface;
use rhertogh\Yii2Oauth2Server\interfaces\models\Oauth2AccessTokenInterface;
use rhertogh\Yii2Oauth2Server\interfaces\models\Oauth2AccessTokenScopeInterface;
Expand Down Expand Up @@ -320,6 +336,15 @@ abstract class Oauth2BaseModule extends Module
Oauth2WellKnownControllerInterface::class => Oauth2WellKnownController::class,
Oauth2CertificatesControllerInterface::class => Oauth2CertificatesController::class,
Oauth2OidcControllerInterface::class => Oauth2OidcController::class,
# Actions
Oauth2OpenidConfigurationActionInterface::class => Oauth2OpenidConfigurationAction::class,
Oauth2RevokeActionInterface::class => Oauth2RevokeAction::class,
Oauth2AuthorizeActionInterface::class => Oauth2AuthorizeAction::class,
Oauth2AccessTokenActionInterface::class => Oauth2AccessTokenAction::class,
Oauth2OidcUserinfoActionInterface::class => Oauth2OidcUserinfoAction::class,
Oauth2OidcEndSessionActionInterface::class => Oauth2OidcEndSessionAction::class,
Oauth2AuthorizeClientActionInterface::class => Oauth2AuthorizeClientAction::class,
Oauth2JwksActionInterface::class => Oauth2JwksAction::class,
# Components (Server)
Oauth2AuthorizationServerInterface::class => Oauth2AuthorizationServer::class,
Oauth2ResourceServerInterface::class => Oauth2ResourceServer::class,
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/web/Oauth2CertificatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace rhertogh\Yii2Oauth2Server\controllers\web;

use rhertogh\Yii2Oauth2Server\controllers\web\base\Oauth2BaseApiController;
use rhertogh\Yii2Oauth2Server\controllers\web\certificates\Oauth2JwksAction;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\certificates\Oauth2JwksActionInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\Oauth2CertificatesControllerInterface;
use yii\filters\VerbFilter;
use yii\helpers\ArrayHelper;
Expand Down Expand Up @@ -31,7 +31,7 @@ public function behaviors()
public function actions()
{
return [
static::ACTION_NAME_JWKS => Oauth2JwksAction::class,
static::ACTION_NAME_JWKS => Oauth2JwksActionInterface::class,
];
}
}
4 changes: 2 additions & 2 deletions src/controllers/web/Oauth2ConsentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace rhertogh\Yii2Oauth2Server\controllers\web;

use rhertogh\Yii2Oauth2Server\controllers\web\base\Oauth2BaseWebController;
use rhertogh\Yii2Oauth2Server\controllers\web\consent\Oauth2AuthorizeClientAction;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\consent\Oauth2AuthorizeClientActionInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\Oauth2ConsentControllerInterface;
use yii\filters\VerbFilter;

Expand Down Expand Up @@ -31,7 +31,7 @@ public function actions()
{
return [
static::ACTION_NAME_AUTHORIZE_CLIENT => [
'class' => Oauth2AuthorizeClientAction::class,
'class' => Oauth2AuthorizeClientActionInterface::class,
'clientAuthorizationView' => $this->module->clientAuthorizationView,
],
];
Expand Down
8 changes: 4 additions & 4 deletions src/controllers/web/Oauth2OidcController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace rhertogh\Yii2Oauth2Server\controllers\web;

use rhertogh\Yii2Oauth2Server\controllers\web\base\Oauth2BaseApiController;
use rhertogh\Yii2Oauth2Server\controllers\web\openidconnect\Oauth2OidcEndSessionAction;
use rhertogh\Yii2Oauth2Server\controllers\web\openidconnect\Oauth2OidcUserinfoAction;
use rhertogh\Yii2Oauth2Server\filters\auth\Oauth2HttpBearerAuth;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\Oauth2OidcControllerInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\openidconnect\Oauth2OidcEndSessionActionInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\openidconnect\Oauth2OidcUserinfoActionInterface;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
use yii\helpers\ArrayHelper;
Expand Down Expand Up @@ -53,8 +53,8 @@ public function behaviors()
public function actions()
{
return [
static::ACTION_NAME_USERINFO => Oauth2OidcUserinfoAction::class,
static::ACTION_END_SESSION => Oauth2OidcEndSessionAction::class,
static::ACTION_NAME_USERINFO => Oauth2OidcUserinfoActionInterface::class,
static::ACTION_END_SESSION => Oauth2OidcEndSessionActionInterface::class,
];
}
}
12 changes: 6 additions & 6 deletions src/controllers/web/Oauth2ServerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace rhertogh\Yii2Oauth2Server\controllers\web;

use rhertogh\Yii2Oauth2Server\controllers\web\base\Oauth2BaseApiController;
use rhertogh\Yii2Oauth2Server\controllers\web\server\Oauth2AccessTokenAction;
use rhertogh\Yii2Oauth2Server\controllers\web\server\Oauth2AuthorizeAction;
use rhertogh\Yii2Oauth2Server\controllers\web\server\Oauth2RevokeAction;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\server\Oauth2AccessTokenActionInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\server\Oauth2AuthorizeActionInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\server\Oauth2RevokeActionInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\Oauth2ServerControllerInterface;
use yii\filters\VerbFilter;
use yii\helpers\ArrayHelper;
Expand Down Expand Up @@ -35,9 +35,9 @@ public function behaviors()
public function actions()
{
return [
static::ACTION_NAME_ACCESS_TOKEN => Oauth2AccessTokenAction::class,
static::ACTION_NAME_AUTHORIZE => Oauth2AuthorizeAction::class,
static::ACTION_NAME_REVOKE => Oauth2RevokeAction::class,
static::ACTION_NAME_ACCESS_TOKEN => Oauth2AccessTokenActionInterface::class,
static::ACTION_NAME_AUTHORIZE => Oauth2AuthorizeActionInterface::class,
static::ACTION_NAME_REVOKE => Oauth2RevokeActionInterface::class,
];
}
}
4 changes: 2 additions & 2 deletions src/controllers/web/Oauth2WellKnownController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace rhertogh\Yii2Oauth2Server\controllers\web;

use rhertogh\Yii2Oauth2Server\controllers\web\base\Oauth2BaseApiController;
use rhertogh\Yii2Oauth2Server\controllers\web\wellknown\Oauth2OpenidConfigurationAction;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\Oauth2WellKnownControllerInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\wellknown\Oauth2OpenidConfigurationActionInterface;
use yii\filters\VerbFilter;
use yii\helpers\ArrayHelper;

Expand All @@ -31,7 +31,7 @@ public function behaviors()
public function actions()
{
return [
static::ACTION_NAME_OPENID_CONFIGURATION => Oauth2OpenidConfigurationAction::class,
static::ACTION_NAME_OPENID_CONFIGURATION => Oauth2OpenidConfigurationActionInterface::class,
];
}
}
3 changes: 2 additions & 1 deletion src/controllers/web/certificates/Oauth2JwksAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
use Jose\Component\Core\JWKSet;
use rhertogh\Yii2Oauth2Server\controllers\web\base\Oauth2BaseWebAction;
use rhertogh\Yii2Oauth2Server\controllers\web\Oauth2CertificatesController;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\certificates\Oauth2JwksActionInterface;
use yii\base\InvalidConfigException;
use yii\helpers\StringHelper;

/**
* @property Oauth2CertificatesController $controller
*/
class Oauth2JwksAction extends Oauth2BaseWebAction
class Oauth2JwksAction extends Oauth2BaseWebAction implements Oauth2JwksActionInterface
{
/**
* RFC7517: JSON Web Key (JWK)
Expand Down
3 changes: 2 additions & 1 deletion src/controllers/web/consent/Oauth2AuthorizeClientAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use rhertogh\Yii2Oauth2Server\controllers\web\base\Oauth2BaseWebAction;
use rhertogh\Yii2Oauth2Server\controllers\web\Oauth2ConsentController;
use rhertogh\Yii2Oauth2Server\exceptions\Oauth2ServerHttpException;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\consent\Oauth2AuthorizeClientActionInterface;
use Yii;
use yii\base\InvalidConfigException;
use yii\web\BadRequestHttpException;
Expand All @@ -14,7 +15,7 @@
/**
* @property Oauth2ConsentController $controller
*/
class Oauth2AuthorizeClientAction extends Oauth2BaseWebAction
class Oauth2AuthorizeClientAction extends Oauth2BaseWebAction implements Oauth2AuthorizeClientActionInterface
{
/**
* Path to view file for client authorization.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use rhertogh\Yii2Oauth2Server\controllers\web\base\Oauth2BaseWebAction;
use rhertogh\Yii2Oauth2Server\controllers\web\Oauth2OidcController;
use rhertogh\Yii2Oauth2Server\helpers\UrlHelper;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\openidconnect\Oauth2OidcEndSessionActionInterface;
use rhertogh\Yii2Oauth2Server\interfaces\models\external\user\Oauth2OidcUserInterface;
use rhertogh\Yii2Oauth2Server\interfaces\models\Oauth2ClientInterface;
use Yii;
Expand All @@ -26,7 +27,7 @@
/**
* @property Oauth2OidcController $controller
*/
class Oauth2OidcEndSessionAction extends Oauth2BaseWebAction
class Oauth2OidcEndSessionAction extends Oauth2BaseWebAction implements Oauth2OidcEndSessionActionInterface
{
/**
* @see https://openid.net/specs/openid-connect-rpinitiated-1_0.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use rhertogh\Yii2Oauth2Server\interfaces\components\openidconnect\request\Oauth2OidcAuthenticationRequestInterface;
use rhertogh\Yii2Oauth2Server\interfaces\components\openidconnect\scope\Oauth2OidcClaimInterface;
use rhertogh\Yii2Oauth2Server\interfaces\components\openidconnect\scope\Oauth2OidcScopeInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\openidconnect\Oauth2OidcUserinfoActionInterface;
use rhertogh\Yii2Oauth2Server\interfaces\models\external\user\Oauth2OidcUserInterface;
use rhertogh\Yii2Oauth2Server\Oauth2Module;
use Yii;
Expand All @@ -17,7 +18,7 @@
/**
* @property Oauth2OidcController $controller
*/
class Oauth2OidcUserinfoAction extends Oauth2BaseWebAction
class Oauth2OidcUserinfoAction extends Oauth2BaseWebAction implements Oauth2OidcUserinfoActionInterface
{
/**
* @see https://openid.net/specs/openid-connect-core-1_0.html#UserInfo
Expand Down
3 changes: 2 additions & 1 deletion src/controllers/web/server/Oauth2AccessTokenAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
use rhertogh\Yii2Oauth2Server\controllers\web\Oauth2ServerController;
use rhertogh\Yii2Oauth2Server\controllers\web\server\base\Oauth2BaseServerAction;
use rhertogh\Yii2Oauth2Server\helpers\Psr7Helper;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\server\Oauth2AccessTokenActionInterface;
use Yii;
use yii\web\HttpException;

/**
* @property Oauth2ServerController $controller
*/
class Oauth2AccessTokenAction extends Oauth2BaseServerAction
class Oauth2AccessTokenAction extends Oauth2BaseServerAction implements Oauth2AccessTokenActionInterface
{
/**
* @throws HttpException
Expand Down
3 changes: 2 additions & 1 deletion src/controllers/web/server/Oauth2AuthorizeAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use rhertogh\Yii2Oauth2Server\interfaces\components\openidconnect\request\Oauth2OidcAuthenticationRequestInterface;
use rhertogh\Yii2Oauth2Server\interfaces\components\openidconnect\scope\Oauth2OidcScopeInterface;
use rhertogh\Yii2Oauth2Server\interfaces\components\openidconnect\user\Oauth2OidcUserComponentInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\server\Oauth2AuthorizeActionInterface;
use rhertogh\Yii2Oauth2Server\interfaces\models\external\user\Oauth2UserAuthenticatedAtInterface;
use rhertogh\Yii2Oauth2Server\interfaces\models\Oauth2ClientInterface;
use rhertogh\Yii2Oauth2Server\Oauth2Module;
Expand All @@ -24,7 +25,7 @@
/**
* @property Oauth2ServerController $controller
*/
class Oauth2AuthorizeAction extends Oauth2BaseServerAction
class Oauth2AuthorizeAction extends Oauth2BaseServerAction implements Oauth2AuthorizeActionInterface
{
public function run($clientAuthorizationRequestId = null)
{
Expand Down
3 changes: 2 additions & 1 deletion src/controllers/web/server/Oauth2RevokeAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use rhertogh\Yii2Oauth2Server\controllers\web\Oauth2ServerController;
use rhertogh\Yii2Oauth2Server\controllers\web\server\base\Oauth2BaseServerAction;
use rhertogh\Yii2Oauth2Server\helpers\Oauth2RequestHelper;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\server\Oauth2RevokeActionInterface;
use rhertogh\Yii2Oauth2Server\Oauth2Module;
use Yii;
use yii\helpers\Json;
Expand All @@ -21,7 +22,7 @@
/**
* @property Oauth2ServerController $controller
*/
class Oauth2RevokeAction extends Oauth2BaseServerAction
class Oauth2RevokeAction extends Oauth2BaseServerAction implements Oauth2RevokeActionInterface
{
public function run()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\Oauth2CertificatesControllerInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\Oauth2OidcControllerInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\Oauth2ServerControllerInterface;
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\wellknown\Oauth2OpenidConfigurationActionInterface;
use Yii;
use yii\helpers\Url;
use yii\web\ForbiddenHttpException;

/**
* @property Oauth2WellKnownController $controller
*/
class Oauth2OpenidConfigurationAction extends Oauth2BaseWebAction
class Oauth2OpenidConfigurationAction extends Oauth2BaseWebAction implements Oauth2OpenidConfigurationActionInterface
{
/**
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace rhertogh\Yii2Oauth2Server\interfaces\controllers\web\certificates;

interface Oauth2JwksActionInterface
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace rhertogh\Yii2Oauth2Server\interfaces\controllers\web\consent;

interface Oauth2AuthorizeClientActionInterface
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace rhertogh\Yii2Oauth2Server\interfaces\controllers\web\openidconnect;

interface Oauth2OidcEndSessionActionInterface
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace rhertogh\Yii2Oauth2Server\interfaces\controllers\web\openidconnect;

interface Oauth2OidcUserinfoActionInterface
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace rhertogh\Yii2Oauth2Server\interfaces\controllers\web\server;

interface Oauth2AccessTokenActionInterface
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace rhertogh\Yii2Oauth2Server\interfaces\controllers\web\server;

interface Oauth2AuthorizeActionInterface
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace rhertogh\Yii2Oauth2Server\interfaces\controllers\web\server;

interface Oauth2RevokeActionInterface
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace rhertogh\Yii2Oauth2Server\interfaces\controllers\web\wellknown;

interface Oauth2OpenidConfigurationActionInterface
{
}
Loading