PHPackages                             misd/raven-bundle - 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. misd/raven-bundle

ActiveSymfony-bundle[Authentication &amp; Authorization](/categories/authentication)

misd/raven-bundle
=================

Adds Raven authentication to your Symfony2 application

v1.1.0(13y ago)12.6k1[2 issues](https://github.com/misd-service-development/raven-bundle/issues)[1 PRs](https://github.com/misd-service-development/raven-bundle/pulls)MITPHPPHP &gt;=5.3.3

Since Jan 29Pushed 11y agoCompare

[ Source](https://github.com/misd-service-development/raven-bundle)[ Packagist](https://packagist.org/packages/misd/raven-bundle)[ Docs](https://github.com/misd-service-development/raven-bundle)[ RSS](/packages/misd-raven-bundle/feed)WikiDiscussions master Synced 1w ago

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

MisdRavenBundle
===============

[](#misdravenbundle)

[![Build Status](https://camo.githubusercontent.com/ae6493e9a79aae86ea336379e884074963529ae10206dfb1271b49ec5125f82b/68747470733a2f2f7472617669732d63692e6f72672f6d6973642d736572766963652d646576656c6f706d656e742f726176656e2d62756e646c652e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/misd-service-development/raven-bundle)

This bundle contains a Symfony2 authentication provider so that users can log in to a Symfony2 application through [Raven](http://raven.cam.ac.uk/), the University of Cambridge's central authentication service.

It also contains a user provider, which can allow any user authenticating through Raven access to your application.

Authors
-------

[](#authors)

- Chris Wilkinson

The bundle uses code based on the [UcamWebauth PHP class](https://wiki.cam.ac.uk/raven/PHP_library).

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

[](#requirements)

- [Symfony 2](http://symfony.com/)
- [PHP OpenSSL library](http://www.php.net/manual/en/book.openssl.php)

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

[](#installation)

1. Add the bundle to your dependencies:

    ```
    // composer.json

    {
       // ...
       "require": {
           // ...
           "misd/raven-bundle": "~1.0"
       }
    }

    ```
2. Use Composer to download and install the bundle:

    ```
    $ php composer.phar update misd/raven-bundle

    ```
3. Register the bundle in your application:

    ```
    // app/AppKernel.php

    class AppKernel extends Kernel
    {
        // ...
        public function registerBundles()
        {
            $bundles = array(
                // ...
                new Misd\RavenBundle\MisdRavenBundle(),
                // ...
            );
        }
        // ...
    }

    ```

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

[](#configuration)

### Firewall

[](#firewall)

To enable Raven authentication, add `raven: true` to a firewall configuration:

```
// app/config/security.yml

security:
    firewalls:
        raven_secured:
            pattern: ^/secure/.*
            raven: true

```

### User provision

[](#user-provision)

Normal Symfony2 user providers can be used, as long as the username is the user's CRSid.

If you would like any user who has successfully authenticated with Raven to access your application, you can use the bundle's Raven user provider:

```
// app/config/security.yml

security:
    providers:
        raven:
            id: raven.user_provider

```

The user provider returns an instance of `Misd\RavenBundle\Security\User\RavenUser` with the role `ROLE_USER`.

This can be chained with other providers to grant certain users extra roles. For example:

```
// app/config/security.yml

security:
    providers:
        chain_provider:
            chain:
                providers: [in_memory, raven]
        in_memory:
            memory:
                users:
                    abc123: { roles: [ 'ROLE_ADMIN' ] }
        raven:
            id: raven.user_provider

```

### Resource description

[](#resource-description)

You can add the name of your application to the Raven log in page:

```
// app/config/config.yml

misd_raven:
    description: "My application"

```

The text on the page will now include something like "This resource calls itself 'My application' and is ...".

### Test Raven service

[](#test-raven-service)

During development, especially when not on the University network, it is sometimes necessary to use the [test Raven Service](http://raven.cam.ac.uk/project/test-demo/). You can use this instead of the live service:

```
// app/config/config_dev.yml

misd_raven:
    use_test_service: true

```

The test Raven service **must not** be used in production: it might compromise your application. Keep it to `config_dev.yml`!

Exceptions
----------

[](#exceptions)

The bundle can throw various exceptions. To catch them, set up [event listeners](http://symfony.com/doc/2.1/cookbook/service_container/event_listener.html) and implement your logic (display a message, redirect to another page etc).

### `Misd\RavenBundle\Exception\AuthenticationCancelledException`

[](#misdravenbundleexceptionauthenticationcancelledexception)

This is thrown if the user clicks 'cancel' on the Raven log in screen.

### `Symfony\Component\Security\Core\Exception\UsernameNotFoundException`

[](#symfonycomponentsecuritycoreexceptionusernamenotfoundexception)

This is thrown if the user is not provisioned. If you're using the Raven user provider, this will never been seen.

### `Misd\RavenBundle\Exception\RavenException`

[](#misdravenbundleexceptionravenexception)

This is thrown if something has gone wrong with either the bundle or Raven itself. As this is an exceptional state, you probably won't need to catch it (and let the `500 Internal Server Error` be returned). It has the following sub-types:

- `Misd\RavenBundle\Exception\LoginTimedOutException`: If the Raven response is older than 30 seconds.

### `Misd\RavenBundle\Exception\OpenSslException`

[](#misdravenbundleexceptionopensslexception)

This is thrown if there is an OpenSSL problem.

Events
------

[](#events)

To listen for events that the bundle issues, create a normal event subscriber service:

```

```

The bundle issues the following events:

### `raven.redirect`

[](#ravenredirect)

The `Misd\RavenBundle\Event\RedirectEvent` object contains the parameters given to Raven when the user is redirected to the login page. You could, for example, add the `msg` parameter.

### `raven.login`

[](#ravenlogin)

The `Symfony\Component\Security\Http\Event\InteractiveLoginEvent` object contains the request and the authentication token following a successful Raven login.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 98.1% 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 ~30 days

Total

4

Last Release

4765d ago

### Community

Maintainers

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

---

Top Contributors

[![thewilkybarkid](https://avatars.githubusercontent.com/u/1784740?v=4)](https://github.com/thewilkybarkid "thewilkybarkid (101 commits)")[![hoyes](https://avatars.githubusercontent.com/u/2594055?v=4)](https://github.com/hoyes "hoyes (1 commits)")[![humandb](https://avatars.githubusercontent.com/u/7542104?v=4)](https://github.com/humandb "humandb (1 commits)")

---

Tags

bundleAuthenticationUniversity of Cambridge

### Embed Badge

![Health badge](/badges/misd-raven-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/misd-raven-bundle/health.svg)](https://phpackages.com/packages/misd-raven-bundle)
```

###  Alternatives

[scheb/2fa

Two-factor authentication for Symfony applications (please use scheb/2fa-bundle to install)

578630.7k1](/packages/scheb-2fa)[scheb/2fa-bundle

A generic interface to implement two-factor authentication in Symfony applications

6914.0M62](/packages/scheb-2fa-bundle)[escapestudios/wsse-authentication-bundle

Symfony2 bundle to implement WSSE authentication

1352.7M1](/packages/escapestudios-wsse-authentication-bundle)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

50570.7k1](/packages/web-auth-webauthn-framework)[auth0/symfony

Symfony SDK for Auth0 Authentication and Management APIs.

128738.1k](/packages/auth0-symfony)[web-auth/webauthn-symfony-bundle

FIDO2/Webauthn Security Bundle For Symfony

63397.4k6](/packages/web-auth-webauthn-symfony-bundle)

PHPackages © 2026

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