This commit is contained in:
Diogo Peralta Cordeiro 2022-01-15 19:40:55 +00:00
parent 737648359d
commit 53a1a3fad1
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
3 changed files with 15 additions and 5 deletions

View File

@ -21,8 +21,16 @@ security:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
oauth_token:
pattern: ^/oauth/(token|authorize)$
pattern: ^/oauth/token$
security: false
oauth_authorize:
pattern: ^/oauth/authorize$
security: true
entry_point: App\Security\Authenticator
guard:
authenticators:
- App\Security\Authenticator
provider: local_user
oauth:
guard:
authenticators:

View File

@ -81,6 +81,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
use SymfonyCasts\Bundle\ResetPassword\ResetPasswordHelperInterface;
use SymfonyCasts\Bundle\VerifyEmail\VerifyEmailHelperInterface;
use Trikoder\Bundle\OAuth2Bundle\Event\UserResolveEvent;
use Trikoder\Bundle\OAuth2Bundle\OAuth2Events;
use Twig\Environment;
/**
@ -294,7 +295,7 @@ class GNUsocial implements EventSubscriberInterface
return [
KernelEvents::REQUEST => 'onKernelRequest',
'console.command' => 'onCommand',
'trikoder.oauth2.user_resolve' => 'userResolve',
OAuth2Events::USER_RESOLVE => 'userResolve',
];
}
}

View File

@ -74,7 +74,8 @@ class Authenticator extends AbstractFormLoginAuthenticator implements Authentica
public function supports(Request $request): bool
{
return self::LOGIN_ROUTE === $request->attributes->get('_route') && $request->isMethod('POST');
return (self::LOGIN_ROUTE === $request->attributes->get('_route') && $request->isMethod('POST'))
|| ('oauth2_authorize' === $request->attributes->get('_route'));
}
/**