Package org.geoserver.security

Examples of org.geoserver.security.KeyStoreProvider


        passwordEncoderName=((SecurityUserGroupServiceConfig)config).getPasswordEncoderName();
        passwordValidatorName=((SecurityUserGroupServiceConfig)config).getPasswordPolicyName();
       
        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);
       
        if (config instanceof XMLSecurityServiceConfig) {
View Full Code Here


                createTablesIfRequired((JDBCSecurityServiceConfig)config);
            }
           
            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=jdbcConfig.getPasswordPolicyName();
View Full Code Here

//        }
//        assertFalse(fail);
       
        String password = "testpassword";
        char [] passwordArray = password.toCharArray();
        KeyStoreProvider keyStoreProvider = getSecurityManager().getKeyStoreProvider();
        keyStoreProvider.setUserGroupKey(service.getName(), password.toCharArray());
       
        GeoServerMultiplexingPasswordEncoder encoder3 = new GeoServerMultiplexingPasswordEncoder(getSecurityManager(),service);
       
        for (GeoServerPBEPasswordEncoder encoder: getPBEEncoders()) {
            encoder.initializeFor(service);
                        
            assertEquals(PasswordEncodingType.ENCRYPT,encoder.getEncodingType());
            assertEquals(encoder.getKeyAliasInKeyStore(),
                keyStoreProvider.aliasForGroupService(service.getName()));

            GeoServerPBEPasswordEncoder encoder2 = (GeoServerPBEPasswordEncoder)
                getSecurityManager().loadPasswordEncoder(encoder.getName());
            encoder2.initializeFor(service);
       
View Full Code Here

                        createStrongPbePasswordEncoder(secMgr), createDigestPasswordEncoder(secMgr));
                }
            }).anyTimes();
   
        //keystore provider
        KeyStoreProvider keyStoreProvider = createNiceMock(KeyStoreProvider.class);
        expect(keyStoreProvider.isKeyStorePassword(aryEq("geoserver".toCharArray())))
            .andReturn(true).anyTimes();
        expect(keyStoreProvider.containsAlias(KeyStoreProviderImpl.CONFIGPASSWORDKEY))
            .andReturn(true).anyTimes();;
        expect(keyStoreProvider.getSecretKey(KeyStoreProviderImpl.CONFIGPASSWORDKEY))
            .andReturn(new SecretKeySpec(toBytes("geoserver".toCharArray()),"PBE")).anyTimes();
        expect(keyStoreProvider.hasUserGroupKey(XMLUserGroupService.DEFAULT_NAME))
            .andReturn(true).anyTimes();
   
        String alias = "ugServiceAlias";
        expect(keyStoreProvider.aliasForGroupService(XMLUserGroupService.DEFAULT_NAME))
            .andReturn(alias).anyTimes();
        expect(keyStoreProvider.containsAlias(alias)).andReturn(true).anyTimes();;
        expect(keyStoreProvider.getSecretKey(alias)).andReturn(
                new SecretKeySpec(toBytes("geoserver".toCharArray()),"PBE")).anyTimes();
        expect(secMgr.getKeyStoreProvider()).andReturn(keyStoreProvider).anyTimes();
       
        replay(keyStoreProvider, masterPasswdProvider, ugStore, ugConfig, roleStore, authProvider,
            authProviderConfig, filterConfig, passwdValidator, masterPasswdPolicyConfig, appContext,
View Full Code Here

        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

TOP

Related Classes of org.geoserver.security.KeyStoreProvider

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.