deuxhuithuit / craft-agency-auth
Adds SSO login in the cp with Google
Installs: 162
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Type:craft-plugin
Requires
- php: 8.1.*|8.2.*|8.3.*
- craftcms/cms: ^5.0.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.22
README
This plugin allows us to log in the control panel with our Google Account.
Note
This is meant to be internally used by Deux Huit Huit and might not do what you want. Pull Requests are welcome :)
Create and save the credentials
- Create OAuth client ID here
- Application type to Web application
- Name the credentials with the client's project name
- Add the authorized redirect URIs according to your setup. e.g.
https://example.com/actions/agency-auth/callback
no language are required. - Save the credentials
- Fill the credentials in the
/config/agency-auth.php
file - Commit the changes
config/agency-auth.php
The possible settings are:
<?php return [ '*' => [ 'client_id' => '', 'client_secret' => '', 'domain' => '', 'default_password' => '', 'photo_volume_handle' => '', // optional 'photo_folder_name' => '', // optional ] ];
src/AgencyAuth.php
This file will prevent the manual login with a password into craft's CP. It will also add js and css into the login page for the oauth2 dialog button.
src/controllers/DialogController.php
This will only redirect the user to the oauth2 dialog.
src/controllers/CallbackController.php
This will handle the oauth2 callback and login the user.
mod_sec
Rule id 930120 does not like the .profile
string in Google's response, so make sure
to tweak it for your needs.