rubycas/rubycas-server — pull request #109 by Slotos (2012-07-05 08:16:06+00:00)
Title: Extendable strategies interface (part of omniauth authenticator solution)

Summary of changes:
- Moved code that creates user session into separate method, making it possible to use it in sinatra extensions
- Moved logout code into separate method, using it in session creation method to trigger single sign out upon identity change
- Added login_links accessor, using it to gather and display login links for oauth providers
- Using bundler with `bin/rubycas-server` *Debatable*
- Activated sessions to track service and renew parameters through omniauth sequence, resetting them on login page visit. I remember meeting one use case that would redirect user to previously saved service which could seem illogical, however I've dismissed it at the time since it required direct url visiting, which is outside of regular user scenarios. Can't remember the case now. *Needs review*.
- Some minor changes, like path filters based on params hash, avoiding "no authenticators" error when there are only strategies etc.

Implemented generic omniauth (1.0+) strategy: https://github.com/Slotos/rubycas-strategy-omniauth. Tested it with facebook and twitter, but it should work with krb5 and cas omniauth strategies as well. Omniauth 1.0 version of LDAP authenticator should work too, given there is one.
Remote-to-local mapping expects SQL database and two tables: user table and token table. Extending functionality for other storage and schema options would be a good idea, once such need arises.

What I wish to do but may not have time to do it:
- Move all authenticators into strategies. Display login form only when at least one strategy have registered itself in login/pass authenticators list.

Another example of behaviour implemented with this interface would be https://github.com/Slotos/rubycas-strategy-impostor.