PHPackages                             loren138/cas-server - 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. loren138/cas-server

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

loren138/cas-server
===================

A CAS Server form Single Sign On (SSO) implemented as a Laravel Package.

1.0.2(9y ago)5813[2 issues](https://github.com/loren138/cas-server/issues)[1 PRs](https://github.com/loren138/cas-server/pulls)MITPHPPHP &gt;=5.6.0

Since Aug 12Pushed 2y ago1 watchersCompare

[ Source](https://github.com/loren138/cas-server)[ Packagist](https://packagist.org/packages/loren138/cas-server)[ RSS](/packages/loren138-cas-server/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)Dependencies (6)Versions (5)Used By (0)

Archived
========

[](#archived)

Feel free to fork/clone/copy this for your own uses (and update to more recent versions of Laravel)

Laravel CAS Server
==================

[](#laravel-cas-server)

Todo
----

[](#todo)

- Add SAML/Warn
- Unit test flashing an error to session

This is a Laravel implementation of the CAS protocol because tomcat/CAS are way to hard to deal with and keep up to date. This should be much easier and much easier to understand.

Because of the required URLs for CAS, it is recommended that you install this in it's own Laravel instance.

Laravel installation instructions can be found here:

Install
-------

[](#install)

```
composer require loren138/cas-server

```

After updating composer, add the service provider to the providers array in config/app.php

```
Loren138\CASServer\CASServerServiceProvider::class,

```

Next, you'll want to publish the views, public files, config, and migrations.

```
php artisan vendor:publish --provider="Loren138\CASServer\CASServerServiceProvider"

```

Next, you'll need to implement your user authentication class. The class for users must Implement Loren138\\CASServer\\Models\\CASUserInterface

```
 use Loren138\CASServer\Models\CASUserInterface;
 use Illuminate\Database\Eloquent\Model;

 class MyUser extends Model implements CASUserInterface
 {
      public function checkLogin($username, $password)
      {
            if (loginGood) {
                return true;
            }
            return false;
      }
      public function userAttributes($username);
      {
            return [
                'attribute' => 'value'
            ];
      }
 }

```

Last, update the `casserver.php` file in the config folder such that the userClass setting references your class (and update other settings as desired).

You should now have a working CAS Server.

Table Cleanup
-------------

[](#table-cleanup)

It is recommended that you have CAS cleanup the authentication and ticket tables daily. You can do that by adding the following in the schedule function in your `console/Kernel.php` file

```
$schedule->command('casserver:cleanup')->daily();

```

Note: For this to work, you must have setup a cron job to call Laravel's command:

Session configuration
---------------------

[](#session-configuration)

It is recommended to verify/set the following in `config/session.php`: (These settings are toward the bottom of the file.)

```
'secure'    => true,
'http_only' => true,
'expire_on_close' => true,

```

It is also recommended to change the cookie name in `config/session.php`:

```
'cookie' => 'cas_session',

```

You should also make sure the `lifetime` variable is at least as long as your sso lifetime in `casserver.php` in `config/session.php` by default, you'll want to set session lifetime to `480`.

Catching CSRF Errors
--------------------

[](#catching-csrf-errors)

In the render (not report) function of `app/Exceptions/Handler.php`, you may want to add the following:

```
if ($e instanceof TokenMismatchException) {
    session()->flash('error', 'Validation Token expired. Please try again.');
    return redirect()->back();
}

```

SSL
---

[](#ssl)

Single Sign on Sessions are only stored if you are using SSL. Thus, you may want to force SSL. You can do this on your web server or with a middleware such as:

You can also use modrewrite

```
# This will enable the Rewrite capabilities
RewriteEngine On

# This checks to make sure the connection is not already HTTPS
RewriteCond %{HTTPS} !=on

# This rule will redirect users from their original location, to the same location but using HTTPS.
# i.e.  http://www.example.com/foo/ to https://www.example.com/foo/
# The leading slash is made optional so that this will work either in httpd.conf
# or .htaccess context
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

```

Server Install
--------------

[](#server-install)

Testing requires sqlite.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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 ~1 days

Total

3

Last Release

3599d ago

PHP version history (2 changes)1.0PHP &gt;=5.5.0

1.0.2PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/60fc875353540d12b25b568be5519f786c52c4fa67258b909492d28120322d82?d=identicon)[loren138](/maintainers/loren138)

---

Top Contributors

[![loren138](https://avatars.githubusercontent.com/u/1224505?v=4)](https://github.com/loren138 "loren138 (5 commits)")

---

Tags

laravelSSOcas

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/loren138-cas-server/health.svg)

```
[![Health](https://phpackages.com/badges/loren138-cas-server/health.svg)](https://phpackages.com/packages/loren138-cas-server)
```

###  Alternatives

[codegreencreative/laravel-samlidp

Make your PHP Laravel application an Identification Provider using SAML 2.0. This package allows you to implement your own Identification Provider (idP) using the SAML 2.0 standard to be used with supporting SAML 2.0 Service Providers (SP).

264817.2k1](/packages/codegreencreative-laravel-samlidp)[xavrsl/cas

Add CAS server SSO authentication to Laravel 4 and 5

7637.1k](/packages/xavrsl-cas)[maicol07/laravel-oidc-client

OpenID Connect Client for Laravel

281.3k](/packages/maicol07-laravel-oidc-client)

PHPackages © 2026

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