Download the PHP package james-machouk/azure-ad-auth without Composer
On this page you can find all versions of the php package james-machouk/azure-ad-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download james-machouk/azure-ad-auth
More information about james-machouk/azure-ad-auth
Files in james-machouk/azure-ad-auth
Package azure-ad-auth
Short Description it's an easy and simple way to integrate azure active directory login with laravel auth
License MIT
Informations about the package azure-ad-auth
Azure Active Directory Auth for Laravel
it's an easy and simple way to integrate azure active directory login with Laravel auth. this package replaces the default login/registration logic with OAuth2 and adds a user authenticity check with your Azure AD.
you can activate or deactivate this package without losing any Laravel Auth default functionality.
Installation
- This package uses Laravel default auth, if you don't have it, please refer to this documentation
- you need to have "name, email, password" field on your "Users" database table
Use the package manager composer to install azure-ad-auth.
Usage
publish the package with artisan
add this lines to you .env file
- AZURE_AD_TENANT_ID / OAUTH_APP_ID / OAUTH_APP_PASSWORD : you'll find all this params in you Azure AD dashboard.
- OAUTH_REDIRECT_URI : this is the callback uri set on your azure dashboard, if you are on dev envirenement with localhost, then your URI will be http://localhost/callback.
- OAUTH_SCOPES : refer to this documentation.
- OAUTH_AUTHORITY / OAUTH_AUTHORIZE_ENDPOINT / OAUTH_TOKEN_ENDPOINT : this paths are given by microsoft, do not change them unless microsoft changes them.
- OAUTH_REDIRECT_AFTER_LOGOUT_URI : The URL that the user is redirected to after successfully signing out. If the parameter isn't included, the user is shown a generic message that's generated by the Microsoft identity platform endpoint. This URL must match one of the redirect URIs registered for your application in the app registration portal.
- OVERRIDE_DEFAULT_LOGIN : this params is to activate or deactivate the package
after publishing, you'll find a new config file azureAdAuth.php
go to your routes/web.php and remove
don't forget to put it back if you deactivate the Aazure AD package, or you can just replace it with this simple condition
Loggin out
this package isn't overriding the laravel's logout function, this is why you need to logout from laravel first and then call the adLogout function shipped with this package. the function has a reserved route name ( 'adLogout' ) you can call it like this :
If you are using the built-in laravel's logout method just override the "loggedOut" function in App\Http\Controllers\Auth\LoginController by adding this at the end of your class