PHPackages                             symftony/rabbitmq-auth-backend-http-php - 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. symftony/rabbitmq-auth-backend-http-php

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

symftony/rabbitmq-auth-backend-http-php
=======================================

Implementation of RabbitMQ http auth backend

21.9k↓100%3PHP

Since Mar 31Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Symftony/rabbitmq-auth-backend-http-php)[ Packagist](https://packagist.org/packages/symftony/rabbitmq-auth-backend-http-php)[ RSS](/packages/symftony-rabbitmq-auth-backend-http-php/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

rabbitmq-auth-backend-http-php
==============================

[](#rabbitmq-auth-backend-http-php)

PHP implementation of HTTP-based authorisation and authentication for RabbitMQ

Installation
------------

[](#installation)

The recommended way to install is through [Composer](https://getcomposer.org/). Require the symftony/rabbitmq-auth-backend-http-php package:

```
$ composer require symftony/rabbitmq-auth-backend-http-php

```

Usage
-----

[](#usage)

You can check the [example folder](tree/master/example).

### Use as lib

[](#use-as-lib)

To use as simple library you must create some service to provide a fully configurable authentication and authorization

#### Authentication

[](#authentication)

First of all you need to choose/configure your [user provider](https://github.com/symfony/symfony/tree/master/src/Symfony/Component/Security/Core/Authentication/Provider)

```
$userProvider = new InMemoryUserProvider(array(
    'admin' => array(
        'password' => 'password',
        'roles' => array('Administrator'),
    ),
    'user1' => array(
        'password' => 'user_pass',
    ),
));
```

You need a authentication checker in order to compare the `TokenInterface` with `user`.

```
$authenticationChecker = new ChainAuthenticationChecker(array(
    new UserPasswordTokenChecker(), // Check the username AND the password, during the authentication process
    new UserTokenChecker(), // Check only username, append with topic, vhost, resource action
));
```

The authenticator is use `UserProvider` to find the user and the `AuthenticationChecker` to know if the token is authenticate.

```
$authenticator = new Authenticator(
    $userProvider,
    $authenticationChecker
);

$authenticationManager = new AuthenticationProviderManager(array($authenticator));
```

Now the `Token` is authenticated

#### Authorization

[](#authorization)

After authenticate, we need to authorize the token to access a resource.

First of all you need a `Voter` to check the token authorization. The [DefaultVoter](src/Authorization/DefaultVoter.php) use the same logic than internal rabbitmq authorization. You can configure each user in each vhost with 4 regular expression that must match to grant access.

```
$defaultVoter = new DefaultVoter(array(
    'admin' => array(
        'isAdmin' => true,
    ),
    'user-1' => array(
        '/' => array(
            'ip' => '.*',        // to control the vhost ip access
            'read' => '.*',      // to control the resource/topic read access
            'write' => '.*',     // to control the resource/topic write access
            'configure' => '.*', // to control the resource/topic configure access
        ),
    ),
));
```

`AccessDecisionManager` is use to allow/deny the token access. `AccessDecisionManager` need an array of `VoterInterface` to do the check. You need to implement your own voter, in order to choose if the token is granted or not.

```
$accessDecisionManager = new AccessDecisionManager(array($defaultVoter));
```

`AuthorizationChecker` is the manager of authorization process

```
$tokenStorage = new TokenStorage();
$authorizationChecker = new AuthorizationChecker(
    $tokenStorage,
    $authenticationManager,
    $accessDecisionManager
);
```

Now you have all services to authenticate and authorize a token to access a resource.

In order to simplify the RabbitMQ auth check you can use the `Security` class.

```
$security = new Security($authenticationManager, $authorizationChecker);
// $isAuthenticate = $this->security->authenticate($token);
// $hasAccess = $this->security->vhost($token, {IP});
// $hasAccess = $this->security->resource($token, {RESOURCE}, {NAME}, {PERMISSION});
// $hasAccess = $this->security->topic($token, {RESOURCE},{NAME},{PERMISSION},{ROUTING_KEY},{VARIABLE_MAP_USERNAME},{VARIABLE_MAP_VHOST});
```

### Use in Symfony framework

[](#use-in-symfony-framework)

You need to create the `Security` service and register the controller as service

> You can check the [Symfony documentation](https://symfony.com/doc/current/security.html) about security

```
# app/config/services.yml
services:
    RabbitMQAuth\Security:
        arguments:
            - '@security.authentication.manager'
            - '@security.authorization_checker'

    RabbitMQAuth\Controller\AuthController:
        arguments:
            - '@security.token_storage'
            - '@RabbitMQAuth\Security'
```

Define the 4 routes.

```
# app/config/routing.yml
auth_user:
    path: /auth_user
    defaults:  { _controller: RabbitMQAuth\Controller\AuthController::userAction }
auth_topic:
    path: /auth_topic
    defaults:  { _controller: RabbitMQAuth\Controller\AuthController::topicAction }
auth_resource:
    path: /auth_resource
    defaults:  { _controller: RabbitMQAuth\Controller\AuthController::resourceAction }
auth_vhost:
    path: /auth_vhost
    defaults:  { _controller: RabbitMQAuth\Controller\AuthController::vhostAction }
```

###  Health Score

26

—

LowBetter than 46% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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/95e3f5c158d87fab8302453caa6287bc95b347513b90fe74d5e6ee7933ad617c?d=identicon)[Symftony](/maintainers/Symftony)

---

Top Contributors

[![instabledesign](https://avatars.githubusercontent.com/u/1098878?v=4)](https://github.com/instabledesign "instabledesign (6 commits)")[![Symftony](https://avatars.githubusercontent.com/u/26468034?v=4)](https://github.com/Symftony "Symftony (1 commits)")

### Embed Badge

![Health badge](/badges/symftony-rabbitmq-auth-backend-http-php/health.svg)

```
[![Health](https://phpackages.com/badges/symftony-rabbitmq-auth-backend-http-php/health.svg)](https://phpackages.com/packages/symftony-rabbitmq-auth-backend-http-php)
```

###  Alternatives

[league/oauth2-client

OAuth 2.0 Client Library

3.8k115.1M1.0k](/packages/league-oauth2-client)[google/auth

Google Auth Library for PHP

1.4k266.3M128](/packages/google-auth)[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k98.4M89](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99895.6M97](/packages/league-oauth1-client)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70316.0M32](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

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

41720.5M102](/packages/league-oauth2-google)

PHPackages © 2026

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