Download the PHP package cornell-custom-dev/laravel-cu-auth without Composer

On this page you can find all versions of the php package cornell-custom-dev/laravel-cu-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-cu-auth

CUAuth

Middleware for authorizing Laravel users.

Use Cases

Single Sign-On

Usage

See Authorization for details on how to log in remote users for local authorization.

See also: shibboleth configuration.


Routing

Any pages protected by middleware are automatically redirected to SSO. To directly trigger log in or log out, use the following routes (parameters are optional and will default to '/'):

Certs and Metadata (php-saml)

For using the PHP SAML Toolkit, the SAML keys and certs can be generated with the following command:

It is possible to have composer automatically install the keys on composer install by adding the following to the scripts section of composer.json, which will only install the keys if they do not already exist:

The default location for the SAML keys and certs is in storage/app/keys. This location is configurable in the config/cu-auth.php file or by setting the SAML_CERT_PATH in .env.


Local Testing (apache-shib)

For local testing where mod_shib is not available, the REMOTE_USER environment variable can be set to simulate Shibboleth authentication. Note that APP_ENV must be set to "local" for this to work and the config cache must be cleared when REMOTE_USER is changed.

Identity and Authorization

Once authenticated via SSO, the user's identity is available via the IdentityManager, which can be accessed via the app container.

The SAML attributes available are based on the CIT-documented list: https://it.cornell.edu/shibboleth/shibboleth-faq.

User authorization

If the site should manage authorization for users in the application, set config('cu-auth.require_local_user') to true:

Requiring a local user triggers the CUAuthenticated event when a user is authenticated via single sign-on. The site must register a listener for the CUAuthenticated event. This listener should look up the user in the database and log them in or create a user as needed.

AuthorizeUser is provided as a starting point for handling the CUAuthenticated event. It is simplistic and should be replaced with a site-specific implementation in the site code base. It demonstrates retrieving user data via the IdentityManager and creating a user if they do not exist.

Configuration

See config/cu-auth.php for configuration options, all of which can be set with environment variables.

To modify the default configuration, publish the configuration file:

To modify the PHP SAML Toolkit configuration, publish the configuration file:

AppTesters

Limits non-production access to users in the APP_TESTERS environment variable.

Usage

On non-production sites, the AppTesters middleware checks the "APP_TESTERS" environment variable for a comma-separated list of users. If a user is logged in and not in the list, the middleware will return an HTTP_FORBIDDEN response.

The field used for looking up users is netid by default. It is configured in config/cu-auth.php file as app_testers_field.

Local Login

For testing purposes, the environment variable "ALLOW_LOCAL_LOGIN" can be set to true to bypass the middleware for a currently authenticated user.

Livewire Auth

Blocks unauthenticated POST requests to /livewire/update, preventing anonymous users from interacting with Livewire components.

Usage


All versions of laravel-cu-auth with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-openssl Version *
illuminate/support Version ^12.0|^13.0
onelogin/php-saml Version ^4.3.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cornell-custom-dev/laravel-cu-auth contains the following files

Loading the files please wait ...