I am unable to paste my code in so there may be some typos.
CustomProviderAuthentication
It works well for testing the database connection.Code:public class CustomAuthenticationProvider implements AuthenticationProvider { @Resource DataSource dataSource; public Authentication authenticate(Authentication authentication) throws AuthenticationException { UsernamePasswordAuthenticationToken auth = (UsernamePasswordAuthenticationToken) authentication; String username = String.valueOf(auth.getPrincipal()); String password = String.valueOf(auth.getCredentials()); Connection conn = null; try{ //In this call I use the username and password and pass them to my oracle proxy connection and then try to connect to the database conn = dataSourceAdapter.doGetConnection(username, password); } catch(SQLException sqle) { throw new BadCredentialsException(LoginException.handleLoginErrors(sqle)); } //I use the same connection to get the granted authorities, user's role and user's id return new UsernamePasswordAuthenticationToken(username, password,new GrantedAuthority[] {new GrantedAuthorityImpl(userRole)}); }


