Yii2 Auth0
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist anli/yii2-auth0 "*"
or add
"anli/yii2-auth0": "*"
to the require section of your composer.json
file.
Run migration with:
php yii migrate/up --migrationPath=@vendor/anli/yii2-auth0/migrations
Update the modules
section with:
'auth0' => array_merge([
'class' => 'anli\auth0\Module',
'adminEmails' => ['anli@simbiosis.com.sg'],
], require(__DIR__ . '/auth0-local.php')),
Create a new file in config/auth0-local.php
:
<?php
if (YII_ENV_DEV) {
return [
'serviceId' => '',
'domain' => '',
'clientId' => '',
'clientSecret' => '',
'redirectUrl' => '',
'apiTokens' => [
'usersRead' => '',
'usersUpdate' => '',
]
];
}
return [
'serviceId' => '',
'domain' => '',
'clientId' => '',
'clientSecret' => '',
'redirectUrl' => '',
'apiTokens' => [
'usersRead' => '',
'usersUpdate' => '',
]
];
Add to your .gitignore
file:
/config/auth0-local.php
Login to auth0 and update the Allowed Callback Urls
in your setting page.
Update the components
section in the config with:
'user' => [
'identityClass' => 'anli\auth0\models\User',
'loginUrl' => ['auth0/user/login'],
],
'tenant' => [
'class' => 'anli\auth0\components\Tenant',
],
Update your url
section for your login button to [/auth0/user/login]
.
Update your url
section for your logout button to [/auth0/user/logout]
.
To show the login user, use:
Html::encode(Yii::$app->user->identity->username);
To show the login tenant, use:
Html::encode(Yii::$app->tenant->identity->name);
To auto update the tenant_id, add to the behaviors
section of your model with:
use anli\auth0\behaviors\TenantBehavior;
...
'tenant' => [
'class' => TenantBehavior::className(),
],
If you encounter the following error
\JWT not found
Change the firebase/php-jwt
version to v2.2.0
:
cd @vendor/firebase/php-jwt
git checkout v2.2.0
Update the @vendor/composer/autoload_classmap.php
with:
'BeforeValidException' => $vendorDir . '/firebase/php-jwt/Exceptions/BeforeValidException.php',
'JWT' => $vendorDir . '/firebase/php-jwt/Authentication/JWT.php',
If you encounter the following error:
Cannot handle token prior to 2015-08-05T10:42:34+0200
And your system time forward a few minutes.
If you encounter the following error:
cURL error 60: SSL certificate problem: self signed certificate in certificate chain
Download CA to;
C:\xampp\php\ca\cacert.pem
and update C:\xampp\php\php.ini with
curl.cainfo=C:\xampp\php\ca\cacert.pem
Restart your apache2 server.
enh
Added search by email manual featurebug
Fixed bug to allow unique validator based on tenant id to work correctlybug
Fixed bug to display auth0 lock correctly with latest version of chromebug
Fixed bug to display sidebar correctly.chg
Changed rememberLastLogin settingsenh
Added image url functionbug
Fixed bug to remove tenant correctly from Auth0 AppMetadataenh
Added UserQuerybug
Fixed bug to use the latest stable version of yii2-metronic and yii2-helperenh
Added change tenant featurebug
Fixed bug to refresh service admin page correctly after tenant create or updatechg
Changed sidebar to web service paramsenh
Added validate tenant function to auth0 modelenh
Added user select2Data functionenh
Added tenant functionchg
Changed login action with goBack()
functionenh
Added access control to controllerenh
Added documentation on admin email configurationenh
Added update user feature to adminenh
Added metronic themeenh
Added create action and create form with modal assetsenh
Added buttons to tenantenh
Added login layoutenh
Added confirmation msg for delete all, added audit log for tenantenh
Added users column to tenant portletenh
Added user portlet in tenant admin dashboard with tenants columnchg
Removed tick and cross in service-admin indexchg
Changed portlet layout similar to the old designenh
Added the import all function in tenant service adminenh
Added export function to tenant service adminenh
Added session flash featureenh
Added checkbox function to gridview in service adminenh
Added Service Admin index pageenh
Added Tenant User model
Comments