public Principal authenticate(final String username, final String credentials) {
		
		logger.info("authenticate called for user: " + username );
		
		CommunityAccount purported = (new SQLStatementProcessor<CommunityAccount>("SELECT * FROM valid_accounts WHERE username = ?") {
			CommunityAccount process( PreparedStatement s ) throws SQLException {
				s.setString(1, username);
				ResultSet rs = s.executeQuery();
				if( rs.next() ) {
					return accountFromResultSet(con, rs);
				}
				return null;
			}
		}).doit();
		
		if( purported == null ) {
			logger.warning("Unknown user: " + username + " / returning null.");
			return null;
		}
		
		try {
			if( Arrays.equals(getPasswordHash(credentials.toString()), 
					TypeUtil.fromHexString(purported.getHash().substring("MD5:".length()))) ) {
				
				logger.finest("Passwords match for: " + username);
				
				return purported;
			}
		} catch (IOException e) {
			logger.warning(e.toString());
			e.printStackTrace();
		}
		
		logger.fine("Password did not match for user: " + username);
		
		return null;
	}