Package org.geoserver.security.password

Examples of org.geoserver.security.password.GeoServerPasswordEncoder


    @Override
    public void initializeFromConfig(SecurityNamedServiceConfig config) throws IOException {
        this.name=config.getName();
        SecurityUserGroupServiceConfig ugConfig =(SecurityUserGroupServiceConfig) config;       
        passwordEncoderName=ugConfig.getPasswordEncoderName();
        GeoServerPasswordEncoder enc = getSecurityManager().loadPasswordEncoder(passwordEncoderName);

        if (enc.getEncodingType()==PasswordEncodingType.ENCRYPT) {
            KeyStoreProvider prov = getSecurityManager().getKeyStoreProvider();
            String alias = prov.aliasForGroupService(name);
            if (prov.containsAlias(alias)==false) {
                prov.setUserGroupKey(name,
                    getSecurityManager().getRandomPassworddProvider().getRandomPasswordWithDefaultLength());
                prov.storeKeyStore();
            }
        }
        enc.initializeFor(this);
        passwordValidatorName=ugConfig.getPasswordPolicyName();
        toBeEncrypted = (((MemoryUserGroupServiceConfigImpl)config).getToBeEncrypted());
    }
View Full Code Here


        String encrypterName =config.getConfigPasswordEncrypterName();
        if (isNotEmpty(encrypterName)==false) {
            throw createSecurityException(PASSWORD_ENCODER_REQUIRED);
        }
       
        GeoServerPasswordEncoder encoder = null;
        try {
            encoder = manager.loadPasswordEncoder(config.getConfigPasswordEncrypterName());
        } catch (NoSuchBeanDefinitionException ex) {
            throw createSecurityException(INVALID_PASSWORD_ENCODER_$1, encrypterName);
        }
        if (encoder == null) {
            throw createSecurityException(INVALID_PASSWORD_ENCODER_$1, encrypterName);
        }

        if (!encoder.isReversible()) {
            throw createSecurityException(INVALID_PASSWORD_ENCODER_$1, encrypterName);
        }

        if (!manager.isStrongEncryptionAvailable()) {
            if (encoder!=null && encoder.isAvailableWithoutStrongCryptogaphy()==false) {
                throw createSecurityException(INVALID_STRONG_CONFIG_PASSWORD_ENCODER);
            }
        }
       
        String roleServiceName = config.getRoleServiceName();
View Full Code Here

        }     
    }

    public void validate(SecurityUserGroupServiceConfig config) throws SecurityConfigException {
        String encoderName =config.getPasswordEncoderName();
        GeoServerPasswordEncoder encoder = null;
        if (isNotEmpty(encoderName)) {
            try {
                encoder = manager.loadPasswordEncoder(encoderName);
            } catch (NoSuchBeanDefinitionException ex) {
                throw createSecurityException(INVALID_CONFIG_PASSWORD_ENCODER_$1, encoderName);
            }
            if (encoder == null) {
                throw createSecurityException(INVALID_CONFIG_PASSWORD_ENCODER_$1, encoderName);
            }
        } else {
            throw createSecurityException(PASSWD_ENCODER_REQUIRED_$1, config.getName());
        }
       
        if (!manager.isStrongEncryptionAvailable()) {
            if (encoder!=null && encoder.isAvailableWithoutStrongCryptogaphy()==false) {
                throw createSecurityException(INVALID_STRONG_PASSWORD_ENCODER);
            }
        }
       
        String policyName= config.getPasswordPolicyName();
View Full Code Here

       
       
        assertFalse(tester.getComponentFromLastRenderedPage("form:username").isEnabled());

        tester.assertModelValue("form:username", "user1");
        GeoServerPasswordEncoder encoder = (GeoServerPasswordEncoder)
                GeoServerExtensions.bean(ugService.getPasswordEncoderName());
        String enc = (String) tester.getComponentFromLastRenderedPage("form:password").getDefaultModelObject();
        assertTrue(encoder.isPasswordValid(enc,"11111", null));
        enc = (String) tester.getComponentFromLastRenderedPage("form:confirmPassword").getDefaultModelObject();
        assertTrue(encoder.isPasswordValid(enc,"11111", null));
        tester.assertModelValue("form:enabled", Boolean.TRUE);
       
        newFormTester();       
        form.setValue("enabled", false);
        //addUserProperty("coord", "10 10");
View Full Code Here

TOP

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

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.