PHPackages                             ohtarr/laravelazure - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. ohtarr/laravelazure

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

ohtarr/laravelazure
===================

Laravel Azure Token Authentication

030PHP

Since Sep 30Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ohtarr/LaravelAzure)[ Packagist](https://packagist.org/packages/ohtarr/laravelazure)[ RSS](/packages/ohtarr-laravelazure/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Azure AD Token based authentication and authorization.
--------------------------------------------------------------

[](#laravel-azure-ad-token-based-authentication-and-authorization)

Add Azure AD Token Validation and role assignment via the following php packages:

```
https://github.com/ohtarr/Azure - AzureAD Authentication and Token Validation
https://github.com/JosephSilber/bouncer - Authorization

```

Installation:
-------------

[](#installation)

#### Add library to your Laravel project:

[](#add-library-to-your-laravel-project)

```
composer require ohtarr/LaravelAzure

```

#### You must have an application registration in Azure with role based permissions setup.

[](#you-must-have-an-application-registration-in-azure-with-role-based-permissions-setup)

#### Add the necessary env vars for Azure Active Directory OAUTH:

[](#add-the-necessary-env-vars-for-azure-active-directory-oauth)

```
AZURE_AD_TENANT=MyAwesomeAzureADTenant
AZURE_AD_CLIENT_ID=1234abcd-12ab-34cd-56ef-123456abcdef
AZURE_AD_CLIENT_SECRET=123456789abcdef123456789abcdef\123456789abc=

```

#### Publish LaravelAzure files - migration to add azure\_id to users table, addPermission command to easily add bouncer permissions.

[](#publish-laravelazure-files---migration-to-add-azure_id-to-users-table-addpermission-command-to-easily-add-bouncer-permissions)

```
php artisan vendor:publish --provider="Ohtarr\LaravelAzure\ServiceProvider" --force

```

#### Publish Bouncer files - Standard bouncer migrations to add tables for authorization control

[](#publish-bouncer-files---standard-bouncer-migrations-to-add-tables-for-authorization-control)

```
php artisan vendor:publish --provider="Silber\Bouncer\BouncerServiceProvider" --force

```

#### Migrate

[](#migrate)

```
php artisan migrate

```

#### Add Bouncer to User model at /app/Models/User.php

[](#add-bouncer-to-user-model-at-appmodelsuserphp)

```
namespace App\Models;

use Silber\Bouncer\Database\HasRolesAndAbilities;

class User extends Authenticatable
{
		use HasRolesAndAbilities;
}

```

#### Add permissions via addPermission command, or add bouncer permissions your own way...

[](#add-permissions-via-addpermission-command-or-add-bouncer-permissions-your-own-way)

```
# modify addPermission file
nano app/Console/Commands/addPermission.php

	#modify the objects array to include all of the objects you want to assign permissions to:
	$objects = [
		\App\Models\Thing::class,
	];

# execute addPermission
php artisan LaravelAzure:addPermission write Admin

```

#### add auth:api middleware to controllers or routes. Controller example below.

[](#add-authapi-middleware-to-controllers-or-routes--controller-example-below)

```
#controller constructor:
public function __construct()
{
	$this->middleware('auth:api');
}

```

#### add authorization check to controller methods as needed

[](#add-authorization-check-to-controller-methods-as-needed)

```
public function index(Request $request)
{
	//IF user is authorized
	$user = auth()->user();

	if ($user->cant('read', Model::class)) {
		abort(401, 'You are not authorized');
	}
	return $coolapistuff;
}

```

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e68b8e9e3ec62502756331d84a2fea0340fabe3f84688145a80f1bb333652f5?d=identicon)[ohtarr](/maintainers/ohtarr)

---

Top Contributors

[![ohtarr](https://avatars.githubusercontent.com/u/17907160?v=4)](https://github.com/ohtarr "ohtarr (15 commits)")

### Embed Badge

![Health badge](/badges/ohtarr-laravelazure/health.svg)

```
[![Health](https://phpackages.com/badges/ohtarr-laravelazure/health.svg)](https://phpackages.com/packages/ohtarr-laravelazure)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
