@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final UsernamePrincipal that = (UsernamePrincipal) o; if (!_name.equals(that._name)) { return false; } if (_authenticationProvider == null || that._authenticationProvider == null) { return _authenticationProvider == null && that._authenticationProvider == null; } return (_authenticationProvider.getType().equals(that._authenticationProvider.getType()) && _authenticationProvider.getName().equals(that._authenticationProvider.getName())); }
private void validateAuthenticationMechanisms(final AuthenticationProvider<?> authenticationProvider, final Set<Transport> transports) { List<String> availableMechanisms = new ArrayList<>(authenticationProvider.getMechanisms()); if(authenticationProvider.getDisabledMechanisms() != null) { availableMechanisms.removeAll(authenticationProvider.getDisabledMechanisms()); } if (availableMechanisms.isEmpty()) { throw new IllegalConfigurationException("The authentication provider '" + authenticationProvider.getName() + "' on port '" + getName() + "' has all authentication mechanisms disabled."); } if (hasNonTLSTransport(transports) && authenticationProvider.getSecureOnlyMechanisms() != null) { availableMechanisms.removeAll(authenticationProvider.getSecureOnlyMechanisms()); if(availableMechanisms.isEmpty()) { throw new IllegalConfigurationException("The port '" + getName() + "' allows for non TLS connections, but all authentication " + "mechanisms of the authentication provider '" + authenticationProvider.getName() + "' are disabled on non-secure connections."); } } }