Implement change registration
[cascardo/ipsilon.git] / ipsilon / providers / openidp.py
index f79435f..8f74578 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2014  Ipsilon project Contributors, for licensee see COPYING
+# Copyright (C) 2014 Ipsilon project Contributors, for license see COPYING
 
 from __future__ import absolute_import
 
@@ -141,8 +141,12 @@ class Installer(ProviderInstaller):
     def install_args(self, group):
         group.add_argument('--openid', choices=['yes', 'no'], default='yes',
                            help='Configure OpenID Provider')
+        group.add_argument('--openid-dburi',
+                           help='OpenID database URI')
+        group.add_argument('--openid-extensions', default='',
+                           help='List of OpenID Extensions to enable')
 
-    def configure(self, opts):
+    def configure(self, opts, changes):
         if opts['openid'] != 'yes':
             return
 
@@ -158,7 +162,11 @@ class Installer(ProviderInstaller):
         po.wipe_data()
         po.wipe_config_values()
         config = {'endpoint url': url,
-                  'identity_url_template': '%sid/%%(username)s' % url}
+                  'identity url template': '%sid/%%(username)s' % url,
+                  'database url': opts['openid_dburi'] or
+                  opts['database_url'] % {
+                      'datadir': opts['data_dir'], 'dbname': 'openid'},
+                  'enabled extensions': opts['openid_extensions']}
         po.save_plugin_config(config)
 
         # Update global config to add login plugin