OpenID connect server
The application is responsible for providing OIDC functionality for authenticating users to the external mobile application. The solution is done based on the library.
Setup
Here are the steps that should be done to set up the OIDC server.
composer install.- configure pcntl PHP extension (can be done in zone admin panel).
- Add OIDC application apache config in the root
.htaccessfile like it's done in.htaccess.example. - Add OIDC application apache config in the web root:
cp oidc/web/.htaccess.example oidc/web/.htaccess. cp oidc/config/main-local.php.dist oidc/config/main-local.phpNOTE: configure redis as session storage for the oidc application for better performance (seeoidc/config/main-local.php.dist.php)cp oidc/config/params-local.php.dist oidc/config/params-local.php.cd common/config/keys.openssl genrsa -out openid-connect-private.key 2048generate private keyopenssl rsa -in openid-connect-private.key -pubout -out openid-connect-public.key- extract the public key from the private keychmod 660 openid-connect-*.keyvendor/bin/generate-defuse-keyRun the command twice to generateYII2_OAUTH2_SERVER_CODES_ENCRYPTION_KEYandYII2_OAUTH2_SERVER_STORAGE_ENCRYPTION_KEY- Put the received values into
preinit.environment.phpas it's done incommon/config/preinit.environment.php.dist php yii migrate- Define the client for mobile app:
php yii oauth2/client/create --type=1 --grantTypes=1&& Store the secret to provide it to mobile app team - Configure created client:
php yii oidc/configure-client {client_identifier} - Add new redirect URI's for Google/Facebook/Apple Oauth2 applications. (see
oidc/controllers/AuthController.php) - Validate installation by running the command:
php yii oauth2/debug/config