Changeset 7536


Ignore:
Timestamp:
Nov 28, 2018, 8:49:22 AM (3 years ago)
Author:
Nicklas Nordborg
Message:

References #2131: Add support for installing multiple authentication managers

Added an "external" version of the default username+password login form. This is is disabled by default but need to be used when another external authentication manager has been installed and some users still need to be able to login with username+password.

Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/clients/web/web-extensions.xml

    r7271 r7536  
    212212     * OnSave: Add callback functionality when saving from an edit dialog
    213213  -->
     214 
     215  <extension
     216    id="password-login-form"
     217    extends="net.sf.basedb.clients.web.login-form"
     218    >
     219    <about>
     220      <name>Password login form</name>
     221      <description>
     222        The regular username+password login form. This is disabled by
     223        default, but need to be enabled when installing an external
     224        authentication manager that is optional.
     225      </description>
     226    </about>
     227    <index>99</index>
     228    <action-factory>
     229      <factory-class>net.sf.basedb.clients.web.extensions.login.PasswordLoginFormFactory</factory-class>
     230    </action-factory>
     231  </extension>
    214232 
    215233  <extension
  • trunk/src/core/net/sf/basedb/core/Install.java

    r7471 r7536  
    119119    method.
    120120  */
    121   public static final int NEW_SCHEMA_VERSION = Integer.valueOf(141).intValue();
     121  public static final int NEW_SCHEMA_VERSION = Integer.valueOf(142).intValue();
    122122 
    123123  public static synchronized int createTables(SchemaGenerator.Mode mode, ProgressReporter progress,
     
    961961      }
    962962     
     963      Settings xtSettings = Application.getExtensionsManager().getSettings();
    963964      if (!update || schemaVersion.getSchemaVersion() < 108)
    964965      {
     
    966967        // base.config setting has enabled it when installing or updating from
    967968        // pre BASE 3.2
    968         Settings xtSettings = Application.getExtensionsManager().getSettings();
    969969        xtSettings.enableExtension("net.sf.basedb.core.db-log-manager",
    970970          "net.sf.basedb.core.log.db.DbLogManagerFactory".equals(Config.getString("changelog.factory")));
    971         xtSettings.save();
    972       }
     971      }
     972      if (!update || schemaVersion.getSchemaVersion() < 142)
     973      {
     974        // The Password login form should be disabled by default
     975        xtSettings.enableExtension("net.sf.basedb.clients.web.password-login-form", false);
     976      }
     977      xtSettings.save();
    973978     
    974979      if (progress != null)
  • trunk/src/core/net/sf/basedb/core/Update.java

    r7471 r7536  
    399399    </td>
    400400  </tr>
     401  <tr>
     402    <td>142</td>
     403    <td>
     404      Added the default password login form. It needs to be disabled by default which is
     405      triggered by the schema version update. No actual database change.
     406    </td>
     407  </tr>
    401408 
    402409  </table>
     
    646653        if (progress != null) progress.display((int)(progress_current), "--Updating schema version: " + schemaVersion + " -> 141...");
    647654        schemaVersion = setSchemaVersionInTransaction(session, 141);
     655        progress_current += progress_step;
     656      }
     657     
     658      if (schemaVersion < 142)
     659      {
     660        if (progress != null) progress.display((int)(progress_current), "--Updating schema version: " + schemaVersion + " -> 142...");
     661        schemaVersion = setSchemaVersionInTransaction(session, 142);
    648662        progress_current += progress_step;
    649663      }
  • trunk/www/main.jsp

    r7530 r7536  
    5050  import="net.sf.basedb.clients.web.servlet.RssNewsFeed"
    5151  import="net.sf.basedb.clients.web.extensions.login.LoginFormAction"
    52   import="net.sf.basedb.clients.web.extensions.login.LoginFormBean"
    5352  import="net.sf.basedb.clients.web.extensions.login.FieldInfo"
     53  import="net.sf.basedb.clients.web.extensions.login.PasswordLoginFormFactory"
    5454  import="net.sf.basedb.util.Values"
    5555  import="java.util.Date"
     
    111111  if (loginAction == null)
    112112  {
    113     LoginFormBean bean  = new LoginFormBean();
    114     bean.setRememberLastLogin(true);
    115     bean.setLoginField(FieldInfo.DEFAULT_LOGIN);
    116     bean.setPasswordField(FieldInfo.DEFAULT_PASSWORD);
    117     loginAction = bean;
    118     selectedLoginForm = "password";
     113    loginAction = PasswordLoginFormFactory.INSTANCE;
     114    selectedLoginForm = loginAction.getId();
    119115  }
    120116
  • trunk/www/switch.jsp

    r7531 r7536  
    3939  import="net.sf.basedb.clients.web.extensions.JspContext"
    4040  import="net.sf.basedb.clients.web.extensions.login.LoginFormAction"
    41   import="net.sf.basedb.clients.web.extensions.login.LoginFormBean"
     41  import="net.sf.basedb.clients.web.extensions.login.PasswordLoginFormFactory"
    4242  import="net.sf.basedb.clients.web.extensions.login.FieldInfo"
    4343  import="net.sf.basedb.util.Values"
     
    9191  if (loginAction == null)
    9292  {
    93     LoginFormBean bean  = new LoginFormBean();
    94     bean.setRememberLastLogin(true);
    95     bean.setLoginField(FieldInfo.DEFAULT_LOGIN);
    96     bean.setPasswordField(FieldInfo.DEFAULT_PASSWORD);
    97     loginAction = bean;
    98     selectedLoginForm = "password";
     93    loginAction = PasswordLoginFormFactory.INSTANCE;
     94    selectedLoginForm = loginAction.getId();
    9995  }
    10096  FieldInfo loginField = loginAction.getLoginField();
Note: See TracChangeset for help on using the changeset viewer.