Package org.geoserver.security.password

Examples of org.geoserver.security.password.MasterPasswordConfig


        this.securityConfig = new SecurityManagerConfig(config);
        this.initialized = true;
    }

    void init(MasterPasswordConfig config) {
        this.masterPasswordConfig = new MasterPasswordConfig(config);
    }
View Full Code Here


    /**
     * Returns the master password configuration.
     */
    public MasterPasswordConfig getMasterPasswordConfig() {
        return new MasterPasswordConfig(masterPasswordConfig);
    }
View Full Code Here

        //validate the new config
        MasterPasswordConfigValidator validator = new MasterPasswordConfigValidator(this);
        validator.validateMasterPasswordConfig(config);

        //save the current config to fall back to               
        MasterPasswordConfig oldConfig = new MasterPasswordConfig(this.masterPasswordConfig);
        String oldMasterPasswdDigest = masterPasswdDigest;

        KeyStoreProvider ksProvider = getKeyStoreProvider();
        synchronized (ksProvider) {
            ksProvider.prepareForMasterPasswordChange(currPasswd, newPasswdConfirm);
            try {
                if (!mpProviderConfig.isReadOnly()) {
                    //write it back first
                    try {
                        mpProvider.setMasterPassword(newPasswd);
                    } catch (Exception e) {
                        throw new IOException(e);
                    }
                }

                //save out the master password config
                saveMasterPasswordConfig(config);

                //redigest
                masterPasswdDigest = computeAndSaveMasterPasswordDigest(newPasswdConfirm);

                //commit the password change to the keystore
                ksProvider.commitMasterPasswordChange();

                if (!config.getProviderName().equals(oldConfig.getProviderName())){
                    //TODO: reencrypt the keystore? restart the server?
                    //updateConfigurationFilesWithEncryptedFields();
                }
            }
            catch(IOException e) {
View Full Code Here

     * Saves master password config out directly, not during a password change.
     */
    public void saveMasterPasswordConfig(MasterPasswordConfig config) throws IOException {
        xStreamPersist(new File(getSecurityRoot(), MASTER_PASSWD_CONFIG_FILENAME),
                config, globalPersister());
        this.masterPasswordConfig = new MasterPasswordConfig(config);
    }
View Full Code Here

            if (propFile.exists())                 
                userprops = Util.loadPropertyFile(propFile);           
            mpProvider.setMasterPassword(extractMasterPasswordForMigration(userprops));
        }

        MasterPasswordConfig mpConfig = new MasterPasswordConfig();
        mpConfig.setProviderName(mpProviderConfig.getName());
        saveMasterPasswordConfig(mpConfig);

        // check for services.properties, create if necessary
        File serviceFile = new File(getSecurityRoot(), "services.properties");
        if (serviceFile.exists()==false) {
View Full Code Here

        form.add(new HelpLink("passwordPoliciesHelp").setDialog(dialog));

        form.add(new SubmitLink("save", form) {
            @Override
            public void onSubmit() {
              MasterPasswordConfig config = (MasterPasswordConfig) getForm().getModelObject();
              try {
                  getSecurityManager().saveMasterPasswordConfig(config);
                  doReturn();
              } catch (Exception e) {
                  error(e);
View Full Code Here

        Form form = new Form("form", new CompoundPropertyModel(configModel));
        add(form);

        form.add(new Label("providerName"));
       
        MasterPasswordConfig config = configModel.getObject();
        MasterPasswordProviderConfig providerConfig = null;
        try {
             providerConfig =
                 getSecurityManager().loadMasterPassswordProviderConfig(config.getProviderName());
        } catch (IOException e) {
            throw new WicketRuntimeException(e);
        }

        //TODO: this will cause the master password to stored as a string in plain text, without the
        // ability to scramble it... not much we can do because wicket works with strings...
        // potentially look into a way to store as char or byte array so string never gets
        // created
        form.add(new PasswordTextField("currentPassword", new Model()));
        form.add(new PasswordTextField("newPassword", new Model())
            .setEnabled(!providerConfig.isReadOnly()));
        form.add(new PasswordTextField("newPasswordConfirm", new Model()));

        form.add(new SubmitLink("save", form) {
            @Override
            public void onSubmit() {
                Form f = getForm();
                // @Justin, we cannot use getDefaultModelObjectAsString() because of special chars.
                // example: The password "mcrmcr&1" is converted to "mcrmcr&1".
                String currPasswd =
                    //f.get("currentPassword").getDefaultModelObjectAsString();
                    (String) f.get("currentPassword").getDefaultModelObject();   
                String newPasswd =
                    //f.get("newPassword").getDefaultModelObjectAsString();
                    (String) f.get("newPassword").getDefaultModelObject();
                String newPasswdConfirm =
                    // f.get("newPasswordConfirm").getDefaultModelObjectAsString();
                    (String) f.get("newPasswordConfirm").getDefaultModelObject();

                MasterPasswordConfig mpConfig = (MasterPasswordConfig) getForm().getModelObject();
                try {
                    getSecurityManager().saveMasterPasswordConfig(mpConfig, currPasswd.toCharArray(),
                        newPasswd != null ? newPasswd.toCharArray() : null,
                        newPasswdConfirm.toCharArray());
                    doReturn();
View Full Code Here

TOP

Related Classes of org.geoserver.security.password.MasterPasswordConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.