mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: implement OAuth 2.0 login flow
This commit is contained in:
@@ -17,4 +17,5 @@ return [
|
||||
ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
|
||||
Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
|
||||
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
|
||||
KnpU\OAuth2ClientBundle\KnpUOAuth2ClientBundle::class => ['all' => true],
|
||||
];
|
||||
|
||||
14
config/packages/knpu_oauth2_client.yaml
Normal file
14
config/packages/knpu_oauth2_client.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
knpu_oauth2_client:
|
||||
clients:
|
||||
oauth:
|
||||
type: generic
|
||||
provider_class: App\Security\OAuthProvider
|
||||
client_id: '%env(OAUTH_CLIENT_ID)%'
|
||||
client_secret: '%env(OAUTH_CLIENT_SECRET)%'
|
||||
redirect_route: oauth_connect_check
|
||||
redirect_params: {}
|
||||
provider_options:
|
||||
baseAuthorizationUrl: '%env(OAUTH_AUTHORIZATION_URL)%'
|
||||
baseAccessTokenUrl: '%env(OAUTH_TOKEN_URL)%'
|
||||
resourceOwnerDetailsUrl: '%env(OAUTH_USERINFO_URL)%'
|
||||
scope: '%env(OAUTH_SCOPE)%'
|
||||
@@ -13,7 +13,8 @@ security:
|
||||
dev:
|
||||
pattern: ^/(_(profiler|wdt)|css|images|js)/
|
||||
security: false
|
||||
login:
|
||||
|
||||
api_login:
|
||||
pattern: ^/api/login
|
||||
stateless: true
|
||||
json_login:
|
||||
@@ -26,6 +27,10 @@ security:
|
||||
stateless: true
|
||||
jwt: ~
|
||||
|
||||
main:
|
||||
custom_authenticators:
|
||||
- App\Security\OAuthAuthenticator
|
||||
|
||||
# activate different ways to authenticate
|
||||
# https://symfony.com/doc/current/security.html#the-firewall
|
||||
|
||||
|
||||
@@ -6,3 +6,6 @@ controllers:
|
||||
|
||||
api_login:
|
||||
path: /api/login
|
||||
|
||||
oauth_connect_check:
|
||||
path: /login/oauth/check
|
||||
|
||||
Reference in New Issue
Block a user