openeuropa / pcas
pCas, a PHP CAS library
Installs: 1 620
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 16
Forks: 4
Open Issues: 0
Requires
- ext-simplexml: *
- php-http/client-common: ^1.7
- php-http/discovery: ^1.4
- php-http/httplug: ^1.1
- psr/log: ^1.0
- psr/simple-cache: ^1.0
- symfony/config: ^2.2|^3.4|^4.0
- symfony/dependency-injection: ^3.4|^4.0
- symfony/http-foundation: ^3.4|^4.0
- symfony/security: ^3.4|^4.0
- symfony/serializer: ^3.4|^4.0
- symfony/yaml: ^3.4|^4.0
Requires (Dev)
- openeuropa/code-review: ~1.0@alpha
- php-http/guzzle6-adapter: ~1.1.1
- phpspec/phpspec: ~3.4|~4.3|~5.0
- scrutinizer/ocular: ~1.4
- sebastian/phpcpd: ~3.0
- sensiolabs/security-checker: ~4.0
This package is auto-updated.
Last update: 2022-02-01 13:13:09 UTC
README
pCAS, a CAS library for PHP.
Installation
composer require openeuropa/pcas
Usage
In order to use the pCAS library you need a session object that implements
Symfony's SessionInterface
.
You can pass that object to the pCAS factory class as shown below:
<?php use OpenEuropa\pcas\PCasFactory; use Symfony\Component\HttpFoundation\Session\Session; $factory = new PCasFactory(new Session());
You can access a fully functional pCAS library as shown below:
<?php $pcas = $factory->getPCas();
The pCAS factory object also accepts the following configuration parameters:
Parameter | Description |
---|---|
base_url |
The CAS service base URL. It defaults to http://127.0.0.1:8000 |
protocol |
The CAS protocol specification. It defaults to this list |
You can set those parameters as shown below:
<?php use OpenEuropa\pcas\PCasFactory; use Symfony\Component\HttpFoundation\Session\Session; $factory = new PCasFactory( new Session(), 'http://my-cas-server.com', // This is your custom base_url parameter. [...] // This is your custom protocol parameter. ); $pcas = $factory->getPCas();
Both parameters are optional, although you'll surely want to set base_url
to a different value.
Demo
Requirements:
Copy docker-compose.yml.dist into docker-compose.yml.
You can make any alterations you need for your local Docker setup. However, the defaults should be enough to set the project up.
The pCAS library is bundled with two independent Symfony app:
- demo-client: A basic web app that can authenticate to a CAS server to access specific pages.
- demo-server: A basic CAS server.
In order to test pCAS library, you must run the server:
cd demo-server
composer install
php bin/console server:run 127.0.0.1:8001
Then run the web app:
cd demo-client
composer install
php bin/console server:run 127.0.0.1:8000
Then go on http://127.0.0.1:8000.
You can also test it against ECAS, the authentication service from European Commission by updating the file .env
in
demo-client
directory. If this file doesn't exists, you can create it from .env.dist
.
The file must contains:
APP_ENV=ec
Run the tests
composer install ./vendor/bin/grumphp run
Changelog
The changelog is generated using a local docker installation which installs muccg/docker-github-changelog-generator
This reads the Github API for the required repository and writes the CHANGELOG.md to the root of the repository.
Prerequisites
- Local Docker machine running.
- A Github Access Token should be generated and exported (or written to
~/.gitconfig
) asCHANGELOG_GITHUB_TOKEN=<YOUR TOKEN HERE>
Before tagging a new release export the following:
$ export CHANGELOG_GITHUB_TOKEN=<YOUR TOKEN HERE>
$ export CHANGELOG_FUTURE_RELEASE=0.1.0
The changelog can then be generated by running:
$ composer run-script changelog