summaryrefslogtreecommitdiffstats
path: root/ipsilon/util
Commit message (Collapse)AuthorAgeFilesLines
...
* Databases must be configured in cherrypy.configSimo Sorce2014-10-061-34/+8
| | | | | | | | There was annoying duplicated init code in the data store classes that was unused. Just require configuration to be present in cherrypy.config or bail. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
* Make Transaction code more robustSimo Sorce2014-10-061-6/+8
| | | | | | | | Avoid raising exceptions when transactions are not found, just return no cookies or empty dicts with no transactions in them. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
* Fix transaction handling in providersSimo Sorce2014-10-061-3/+5
| | | | | | | | | | | | When a provider redirects to the login code, it must retain 'ownership' of the transaction, otherwise the login code will wipe the transaction data as sson as the authentication is completed but before the provider has completed its part of the transaction. Make sure the transaction code retrieves the 'owner' from the data for pre-existing transactions. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
* Add transactions supportSimo Sorce2014-09-242-0/+89
| | | | | | | | | | | | In some cases a user may end up having multiple login pags in diffeent tabs in the borwser (session restore after a crash, or simply opening multiple urls which all redirect to the same IdP). Without transactions multiple authentication requests in fly may step on each other causing potentially all of them to fail to properly authenticate and redirect back to the original web site. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
* Refactor the data store a bitSimo Sorce2014-09-243-321/+245
| | | | | | | | | | | Reduce code duplication, and clearly separates admin and user dbs. Move plugin wrapper away and let plugin code use native functions. This patch also changes the indexed data to use a uuid and assumes 2 identical uuid cannot be created concurrently. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
* Add abstraction class to handle cookiesSimo Sorce2014-09-241-0/+67
| | | | | | | This handles secure cokies with useful helpers and defaults. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
* Add error log facility to Log utilitySimo Sorce2014-09-241-1/+6
| | | | | | | Also improve debug errors by adding the originating function Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
* Cast db value to string before comparisonSimo Sorce2014-09-241-1/+1
| | | | | | | | Avoid false negatives when the sqlite3 db is 'smart' and automatically converts the type to integer. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
* Move user attribute storage into session functionsSimo Sorce2014-08-271-1/+19
| | | | | Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
* Use new Log class everywhereSimo Sorce2014-08-273-11/+6
| | | | | | | | | Replace copies of _debug function sprinkled all over the code with a single implementation Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com> - Removed replace of self._debug to self.debug
* Add Log class that can be inherited from safelySimo Sorce2014-08-271-0/+20
| | | | | Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
* Add External form auth pluginSimo Sorce2014-08-271-2/+2
| | | | | | | This plugin uses mod_intercept_form_submit to perform authentication. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
* Rework remote_login and remove protect decoratorSimo Sorce2014-08-272-6/+5
| | | | | | | | | | | | The protect decorator was not really being used for anything, remove it. Change the way UserSession's remote_login() works. If called now it either sets a REMOTE_USER (if found) or nukes the current user data in the session. This means this function can be safely called only in a login plugin now. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
* Fix referer checks with escaped URLsSimo Sorce2014-05-201-4/+16
| | | | | | | | | | | | | When a SP name included spaces the referer checker would fail to match the url. It would try to return a 403 error, unfortunately this would also trip as a return instead of an exception was used, ending up with a 500 error being returned to the user. Fix url checks by unquoting before comparing. Fix error reporting by rasing an exception when needed instead of returning. Signed-off-by: Simo Sorce <simo@redhat.com>
* Fix E256 with stricter pep8 error checkerSimo Sorce2014-05-202-2/+2
| | | | Signed-off-by: Simo Sorce <simo@redhat.com>
* Fix E713 with stricter pep8 error checkerSimo Sorce2014-05-201-1/+1
| | | | Signed-off-by: Simo Sorce <simo@redhat.com>
* Add New form helper to Page objectSimo Sorce2014-04-201-4/+19
| | | | | | | | This removes the need to define a root funciton only to redirect to a GET/POST one. Also adds basic CSRF protection if the page is declared a form. Signed-off-by: Simo Sorce <simo@redhat.com>
* Add infrastructure to delete plugin data by idSimo Sorce2014-04-042-0/+20
| | | | Signed-off-by: Simo Sorce <simo@redhat.com>
* Add racefree way to add a new unique data pointSimo Sorce2014-04-042-0/+33
| | | | | | | | | | | | | | Our schema gathers together data related to a service by using an ID column. This column cannot be unique or a primary key as the ID is repeated for each key/value pair in the datum group. Use a unique identifier to make sure we can let dqlite generate a new ID internally and then find out wat it is as race-free as possible. We keep this method in the data module so it can be changed later without affecting application logic. Signed-off-by: Simo Sorce <simo@redhat.com>
* Add common way to add a subtree to a pageSimo Sorce2014-03-281-0/+6
| | | | Signed-off-by: Simo Sorce <simo@redhat.com>
* Move admin_protect to a more generic moduleSimo Sorce2014-03-241-0/+11
| | | | Signed-off-by: Simo Sorce <simo@redhat.com>
* Add way to save user preferencesSimo Sorce2014-03-211-0/+33
| | | | Signed-off-by: Simo Sorce <simo@redhat.com>
* Add way to add data to the global login configSimo Sorce2014-03-202-0/+40
| | | | Signed-off-by: Simo Sorce <simo@redhat.com>
* Add functions to wipe and save plugin config dataSimo Sorce2014-03-202-0/+46
| | | | | | | This way all is needed is to instantiate a proper PluginObject from any provider and just call its functions Signed-off-by: Simo Sorce <simo@redhat.com>
* Add server-install plugin configuration supportSimo Sorce2014-03-201-0/+10
| | | | | | | Automatically find plugins installed in the system and exposes their installation and configuration functions through the installer. Signed-off-by: Simo Sorce <simo@redhat.com>
* Fix default and example pathsSimo Sorce2014-03-131-6/+2
| | | | Signed-off-by: Simo Sorce <simo@redhat.com>
* Add a way to return the email address of the userSimo Sorce2014-03-021-0/+7
| | | | Signed-off-by: Simo Sorce <simo@redhat.com>
* Create a user facility in the sessionSimo Sorce2014-03-021-9/+13
| | | | | | | This way all identification data about the user can be managed in a single place and be erased/replaced at login time. Signed-off-by: Simo Sorce <simo@redhat.com>
* Add Service Provider classSimo Sorce2014-02-262-4/+27
| | | | | | This class allows to represent a service provider and its associated policy Signed-off-by: Simo Sorce <simo@redhat.com>
* Initial SAML2 providerSimo Sorce2014-02-241-2/+5
| | | | Signed-off-by: Simo Sorce <simo@redhat.com>
* Add way to tell if the session is anonymousSimo Sorce2014-02-241-0/+6
| | | | Signed-off-by: Simo Sorce <simo@redhat.com>
* Add provider plugins loaderSimo Sorce2014-02-242-0/+73
| | | | Signed-off-by: Simo Sorce <simo@redhat.com>
* Use cherrypy handlers to render error pagesSimo Sorce2014-02-241-0/+53
| | | | | | | Replaces custom code to render 401 Unauthorized page as well as adds 400 and 500 handlers Signed-off-by: Simo Sorce <simo@redhat.com>
* Improve handing of session dataSimo Sorce2014-02-241-2/+31
| | | | | | | Add functions to store data in an organized way so that multiple plugins can store data w/o stomping on each other. Signed-off-by: Simo Sorce <simo@redhat.com>
* Add _debug facility to the Page classSimo Sorce2014-02-241-0/+4
| | | | | | | Use this instead of th misleading "_log" name. These really are just debugging statements not normal logging. Signed-off-by: Simo Sorce <simo@redhat.com>
* Move default template arguments to its own functionSimo Sorce2014-02-241-1/+11
| | | | | | | This way it is clearer what the defaults are, plus subclasses can override the defaults if they so choose. Signed-off-by: Simo Sorce <simo@redhat.com>
* Implement login plugin infrastructureSimo Sorce2014-01-242-16/+49
| | | | Signed-off-by: Simo Sorce <simo@redhat.com>
* Better infrastructure to load pluginsSimo Sorce2014-01-242-31/+165
| | | | Signed-off-by: Simo Sorce <simo@redhat.com>
* Use pep8 checkPetr Vobornik2014-01-244-2/+7
| | | | | Signed-off-by: Petr Vobornik <pvoborni@redhat.com> Signed-off-by: Simo Sorce <simo@redhat.com>
* Use pylint checkPetr Vobornik2014-01-244-8/+10
| | | | | Signed-off-by: Petr Vobornik <pvoborni@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Fix ImportsSimo Sorce2014-01-242-4/+4
| | | | | | Based on patches by Petr Voborni Signed-off-by: Simo Sorce <simo@redhat.com>
* Rename src package to ipsilonSimo Sorce2014-01-245-0/+331
Signed-off-by: Petr Vobornik <pvoborni@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>