-
Notifications
You must be signed in to change notification settings - Fork 0
Laravel 13 + related updates #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
24bdaf7
Address principalName / email details
woodseowl e373e1c
Align composer.json and configurations
woodseowl 38cd0d6
Fix test deprecations
woodseowl 8c6d1af
Deprecate usage of uniqueUid
woodseowl b49bcf7
Use mail instead of email internally for RemoteIdentity clarity
woodseowl 5010c05
RemoteIdentity->principleName shouldn't use uid
woodseowl 794fa46
Github workflow extension adjustments
woodseowl 79372b1
Add LivewireAuth
woodseowl 6cdbffd
Deprecate IdentityManager::hasIdentity(), renamed to hasRemoteIdentity()
woodseowl 52ed165
Add ChecksLocalLogin trait and update LivewireAuth, CUAuth to support…
woodseowl 1e2534d
CLAUDE.md file
woodseowl 55d1034
Consolidate requireLivewireAuth() out of CUAuthServiceProvider
woodseowl 4e98275
Linting
woodseowl ee85a6d
Better documentation for hasIdentity() deprecation
woodseowl 28f5be1
Clarify RemoteIdentity properties
woodseowl 478e997
Address PR feedback
woodseowl 4933a9a
Security fix version for php-saml
woodseowl f79e013
Deprecate RemoteIdentity->email()
woodseowl d2b5c3b
Merge branch 'updates-may2026' into livewire-auth
woodseowl 517087d
Deprecate RemoteIdentity->email()
woodseowl 4b6776a
AuthorizeUser example manages email alias
woodseowl 09133e8
Deprecate RemoteIdentity->email()
woodseowl 9e5cf06
Merge branch 'updates-may2026' into livewire-auth
woodseowl 22561fc
README for LivewireAuth
woodseowl aeed711
Merge pull request #4 from CornellCustomDev/livewire-auth
woodseowl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,3 @@ trim_trailing_whitespace = false | |
|
|
||
| [*.{yml,yaml}] | ||
| indent_size = 2 | ||
|
|
||
| [*.json] | ||
| indent_size = 2 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Commands | ||
|
|
||
| ```bash | ||
| # Run all tests | ||
| composer test | ||
|
|
||
| # Run a single test file | ||
| vendor/bin/phpunit tests/Feature/AppTestersTest.php | ||
|
|
||
| # Run a single test by name | ||
| vendor/bin/phpunit --filter testMethodName | ||
|
|
||
| # Lint / fix code style | ||
| vendor/bin/pint | ||
|
|
||
| # Full CI (prepare + test) | ||
| composer ci | ||
| ``` | ||
|
|
||
| ## Architecture | ||
|
|
||
| This is a **Laravel package** (not an application) providing SSO authentication middleware for Cornell University apps. The namespace is `CornellCustomDev\LaravelStarterKit\CUAuth\`. | ||
|
|
||
| ### Core abstraction: `IdentityManager` | ||
|
|
||
| `src/Managers/IdentityManager.php` is the central interface. `CUAuthServiceProvider` binds one concrete implementation as a singleton based on `CU_AUTH_IDENTITY_MANAGER`: | ||
|
|
||
| - **`ShibIdentityManager`** (`apache-shib`) — reads Shibboleth attributes from Apache server variables (`$_SERVER`). For local development, falls back to `REMOTE_USER` env var when `APP_ENV != production`. | ||
| - **`SamlIdentityManager`** (`php-saml`) — uses the OneLogin PHP-SAML toolkit for SAML SP flows. | ||
|
|
||
| Both return a `RemoteIdentity` data object (readonly class) that normalizes identity data from either IdP. | ||
|
|
||
| ### Authentication flow | ||
|
|
||
| 1. **`CUAuth` middleware** guards routes. It checks `IdentityManager::hasRemoteIdentity()` and redirects to `cu-auth.sso-login` if not authenticated. If `allow_local_login = true`, a locally-authenticated Laravel user bypasses the SSO check entirely (`isLoggedInLocally()` in the `ChecksLocalLogin` trait, shared with `LivewireAuth`). | ||
| 2. If `require_local_user = true`, the middleware fires the `CUAuthenticated` event after SSO auth. The consuming app must listen for this event to log in or create a local Laravel user. | ||
| 3. **`AppTesters` middleware** can be stacked after `CUAuth` to restrict non-production access to users listed in `APP_TESTERS`. | ||
|
|
||
| ### Routes registered by the package | ||
|
|
||
| - `GET /sso/login` → `AuthController::login` (redirects to IdP) | ||
| - `GET /sso/logout` → `AuthController::logout` (SLO) | ||
| - `GET/POST /sso/acs` → `AuthController::acs` (SAML assertion consumer / Shib return; CSRF-exempt) | ||
| - `GET /sso/metadata` → `AuthController::metadata` (SAML SP metadata) | ||
|
|
||
| ### `RemoteIdentity` key methods | ||
|
|
||
| - `id()` — NetID or CWID (unique within the IdP) | ||
| - `principalName()` — `eduPersonPrincipalName` (e.g., `netid@cornell.edu`); unique across Cornell and Weill IdPs | ||
| - `email()` — returns `principalName` if set, else alias mail | ||
| - `uniqueUid()` — **deprecated**; use `principalName()` for cross-IdP uniqueness | ||
|
|
||
| ### Livewire support | ||
|
|
||
| Setting `REQUIRE_LIVEWIRE_AUTH=true` makes the service provider override Livewire's update route to require `LivewireAuth` middleware, blocking unauthenticated POSTs to `/livewire/update`. | ||
|
|
||
| ### Testing | ||
|
|
||
| Tests use Orchestra Testbench. `FeatureTestCase` sets up an in-memory SQLite database and loads Laravel's default migrations. Unit tests extend `UnitTestCase`. The package has no database migrations of its own. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,35 +1,47 @@ | ||
| { | ||
| "name": "cornell-custom-dev/laravel-cu-auth", | ||
| "description": "A Laravel package for authentication and identity management at Cornell University", | ||
| "license": "MIT", | ||
| "type": "library", | ||
| "require": { | ||
| "php": "^8.2", | ||
| "ext-openssl": "*", | ||
| "illuminate/support": "^11.0|^12.0", | ||
| "onelogin/php-saml": "^4.3.1" | ||
| }, | ||
| "require-dev": { | ||
| "laravel/pint": "^1.20", | ||
| "orchestra/testbench": "^9.0|^10.0", | ||
| "phpunit/phpunit": "^10.5|^11.5" | ||
| }, | ||
| "autoload": { | ||
| "psr-4": { | ||
| "CornellCustomDev\\LaravelStarterKit\\CUAuth\\": "src" | ||
| } | ||
| }, | ||
| "autoload-dev": { | ||
| "psr-4": { | ||
| "CornellCustomDev\\LaravelStarterKit\\CUAuth\\Tests\\": "tests" | ||
| } | ||
| }, | ||
| "extra": { | ||
| "laravel": { | ||
| "providers": [ | ||
| "CornellCustomDev\\LaravelStarterKit\\CUAuth\\CUAuthServiceProvider" | ||
| ] | ||
| } | ||
| }, | ||
| "prefer-stable": true | ||
| "name": "cornell-custom-dev/laravel-cu-auth", | ||
| "description": "A Laravel package for authentication and identity management at Cornell University", | ||
| "license": "MIT", | ||
| "type": "library", | ||
| "require": { | ||
| "php": "^8.3", | ||
| "ext-openssl": "*", | ||
| "illuminate/support": "^12.0|^13.0", | ||
| "onelogin/php-saml": "^4.3.2" | ||
| }, | ||
| "require-dev": { | ||
| "laravel/pint": "^1.20", | ||
| "orchestra/testbench": "^10.0|^11.0", | ||
| "phpunit/phpunit": "^11.5|^12.5" | ||
| }, | ||
| "autoload": { | ||
| "psr-4": { | ||
| "CornellCustomDev\\LaravelStarterKit\\CUAuth\\": "src" | ||
| } | ||
| }, | ||
| "autoload-dev": { | ||
| "psr-4": { | ||
| "CornellCustomDev\\LaravelStarterKit\\CUAuth\\Tests\\": "tests" | ||
| } | ||
| }, | ||
| "scripts": { | ||
| "post-autoload-dump": [ | ||
| "@clear", | ||
| "@prepare" | ||
| ], | ||
| "clear": "@php vendor/bin/testbench package:purge-skeleton --ansi", | ||
| "prepare": "@php vendor/bin/testbench package:discover --ansi", | ||
| "test": "@php vendor/bin/phpunit -c ./ --color" | ||
| }, | ||
| "config": { | ||
| "sort-packages": true | ||
| }, | ||
| "extra": { | ||
| "laravel": { | ||
| "providers": [ | ||
| "CornellCustomDev\\LaravelStarterKit\\CUAuth\\CUAuthServiceProvider" | ||
| ] | ||
| } | ||
| }, | ||
| "prefer-stable": true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.