if( clientTgtReq.getETypes() == null )
{
clientTgtReq.setETypes( config.getEncryptionTypes() );
}
KdcReqBody body = new KdcReqBody();
body.setFrom( new KerberosTime( clientTgtReq.getStartTime() ) );
PrincipalName cName = null;
try
{
cName = new PrincipalName( clientTgtReq.getCName(), PrincipalNameType.KRB_NT_PRINCIPAL );
body.setCName( cName );
body.setRealm( realm );
PrincipalName sName = new PrincipalName( clientTgtReq.getSName(), PrincipalNameType.KRB_NT_SRV_INST );
body.setSName( sName );
}
catch( ParseException e )
{
throw new IllegalArgumentException( "Couldn't parse the given principals", e );
}
body.setTill( new KerberosTime( clientTgtReq.getExpiryTime() ) );
int currentNonce = nonceGenerator.nextInt();
body.setNonce( currentNonce );
body.setEType( clientTgtReq.getETypes() );
body.setKdcOptions( clientTgtReq.getOptions() );
List<HostAddress> lstAddresses = clientTgtReq.getHostAddresses();
if ( !lstAddresses.isEmpty() )
{
HostAddresses addresses = new HostAddresses();
for( HostAddress h : lstAddresses )
{
addresses.addHostAddress( h );
}
body.setAddresses( addresses );
}
EncryptionType encryptionType = clientTgtReq.getETypes().iterator().next();
EncryptionKey clientKey = KerberosKeyFactory.string2Key( clientTgtReq.getClientPrincipal(), clientTgtReq.getPassword(), encryptionType );