-
Notifications
You must be signed in to change notification settings - Fork 4
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
認証認可の関連仕様について #57
Comments
API プラグインに以下のパッチを適用することで、 Resource owner password credentials grant でアクセストークンを取得可能なのを確認。 diff --git a/Controller/Admin/OAuthController.php b/Controller/Admin/OAuthController.php
index ab49663..0234969 100644
--- a/Controller/Admin/OAuthController.php
+++ b/Controller/Admin/OAuthController.php
@@ -17,7 +17,7 @@ use Eccube\Controller\AbstractController;
use Exception;
use Plugin\Api42\Form\Type\Admin\ClientType;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
-use Symfony\Component\Form\FormInterface;
+use Eccube\Form\Form;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
@@ -108,7 +108,7 @@ class OAuthController extends AbstractController
$secret = $form->get('secret')->getData();
try {
- $client = new Client($name, $identifier, $secret);
+ $client = new Client($name, $identifier, null);
$client = $this->updateClientFromForm($client, $form);
$this->clientManager->save($client);
@@ -193,11 +193,11 @@ class OAuthController extends AbstractController
/**
* @param Client $client
- * @param FormInterface $form
+ * @param Form $form
*
* @return Client
*/
- private function updateClientFromForm(Client $client, FormInterface $form): Client
+ private function updateClientFromForm(Client $client, Form $form): Client
{
$client->setActive(true);
@@ -209,16 +209,21 @@ class OAuthController extends AbstractController
);
$client->setRedirectUris(...$redirectUris);
- $grants = array_map(
- function (string $grant): Grant {
- return new Grant($grant);
- },
- $form->get('grants')->getData()
- );
+ // $grants = array_map(
+ // function (string $grant): Grant {
+ // return new Grant($grant);
+ // },
+ // $form->get('grants')->getData()
+ // );
// authorization code grant が選択されていた場合には refresh token grant も付与
- if (in_array(OAuth2Grants::AUTHORIZATION_CODE, $grants)) {
- array_push($grants, new Grant(OAuth2Grants::REFRESH_TOKEN));
- }
+ // if (in_array(OAuth2Grants::AUTHORIZATION_CODE, $grants)) {
+ // array_push($grants, new Grant(OAuth2Grants::REFRESH_TOKEN));
+ // }
+ $grants = [
+ new Grant(OAuth2Grants::PASSWORD),
+ new Grant(OAuth2Grants::REFRESH_TOKEN)
+ ];
+ array_push($grants, new Grant(OAuth2Grants::REFRESH_TOKEN));
$client->setGrants(...$grants);
$scopes = array_map(
diff --git a/Resource/config/services.yaml b/Resource/config/services.yaml
index a562b9b..33363a1 100644
--- a/Resource/config/services.yaml
+++ b/Resource/config/services.yaml
@@ -17,7 +17,7 @@ league_oauth2_server:
enable_client_credentials_grant: false
# Whether to enable the password grant
- enable_password_grant: false
+ enable_password_grant: true
# Whether to enable the refresh token grant
enable_refresh_token_grant: true
@@ -41,7 +41,7 @@ league_oauth2_server:
services:
Plugin\Api42\EventListener\UserResolveListener:
arguments:
- - '@Eccube\Security\Core\User\MemberProvider'
+ - '@Eccube\Security\Core\User\CustomerProvider'
- '@Eccube\Security\Core\User\UserPasswordHasher'
tags:
- { name: kernel.event_listener, event: league.oauth2_server.event.user_resolve, method: onUserResolve }
|
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
以下の3点を分けて考える必要がある
課題
--public
オプションで client_secret 不要になる模様参考サイト
The text was updated successfully, but these errors were encountered: