PHPackages                             avvertix/caslite - 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. avvertix/caslite

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

avvertix/caslite
================

A Laravel package for handling CAS based authentication.

v1.0.1(10y ago)0206[2 issues](https://github.com/avvertix/caslite/issues)MITPHPPHP &gt;=5.5.9

Since Dec 29Pushed 10y ago1 watchersCompare

[ Source](https://github.com/avvertix/caslite)[ Packagist](https://packagist.org/packages/avvertix/caslite)[ Docs](https://github.com/avvertix/caslite)[ RSS](/packages/avvertix-caslite/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

Caslite
=======

[](#caslite)

[![Latest Stable Version](https://camo.githubusercontent.com/6375e28d94f2234d9ea4f28957dd4df632d1a501ba5dd7696b544bfc48f30b76/68747470733a2f2f706f7365722e707567782e6f72672f61767665727469782f6361736c6974652f762f737461626c65)](https://packagist.org/packages/avvertix/caslite) [![Total Downloads](https://camo.githubusercontent.com/6c0620a82101d84213629aa8759649176c3788de693c243d9c559c4760f10001/68747470733a2f2f706f7365722e707567782e6f72672f61767665727469782f6361736c6974652f646f776e6c6f616473)](https://packagist.org/packages/avvertix/caslite) [![Latest Unstable Version](https://camo.githubusercontent.com/1f9a71623be3dc6c20dbecbe640d8429a003ec3cf4dbb116914d1ee47e3b1a43/68747470733a2f2f706f7365722e707567782e6f72672f61767665727469782f6361736c6974652f762f756e737461626c65)](https://packagist.org/packages/avvertix/caslite) [![License](https://camo.githubusercontent.com/86e1b9ed22e6323c9461048941b3189e1b03ee5facdaba3e2427820f6950f0ea/68747470733a2f2f706f7365722e707567782e6f72672f61767665727469782f6361736c6974652f6c6963656e7365)](https://packagist.org/packages/avvertix/caslite)

Caslite provides the Central Authentication Service ([CAS](https://www.apereo.org/projects/cas)) authentication to Laravel 5.1 applications.

> Inspired by [Laravel Socialite](https://github.com/laravel/socialite)

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

[](#installation)

To get started with Caslite, add to your `composer.json` file as a dependency:

```
composer require avvertix/caslite

```

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

[](#configuration)

After installing the Caslite library, register the Avvertix\\Caslite\\CasliteServiceProvider in your config/app.php configuration file:

```
'providers' => [
    // Other service providers...

    Avvertix\Caslite\CasliteServiceProvider::class,
],
```

Also, add the Caslite facade to the aliases array in your app configuration file:

```
'Caslite' => Avvertix\Caslite\Facades\Caslite::class,
```

You will also need to add the configuration to reach the CAS server your application utilizes. These configuration parameters should be placed in your `config/services.php` configuration file, and should use the key `cas`. The following code block shows what to add in the configuration parameters:

```
'cas' => [
    /*
    |--------------------------------------------------------------------------
    | phpCAS Debug
    |--------------------------------------------------------------------------
    |
    | @var boolean true to enable debug, log file will be written in storage/logs/cas.log
    |
    */
    'cas_debug' => env('CAS_DEBUG', false),

    /*
    |--------------------------------------------------------------------------
    | phpCAS Hostname
    |--------------------------------------------------------------------------
    |
    | Example: 'login.uksw.edu.pl'
    | @var string
    */
    'cas_hostname' => env('CAS_HOSTNAME', ''),

    /*
    |--------------------------------------------------------------------------
    | CAS Port
    |--------------------------------------------------------------------------
    |
    | Usually 443 is default
    | @var integer
    */
    'cas_port' => env('CAS_PORT', 443),

    /*
    |--------------------------------------------------------------------------
    | CAS URI
    |--------------------------------------------------------------------------
    |
    | Usually '/cas' is default
    | @var string
    */
    'cas_uri' => env('CAS_URI', '/cas'),

    /*
    |--------------------------------------------------------------------------
    | CAS login URI
    |--------------------------------------------------------------------------
    |
    | Empty is fine
    | @var string
    */
    'cas_login_uri' => env('CAS_LOGIN_URI', ''),

    /*
    |--------------------------------------------------------------------------
    | CAS logout URI
    |--------------------------------------------------------------------------
    |
    | Example: 'https://login.uksw.edu.pl/cas/logout?service='
    | Empty is fine
    | @var string
    */
    'cas_logout_uri' => env('CAS_LOGOUT_URI', ''),

    /*
    |--------------------------------------------------------------------------
    | CAS Validation
    |--------------------------------------------------------------------------
    |
    | CAS server SSL validation: 'self' for self-signed certificate, 'ca' for
    | certificate from a CA, empty for no SSL validation
    | @var string
    */
    'cas_validation' => env('CAS_VALIDATION', ''),

    /*
    |--------------------------------------------------------------------------
    | CAS Certificate
    |--------------------------------------------------------------------------
    |
    | Path to the CAS certificate file
    | @var string
    */
    'cas_cert' => env('CAS_CERT', ''),

    /*
    |--------------------------------------------------------------------------
    | Use SAML to retrieve user attributes
    |--------------------------------------------------------------------------
    |
    | CAS can be configured to return more than just the username to a given
    | service. It could for example use an LDAP backend to return the first name,
    | last name, and email of the user. This can be activated on the client side
    | by setting 'cas_saml' to true
    | @var boolean
    */
    'cas_saml' => env('CAS_SAML', false),

    /*
    |--------------------------------------------------------------------------
    | SAML group name attribute
    |--------------------------------------------------------------------------
    |
    | If you are using SAML with LDAP backend you can simply check if logged
    | user is member of specific group. Type below LDAP's group attribute
    | name
    | @var string
    */
    'cas_saml_attr_groups' => env('CAS_SAML_ATTR_GROUPS', 'Groups'),

    /*
    |--------------------------------------------------------------------------
    | CAS session name
    |--------------------------------------------------------------------------
    |
    | Define your CAS session name
    | @var string
    */
    'cas_session_name' => env('CAS_SESSION_NAME', 'CAS_SESSION'),
],
```

As you might have noticed most of the paramaters refers to an environment variable, so you can customize them for each environment. Typically you will only need to include in the `.env` file the following variables (values are only for example)

```
CAS_HOSTNAME=cas-server-host.com
CAS_URI=cas

```

Usage
-----

[](#usage)

Next, you are ready to authenticate users! You will need two routes: one for redirecting the user to the CAS provider, and another for receiving the callback from the provider after authentication. We will access Caslite using the Caslite facade:

```
