opcoding / azure-active-directory
Installs: 211
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 1
Open Issues: 8
Type:project
Requires
- php: ^7.2.0
- doctrine/orm: ^2.6
- knpuniversity/oauth2-client-bundle: ^1.25
- symfony/security-bundle: 4.*
- symfony/validator: 4.*
- symfony/yaml: 4.*
- thenetworg/oauth2-azure: ^1.4
- dev-master
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-dependabot/composer/symfony/security-bundle-4.4.50
- dev-dependabot/composer/guzzlehttp/guzzle-6.5.8
- dev-dependabot/composer/guzzlehttp/psr7-1.8.5
- dev-dependabot/composer/symfony/security-core-4.4.23
- dev-dependabot/composer/symfony/security-guard-4.4.23
- dev-dependabot/composer/symfony/security-http-4.4.22
- dev-dependabot/composer/symfony/http-kernel-4.4.13
- dev-dependabot/composer/symfony/http-foundation-5.0.7
This package is auto-updated.
Last update: 2024-10-29 23:28:25 UTC
README
Active azure directory bundle for symfony 4 project
Routing
Add the following code in the your config/routes.yaml
opcoding_aad_bundle: resource: '@OpcodingAADBundle/Resources/config/routes.yaml'
Edit the bundles.php file and add the following code :
<?php return [ OpcodingAADBundle\OpcodingAADBundle::class => ['all' => true] ];
Edit de config/packages/knpu_oauth2_client.yml
file and add the following code :
knpu_oauth2_client: clients: azure: type: azure client_id: '%env(resolve:AZURE_CLIENT_ID)%' client_secret: '%env(resolve:AZURE_CLIENT_SECRET)%' redirect_route: connect_azure_check redirect_params: {} api_version: '1.6'
Then edit the config/packages/security.yml
and add the following code according to your needs:
security: providers: app: entity: class: OpcodingAADBundle:User property: username firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false main: pattern: ^/ anonymous: ~ logout: path: app_logout target: / guard: authenticators: - OpcodingAADBundle\Security\AzureAuthenticator
For example, if your application request that all the users must be logged in you can configure it like that :
security: firewalls: main: pattern: ^/ anonymous: true logout: path: app_logout target: / guard: authenticators: - OpcodingAADBundle\Security\AzureAuthenticator access_control: - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/, role: ROLE_USER }