KerberosPrincipal serverPrincipal = new KerberosPrincipal( "krbtgt/EXAMPLE.COM@EXAMPLE.COM" );
String passPhrase = "randomKey";
EncryptionKey serverKey = getEncryptionKey( serverPrincipal, passPhrase );
Ticket tgt = getTicket( encTicketPart, serverPrincipal, serverKey );
KdcReqBody kdcReqBody = new KdcReqBody();
kdcReqBody.setSName( getPrincipalName( "ldap/ldap.example.com@EXAMPLE.COM" ) );
kdcReqBody.setRealm( "EXAMPLE.COM" );
kdcReqBody.setEType( config.getEncryptionTypes() );
kdcReqBody.setNonce( random.nextInt() );
KdcOptions kdcOptions = new KdcOptions();
kdcOptions.set( KdcOptions.PROXY );
kdcReqBody.setKdcOptions( kdcOptions );
long now = System.currentTimeMillis();
KerberosTime requestedEndTime = new KerberosTime( now + 1 * KerberosTime.DAY );
kdcReqBody.setTill( requestedEndTime );
HostAddress[] address =
{ new HostAddress( InetAddress.getByName( null ) ) };
HostAddresses addresses = new HostAddresses( address );
kdcReqBody.setAddresses( addresses );
KdcReq message = getKdcRequest( tgt, kdcReqBody );
handler.messageReceived( session, message );