Examples of JDBCConnectAuthProviderConfig


Examples of org.geoserver.security.jdbc.config.JDBCConnectAuthProviderConfig

    };
       
   
    @Override
    protected SecurityNamedServiceConfig createNewConfigObject() {
        return new JDBCConnectAuthProviderConfig();
    }
View Full Code Here

Examples of org.geoserver.security.jdbc.config.JDBCConnectAuthProviderConfig

    }

    @Override
    public void initializeFromConfig(SecurityNamedServiceConfig config) throws IOException {
        super.initializeFromConfig(config);
        JDBCConnectAuthProviderConfig jdbcConfig = (JDBCConnectAuthProviderConfig) config;
        userGroupServiceName=jdbcConfig.getUserGroupServiceName();
        connectUrl=jdbcConfig.getConnectURL();
        driverClassName=jdbcConfig.getDriverClassName();
        try {
            Class.forName(driverClassName);
        } catch (ClassNotFoundException e) {
            throw new IOException(e);
        }
View Full Code Here

Examples of org.geoserver.security.jdbc.config.JDBCConnectAuthProviderConfig

        return config;
    }
   
    @Override
    protected SecurityAuthProviderConfig createAuthConfig(String name, Class<?> aClass,String userGroupServiceName) {
        JDBCConnectAuthProviderConfig config = new JDBCConnectAuthProviderConfig();
        config.setName(name);
        config.setClassName(aClass.getName());
        config.setUserGroupServiceName(userGroupServiceName);       
        return config;
    }
View Full Code Here

Examples of org.geoserver.security.jdbc.config.JDBCConnectAuthProviderConfig

    }

    @Override
    public void testAuthenticationProvider() throws IOException {
        super.testAuthenticationProvider();
        JDBCConnectAuthProviderConfig config =
                (JDBCConnectAuthProviderConfig) createAuthConfig("jdbcprov", JDBCConnectAuthProvider.class, "default");
       
        config.setConnectURL("jdbc:connect");
       
        JdbcSecurityConfigValidator validator = new JdbcSecurityConfigValidator(getSecurityManager());
       
        try {           
            config.setDriverClassName("");
            //getSecurityManager().saveAuthenticationProvider(config);
            validator.validateAddAuthProvider(config);
            fail();
        } catch (SecurityConfigException ex) {
            assertEquals( DRIVER_CLASSNAME_REQUIRED, ex.getId());
            assertEquals(0, ex.getArgs().length);
        }

        config.setDriverClassName("a.b.c");
        try {           
            //getSecurityManager().saveAuthenticationProvider(config);
            validator.validateAddAuthProvider(config);
            fail();
        } catch (SecurityConfigException ex) {
            assertEquals( DRIVER_CLASS_NOT_FOUND_$1, ex.getId());
            assertEquals("a.b.c", ex.getArgs()[0]);
        }

        try {           
            config.setConnectURL(null);
            //getSecurityManager().saveAuthenticationProvider(config);
            validator.validateAddAuthProvider(config);
            fail();
        } catch (SecurityConfigException ex) {
            assertEquals( JDBCURL_REQUIRED, ex.getId());
View Full Code Here

Examples of org.geoserver.security.jdbc.config.JDBCConnectAuthProviderConfig

import org.springframework.security.core.userdetails.UsernameNotFoundException;

public class JDBCConnectAuthProviderTest extends AbstractAuthenticationProviderTest {
   
    protected JDBCConnectAuthProviderConfig createAuthConfg(String name, String userGroupServiceName) {
        JDBCConnectAuthProviderConfig config = new JDBCConnectAuthProviderConfig();
        config.setName(name);
        config.setClassName(JDBCConnectAuthProvider.class.getName());
        config.setUserGroupServiceName(userGroupServiceName);
        config.setConnectURL("jdbc:h2:target/h2/security");
        config.setDriverClassName("org.h2.Driver");
        return config;       
    }
View Full Code Here

Examples of org.geoserver.security.jdbc.config.JDBCConnectAuthProviderConfig

        return config;       
    }
   
    @Test
    public void testAuthentificationWithoutUserGroupService() throws Exception {
        JDBCConnectAuthProviderConfig config = createAuthConfg("jdbc1", null);
        getSecurityManager().saveAuthenticationProvider(config);
        GeoServerAuthenticationProvider provider = getSecurityManager().loadAuthenticationProvider("jdbc1");
       
        UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken("sa","");
        token.setDetails("details");
View Full Code Here

Examples of org.geoserver.security.jdbc.config.JDBCConnectAuthProviderConfig

   
    @Test
    public void testAuthentificationWithUserGroupService() throws Exception {
        GeoServerRoleService roleService = createRoleService("jdbc2");
        GeoServerUserGroupService ugService = createUserGroupService("jdbc2");
        JDBCConnectAuthProviderConfig config = createAuthConfg("jdbc2", ugService.getName());
        getSecurityManager().saveAuthenticationProvider(config);
        GeoServerAuthenticationProvider provider = getSecurityManager().loadAuthenticationProvider("jdbc2");
       
        GeoServerUserGroupStore ugStore =  ugService.createStore();
        GeoServerUser sa = ugStore.createUserObject("sa", "", true);
View Full Code Here

Examples of org.geoserver.security.jdbc.config.JDBCConnectAuthProviderConfig

               
    }
    @Test
    public void testAuthentificationWithRoleAssociation() throws Exception {
        GeoServerRoleService roleService = createRoleService("jdbc3");
        JDBCConnectAuthProviderConfig config = createAuthConfg("jdbc3", null);
        getSecurityManager().saveAuthenticationProvider(config);
        GeoServerAuthenticationProvider provider = getSecurityManager().loadAuthenticationProvider("jdbc3");
       
       
        GeoServerRoleStore roleStore =  roleService.createStore();
View Full Code Here

Examples of org.geoserver.security.jdbc.config.JDBCConnectAuthProviderConfig

    }

    @Override
    public void validate(SecurityAuthProviderConfig config) throws SecurityConfigException {
        super.validate(config);
        JDBCConnectAuthProviderConfig jdbcConfig = (JDBCConnectAuthProviderConfig) config;
        if (isNotEmpty(jdbcConfig.getDriverClassName())==false)
            throw createSecurityException(DRIVER_CLASSNAME_REQUIRED);
        if (isNotEmpty(jdbcConfig.getConnectURL())==false)
            throw createSecurityException(JDBCURL_REQUIRED);

        try {
            Class.forName(jdbcConfig.getDriverClassName());
        } catch (ClassNotFoundException e) {
            throw createSecurityException(DRIVER_CLASS_NOT_FOUND_$1,
                    jdbcConfig.getDriverClassName());
        }

       
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.