PHPackages                             ivan-novakov/zfc-shib - 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. ivan-novakov/zfc-shib

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

ivan-novakov/zfc-shib
=====================

Shibboleth authentication for Zend Framework 2

1.1.0(12y ago)1148.5k2[1 issues](https://github.com/ivan-novakov/ZfcShib/issues)BSD-3-ClausePHPPHP &gt;=5.3.3

Since May 29Pushed 12y ago3 watchersCompare

[ Source](https://github.com/ivan-novakov/ZfcShib)[ Packagist](https://packagist.org/packages/ivan-novakov/zfc-shib)[ Docs](https://github.com/ivan-novakov/ZfcShib)[ RSS](/packages/ivan-novakov-zfc-shib/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

Shibboleth authentication for ZF2
=================================

[](#shibboleth-authentication-for-zf2)

[![Dependency Status](https://camo.githubusercontent.com/798f7de1d0f420ab36a1eeb5fc53c309022d5c5fb107326c70819071984b41db/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3532396130313165363332626163356130613030303031332f62616467652e706e67)](https://www.versioneye.com/user/projects/529a011e632bac5a0a000013)

The module provides Shibboleth authentication as a standard [Zend Framework 2](http://framework.zend.com/)authentication adapter.

Requirements
------------

[](#requirements)

- [Shibboleth SP](http://shibboleth.net/) instance - configured and running to provide user's attributes as environment variables to the target application

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

[](#installation)

The recommended installation method is through [composer](http://getcomposer.org/):

```
php composer.phar require ivan-novakov/zfc-shib:1.*

```

You can use this as a ZF2 module in a ZF2 MVC application or just as a library in any other type of application. If you want to use it as a module, add the module name 'ZfcShib' to your application configuration.

Basic usage
-----------

[](#basic-usage)

The adapter accepts these configuration options:

- `id_attr_name` (required) - the name of the attribute, which contains the user identity, for example `eppn`
- `user_attr_names` (optional) - a list of user attribute names to be extracted and added to the result user identity. If not specified, all default attributes will be added.
- `system_attr_names` (optional) - a list of system attribute names to be extracted and added to the result user identity (such as `Shib-Identity-Provider` for example). If not specified, all default attributes will be added.

Example:

```
    $adapter = new \ZfcShib\Authentication\Adapter\Shibboleth(array(
        'id_attr_name' => 'eppn',
        'user_attr_names' => array(
            'eppn',
            'cn',
            'mail'
        )
    ));

    $result = $adapter->authenticate();

    if ($result->isValid()) {
        $identity = $result->getIdentity();
    }
```

The `$identity` array then contains two sub-arrays:

- `system` - contains system attributes
- `user` - contains the required user attributes `eppn`, `cn` and `mail`.

The `$identity` variable will contain:

```
Array
(
    [system] => Array
    (
        [Shib-Application-ID] => default
        [Shib-Identity-Provider] => https://idp.example.org/idp/shibboleth
        [Shib-Authentication-Instant] => 2013-05-13T13:40:45.687Z
        [Shib-Authentication-Method] => urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport
        [Shib-AuthnContext-Class] => urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport
        [Shib-Session-Index] => cfe418967cd195e568ac000f57234bc287ecb5532365aa46c893d6e7f34300f0
    )

    [user] => Array
    (
        [eppn] => test@example.org
        [cn] => Test User
        [mail] => test.user@example.org
    )

)

```

Alternative identity container
------------------------------

[](#alternative-identity-container)

By default, the identity is returned as an array. But you can make the adapter return the identity in a format that suits you best. If you pass an identity factory object as a third parameter of the adapter's contructor, it will be used to create the identity. The factory must implement the `ZfcShib\Authentication\Identity\IdentityFactoryInterface` with the `createIdentity()` method, which receives the identity data value object as an argument and should return the resulting identity.

```
    use ZfcShib\Authentication\Identity;

    class MyIdentityFactory implements IdentityFactoryInterface
    {

        public function createIdentity(Identity\Data $identityData)
        {
            return new MyUser($identityData->getUserData());
        }
    }

    $identityFactory = new MyIdentityFactory();
    $adapter = new \ZfcShib\Authentication\Adapter\Shibboleth($options, null, $identityFactory);
```

Dummy adapter
-------------

[](#dummy-adapter)

If you need to develop and test your application and you don't have a running Shibboleth SP available, you can use the `ZfcShib\Authentication\Adapter\Dummy` adapter, which simulates the functionality of the Shibboleth adapter. Just pass all dummy user and system data to the constructor and use the adapter instead of the "real" one:

```
    use ZfcShib\Authentication\Adapter;

    $dummyOptions = array(
        'user_data' => array(
            'uid' => 'foo',
            'cn' => 'Foo Bar',
            'mail' => 'foo@bar.cz',
            'employeeNumber' => 123456
        ),
        'system_data' => array(
            'Shib-Application-ID' => 'default'
        )
    );

    $dummy = new Adapter\Dummy($dummyOptions, null, new MyUserFactory());
```

License
-------

[](#license)

- [BSD 3 Clause](http://debug.cz/license/bsd-3-clause)

Links
-----

[](#links)

- [GitHub](https://github.com/ivan-novakov/zf2-shibboleth-authentication)

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.9% 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 ~183 days

Total

2

Last Release

4593d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1208505?v=4)[Ivan Novakov](/maintainers/ivan-novakov)[@ivan-novakov](https://github.com/ivan-novakov)

---

Top Contributors

[![ivan-novakov](https://avatars.githubusercontent.com/u/1208505?v=4)](https://github.com/ivan-novakov "ivan-novakov (13 commits)")[![shuyg](https://avatars.githubusercontent.com/u/6391050?v=4)](https://github.com/shuyg "shuyg (1 commits)")

### Embed Badge

![Health badge](/badges/ivan-novakov-zfc-shib/health.svg)

```
[![Health](https://phpackages.com/badges/ivan-novakov-zfc-shib/health.svg)](https://phpackages.com/packages/ivan-novakov-zfc-shib)
```

###  Alternatives

[zf-commons/zfc-user

A generic user registration and authentication module for ZF2. Supports Zend\\Db and Doctrine2.

4851.1M71](/packages/zf-commons-zfc-user)[socalnick/scn-social-auth

Uses the HybridAuth PHP library to Enable authentication via Google, Facebook, Twitter, Yahoo!, etc for the ZfcUser ZF2 module.

21674.9k3](/packages/socalnick-scn-social-auth)[franz-deleon/fdl-oauth2-provider

ZF2 OAuth2 Provider module

166.8k](/packages/franz-deleon-fdl-oauth2-provider)[zfr/zfr-oauth2-server-module

Zend Framework 2 module for ZfrOAuth2Server

1236.6k1](/packages/zfr-zfr-oauth2-server-module)

PHPackages © 2026

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