@Test public void testAuthenticationDisabled() { expect(mockAuthPropsConfig.isAuthSimpleEnabled()).andReturn(false); replay(mockAuthPropsConfig); Authentication authentication = new TestingAuthenticationToken("principal", "credentials"); assertSame(provider.authenticate(authentication), authentication); verify(mockAuthPropsConfig); }
@Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { if (!authPropsConfig.isAuthSimpleEnabled()) { logger.debug("Simple auth is disabled"); return authentication; } String username = authentication.getName(); String password = (String) authentication.getCredentials(); username = StringEscapeUtils.unescapeHtml(username); if (StringUtils.isBlank(username)) { throw new BadCredentialsException("Username can't be null or empty."); } User user = new User(); user.setUsername(username); authentication = new UsernamePasswordAuthenticationToken(username, password, getAuthorities()); return authentication; }
LogsearchSimpleAuthenticationProvider extends LogsearchAbstractAuthenticationProvider { @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { if (!authPropsConfig.isAuthSimpleEnabled()) { logger.debug("Simple auth is disabled"); return authentication; } String username = authentication.getName(); String password = (String) authentication.getCredentials(); username = StringEscapeUtils.unescapeHtml(username); if (StringUtils.isBlank(username)) { throw new BadCredentialsException("Username can't be null or empty."); } User user = new User(); user.setUsername(username); authentication = new UsernamePasswordAuthenticationToken(username, password, getAuthorities()); return authentication; } }
LogsearchSimpleAuthenticationProvider extends LogsearchAbstractAuthenticationProvider { @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { if (!authPropsConfig.isAuthSimpleEnabled()) { logger.debug("Simple auth is disabled"); return authentication; } String username = authentication.getName(); String password = (String) authentication.getCredentials(); username = StringEscapeUtils.unescapeHtml(username); if (StringUtils.isBlank(username)) { throw new BadCredentialsException("Username can't be null or empty."); } User user = new User(); user.setUsername(username); authentication = new UsernamePasswordAuthenticationToken(username, password, getAuthorities()); return authentication; }  }
LogsearchSimpleAuthenticationProvider extends LogsearchAbstractAuthenticationProvider { @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { if (!authPropsConfig.isAuthSimpleEnabled()) { logger.debug("Simple auth is disabled"); return authentication; } String username = authentication.getName(); String password = (String) authentication.getCredentials(); username = StringEscapeUtils.unescapeHtml(username); if (StringUtils.isBlank(username)) { throw new BadCredentialsException("Username can't be null or empty."); } User user = new User(); user.setUsername(username); authentication = new UsernamePasswordAuthenticationToken(username, password, getAuthorities()); return authentication; }  @Override Authentication authenticate(Authentication authentication); }
LogsearchSimpleAuthenticationProvider extends LogsearchAbstractAuthenticationProvider { @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { if (!authPropsConfig.isAuthSimpleEnabled()) { logger.debug("Simple auth is disabled"); return authentication; } String username = authentication.getName(); String password = (String) authentication.getCredentials(); username = StringEscapeUtils.unescapeHtml(username); if (StringUtils.isBlank(username)) { throw new BadCredentialsException("Username can't be null or empty."); } User user = new User(); user.setUsername(username); authentication = new UsernamePasswordAuthenticationToken(username, password, getAuthorities()); return authentication; }  @Override Authentication authenticate(Authentication authentication);  }