private static void selectEncryptionType( AuthenticationContext authContext ) throws KerberosException,
InvalidTicketException
{
LOG_KRB.debug( "--> Selecting the EncryptionType" );
KdcContext kdcContext = authContext;
KerberosConfig config = kdcContext.getConfig();
Set<EncryptionType> requestedTypes = kdcContext.getRequest().getKdcReqBody().getEType();
LOG.debug( "Encryption types requested by client {}.", requestedTypes );
LOG_KRB.debug( "Encryption types requested by client {}.", requestedTypes );
EncryptionType bestType = KerberosUtils.getBestEncryptionType( requestedTypes, config.getEncryptionTypes() );
LOG.debug( "Session will use encryption type {}.", bestType );
LOG_KRB.debug( "Session will use encryption type {}.", bestType );
if ( bestType == null )
{
LOG_KRB.error( "No encryptionType selected !" );
throw new KerberosException( ErrorType.KDC_ERR_ETYPE_NOSUPP );
}
kdcContext.setEncryptionType( bestType );
}