Code Monkey home page Code Monkey logo

pcas's People

Contributors

ademarco avatar aritomelo avatar drupol avatar imanoleguskiza avatar netlooker avatar pfrenssen avatar upchuk avatar voidtek avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pcas's Issues

Decouple the user object from Symfony

The PCasUser object is adhering to Symfony's UserInterface specification. This makes it less flexible to use in other PHP frameworks, especially since this interface defines a number of methods which doesn't make sense in the scope of CAS authentication, such as ::getPassword() and ::getSalt().

I think it would be a good idea to create a Symfony-specific component which has this library as a dependency and wraps the PCas-classes inside versions that comply with Symfony. The classes PCasGuardAuthenticator and PCasUserProvider also seem to have little use outside of Symfony.

Remove dependency to HttpClient from protocol

In order to clean and make the use of the library easier, I would like to remove the duplicate dependency to the HttpClient from the Protocol object and use the one provided in the PCas constructor.

Demo server and client not compatible with PHP 5.6

Both the demo-server and demo-client applications are using PHP7-specific functionality so they are not compatible with the PHP5.6 target which is specified in the Composer manifest.

More specifically, they are using the null coalescing operator ?? in the bin/console launchers. This is a feature that was added in PHP 7.0.

Ref. Null coalescing operator

Don't use the DI container for non-singleton objects

There are a number of classes declared as services on the DI container which are not designed to be used as such:

  • Symfony\Component\Serializer\Serializer: this class requires an array of $normalizers and $decoders to be passed in and these are stored locally on the object. This implies that for every set of normalizers and decoders a new instance of the class is expected to be instantiated. This is not compatible with the singleton model of services. If you need to retrieve an instance of this class through the container, you can use a factory service that will pass you a fresh instance.
  • Symfony\Component\Serializer\Encoder\XmlEncoder: this has a whole bunch of local properties which are not intended to be modified by external code. This is not intended to be used as a singleton. Exposing this on the container can have unintended side effects, for example if another class calls ::setRootNodeName() then it will overwrite the $this->rootNodeName local property and any subsequent calls to ::encode() by the PCas library will not give the expected results.
  • Symfony\Component\Serializer\Encoder\JsonEncoder: upon instantiation this accepts an encoder and a decoder, so this is not suitable to be used as a singleton, if it is really necessary to retrieve this class through the container it should be handled through a factory class.
  • Symfony\Component\Serializer\Normalizer\ObjectNormalizer: this object has a bunch of local properties which should not be accessible by other users of the container, for example a call to ::setSerializer() by external code will make this service unusable for the PCas library.

Instead of exposing these on the container they should be stored in local protected properties by the consumers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.