thrownewIllegalStateException("Unexpected data received while negotiating SASL authentication. Name of the offending root element: "+doc.getName()+" Namespace: "+doc.getNamespaceURI());
thrownewSaslFailureException(Failure.INVALID_MECHANISM,"There is no provider that can provide a SASL server for the desired mechanism and properties.");
// There shouldn't be more than a few principals in here. One ideally
// We set principal to the first one in the list to have a sane default
// If this list is empty, then the cert had no identity at all, which
// will cause an authorization failure
for(Stringprinc:principals){
Stringu=AuthorizationManager.map(princ);
if(!u.equals(princ)){
username=u;
principal=princ;
break;
}
default:
thrownewIllegalStateException("Unexpected data received while negotiating SASL authentication. Name of the offending root element: "+doc.getName()+" Namespace: "+doc.getNamespaceURI());
}
if(username==null||username.length()==0){
// Still no username. Punt.
username=principal;
}
Log.debug("SASLAuthentication: no username requested, using "+username);
catch(SaslExceptionex)
{
Log.debug("SASL negotiation failed for session: {}",session,ex);
* Creates a <code>SaslServer</code> implementing a supported mechanism using the parameters supplied.
*
* @param mechanism The non-null IANA-registered named of a SASL mechanism.
* @param protocol The non-null string name of the protocol for which the authentication is being performed (e.g., "ldap").
* @param serverName The non-null fully qualified host name of the server to authenticate to.
* @param props The possibly null set of properties used to select the SASL mechanism and to configure the authentication exchange of the selected mechanism.
* @param cbh The possibly null callback handler to used by the SASL mechanisms to get further information from the application/library to complete the authentication.
* @return A possibly null SaslServer created using the parameters supplied. If null, this factory cannot produce a SaslServer using the parameters supplied.
* @throws SaslException If cannot create a SaslServer because of an error.
* Returns an array of names of mechanisms that match the specified mechanism selection policies.
* @param props The possibly null set of properties used to specify the security policy of the SASL mechanisms.
* @return A non-null array containing a IANA-registered SASL mechanism names.
*/
Log.debug("Unable to instantiate {} Sasl Server: Provided properties contains neither LocalClientSession nor LocalIncomingServerSession instance.",mechanism);
returnnull;
}
caseJiveSharedSecretSaslServer.NAME:
returnnewJiveSharedSecretSaslServer();
default:
thrownewIllegalStateException();// Fail fast - this should not be possible, as the first check in this method already verifies wether the mechanism is supported.