PHPackages                             friezer-85/cas-oauth-laravel - 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. friezer-85/cas-oauth-laravel

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

friezer-85/cas-oauth-laravel
============================

A simple way to bridge an OAuth provider to a CAS-only application.

3.0.1(8mo ago)011GPL-3.0-onlyPHP

Since Nov 16Pushed 8mo agoCompare

[ Source](https://github.com/Friezer-85/cas-oauth-laravel)[ Packagist](https://packagist.org/packages/friezer-85/cas-oauth-laravel)[ RSS](/packages/friezer-85-cas-oauth-laravel/feed)WikiDiscussions main Synced today

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

🔐 CAS OAuth Laravel
===================

[](#-cas-oauth-laravel)

Un pont entre un fournisseur OAuth (Discord, Google, GitHub, etc.) et une application utilisant uniquement CAS pour l'authentification.

Ce package permet de transformer n'importe quel provider OAuth en serveur CAS, idéal pour connecter des applications legacy (comme Pronote, Moodle, etc.) à des systèmes d'authentification modernes.

---

📋 Table des matières
--------------------

[](#-table-des-matières)

- [Prérequis](#-pr%C3%A9requis)
- [Installation](#-installation)
- [Configuration](#-configuration)
- [Utilisation](#-utilisation)
- [Providers supportés](#-providers-support%C3%A9s)
- [Dépannage](#-d%C3%A9pannage)

---

🔧 Prérequis
-----------

[](#-prérequis)

- PHP 8.2 ou supérieur
- Laravel 12.x
- Un serveur web (Apache/Nginx)
- Une application OAuth (Discord, Google, GitHub, etc.)

---

📦 Installation
--------------

[](#-installation)

### 1. Créer un nouveau projet Laravel

[](#1-créer-un-nouveau-projet-laravel)

```
composer create-project laravel/laravel mon-serveur-cas
cd mon-serveur-cas
```

### 2. Installer le package

[](#2-installer-le-package)

```
composer require friezer-85/cas-oauth-laravel
```

### 3. Installer un provider Socialite

[](#3-installer-un-provider-socialite)

Selon le provider OAuth que vous souhaitez utiliser :

#### Discord

[](#discord)

```
composer require socialiteproviders/discord
```

#### GitHub

[](#github)

```
composer require socialiteproviders/github
```

#### Google

[](#google)

```
composer require socialiteproviders/google
```

#### Autres providers

[](#autres-providers)

Voir la liste complète sur [SocialiteProviders](https://socialiteproviders.com/)

---

⚙️ Configuration
----------------

[](#️-configuration)

### 1. Créer l'application OAuth

[](#1-créer-lapplication-oauth)

#### Pour Discord :

[](#pour-discord-)

1. Allez sur
2. Cliquez sur "New Application"
3. Donnez un nom à votre application
4. Allez dans "OAuth2" → "General"
5. Ajoutez l'URL de redirection : ```
    http://cas.example.com/oauth/callback

    ```

    (En production, remplacez par votre vrai domaine)
6. Notez votre **Client ID** et **Client Secret**

#### Pour Google :

[](#pour-google-)

1. Allez sur
2. Créez un nouveau projet
3. Activez "Google+ API"
4. Allez dans "Credentials" → "Create Credentials" → "OAuth client ID"
5. Ajoutez l'URL de redirection : ```
    http://cas.example.com/oauth/callback

    ```
6. Notez votre **Client ID** et **Client Secret**

#### Pour GitHub :

[](#pour-github-)

1. Allez sur
2. Cliquez sur "New OAuth App"
3. Remplissez les informations :
    - **Homepage URL** : `http://cas.example.com`
    - **Authorization callback URL** : `http://cas.example.com/oauth/callback`
4. Notez votre **Client ID** et **Client Secret**

### 2. Configuration du fichier .env

[](#2-configuration-du-fichier-env)

Ajoutez ces lignes à votre fichier `.env` :

```
# Provider OAuth à utiliser (discord, github, google, etc.)
OAUTH_PROVIDER=discord

# Credentials de votre application OAuth
OAUTH_CLIENT_ID=votre_client_id_ici
OAUTH_CLIENT_SECRET=votre_client_secret_ici

# Scopes OAuth (séparés par des virgules ou espaces)
# Discord :
OAUTH_SCOPES=identify,email

# Google :
# OAUTH_SCOPES=openid,profile,email

# GitHub :
# OAUTH_SCOPES=user:email

# Propriété utilisée pour générer le ticket CAS (défaut: id)
CAS_PROPERTY=id

# Paramètres OAuth personnalisés (optionnel)
# Format: key=value,key2=value2
OAUTH_PARAMS=
```

### 3. Configuration des services autorisés

[](#3-configuration-des-services-autorisés)

Éditez le fichier `config/services.php` et ajoutez :

```
