PHPackages                             alejandroherr/silex-esngalaxysecurityserviceprovider - 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. alejandroherr/silex-esngalaxysecurityserviceprovider

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

alejandroherr/silex-esngalaxysecurityserviceprovider
====================================================

Cas security service provider for silex to authenticate with the ESN Galaxy

v0.1(11y ago)0361[1 PRs](https://github.com/AlejandroHerr/EsnGalaxy/pulls)MITPHP

Since Jan 27Pushed 5y ago1 watchersCompare

[ Source](https://github.com/AlejandroHerr/EsnGalaxy)[ Packagist](https://packagist.org/packages/alejandroherr/silex-esngalaxysecurityserviceprovider)[ RSS](/packages/alejandroherr-silex-esngalaxysecurityserviceprovider/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

Silex-EsnGalaxySecurityServiceProvider
======================================

[](#silex-esngalaxysecurityserviceprovider)

A Service Provider for Silex to authenticate through the [ESN Galaxy](http://galaxy.esn.org) CAS server. With some *magic* extending classes could be used to authenticate with other CAS servers. Feel free to fork, edit and so.

**Warning:** This library is still work in progress. Meaning that some components may misbehave a little bit.

Instalation
-----------

[](#instalation)

```
{
    "require": {
        "alejandroherr/silex-esngalaxysecurityserviceprovider": "0.1"
    }
}
```

[More versions (if available)](https://packagist.org/packages/alejandroherr/silex-esngalaxysecurityserviceprovider)

Configuration
-------------

[](#configuration)

The comment lines are showing its default value. Only overrider if you need it.

```
$app->register(new Silex\Provider\SessionServiceProvider());
$app->register(new SecurityServiceProvider());

$app->register(new AlejandroHerr\Silex\EsnGalaxy\EsnGalaxyServiceProvider());

$app['security.firewalls'] = [
    'main' => [
        'esn_galaxy' => array(
            'pattern' => '^/.*$',
            'anonymous' => true,
            'esn_galaxy' => [
                'cas_server' => [
                    //'base_url' => 'galaxy.esn.org',
                    //'context' => 'cas',
                    //'port' => 443
                    //'login_path' => '/login',
                    //'validation_path' => '/serviceValidate'
                ],
                //'check_path' => '/cas/validation',
                //'login_path' => '/login',
                // 'first_login_path' => '/welcome_user'
                'auth' => [
                    //'*' => [
                    //        'Local.activeMember' => 'ROLE_USER',
                    //        'Local.regularBoardMember' => 'ROLE_BOARD',
                    //    ]
                    //]
                ]
            ]
        ],
        'logout' => ['logout_path' => '/logout'], //if you want a logout
        'users' => $app->share(function() use ($app){
            return new Your\UserProvider();
        })
    ]
];

$app['security.access_rules'] = array(
    array('^\/(?!login)', 'ROLE_USER'),
);
```

### first\_login\_path

[](#first_login_path)

By adding a `first_login_path` (actually it could be a path or a route), when a logs in for the first time and a new user is created will be redirected to `first_login_path`.

It could be useful if your application permanent and you want them to provide further information, or if the user are spawned every time to give them some information (or just saying hi).

### Auth

[](#auth)

The auth option controls which galaxy-roles from which section can access to the site. It's an array with the following strcture:

```
'auth' => [
    'section1' => [
        'galaxy_role1' => 'app_role1',
        'galaxy_role2' => 'app_role2',
    ],
    'section2' => [
        'galaxy_role1' => 'app_role1',
        'galaxy_role3' => 'app_role2',
    ]
]
```

If section is `*` means 'any section'. Remember that **it can be a regex**. But to tell the Provider it's a regex it must start by `/`.

By default the configuration is:

```
'auth' => [
    '*' => [
        'Local.activeMember' => 'ROLE_USER',
        'Local.regularBoardMember' => 'ROLE_BOARD',
    ]
]
```

#### Examples

[](#examples)

##### Allowing only a country

[](#allowing-only-a-country)

```
'auth' => [
    '/^ES/' => [
        'Local.activeMember' => 'ROLE_USER',
        'Local.regularBoardMember' => 'ROLE_BOARD',
    ]
]
```

##### Allowing only a National Board

[](#allowing-only-a-national-board)

```
'auth' => [
    '/^ES/' => [
        'National.regularBoardMember' => 'ROLE_USER',
    ]
]
```

### Login and validation

[](#login-and-validation)

You also must define routes for the login and validation paths. Here some examples:

```
$app->match('/login', function () use ($app){
	$errormsg = null;
	if($app['session']->has(SecurityContextInterface::AUTHENTICATION_ERROR)){
	    $error = $app['session']->get(SecurityContextInterface::AUTHENTICATION_ERROR);
	    $errormsg = $error->getMessage();
	}

	return $app['twig']->render(
	    'login.twig',
	    array(
	        'loginUrl' => $app['jasig_cas_client']->getLoginUrl($app['request']),
	        'error' => $errormsg
	    )
	);
});
$app->match('/validation', function() use ($app){});
```

License
-------

[](#license)

Released under the MIT license. See the LICENSE file for details.

#### Code Hard, Party Harder

[](#code-hard-party-harder)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

4124d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/39dc3ecd2741dd23450ad1573e552ffde4aa85f3902aed7b17f33310d8d5a507?d=identicon)[AlejandroHerr](/maintainers/AlejandroHerr)

---

Top Contributors

[![AlejandroHerr](https://avatars.githubusercontent.com/u/3830912?v=4)](https://github.com/AlejandroHerr "AlejandroHerr (57 commits)")

### Embed Badge

![Health badge](/badges/alejandroherr-silex-esngalaxysecurityserviceprovider/health.svg)

```
[![Health](https://phpackages.com/badges/alejandroherr-silex-esngalaxysecurityserviceprovider/health.svg)](https://phpackages.com/packages/alejandroherr-silex-esngalaxysecurityserviceprovider)
```

###  Alternatives

[cnam/security-jwt-service-provider

Service Provider for usage jwt token for auth

60108.1k2](/packages/cnam-security-jwt-service-provider)[hryvinskyi/magento2-invisible-captcha

Magento 2 Google Invisible Captcha (Recaptcha) module

279.4k](/packages/hryvinskyi-magento2-invisible-captcha)[allyans3/protobuf-steam-auth

description

219.7k3](/packages/allyans3-protobuf-steam-auth)[davec49/silex2-simpleuser

A simple database-backed user provider for Silex 2.0, with associated services and controllers forked from jasongrimes/SimpleUser.

131.1k](/packages/davec49-silex2-simpleuser)

PHPackages © 2026

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