KerberosPrincipal serverPrincipal = new KerberosPrincipal( "krbtgt/EXAMPLE.COM@EXAMPLE.COM" );
String passPhrase = "randomKey";
EncryptionKey serverKey = getEncryptionKey( serverPrincipal, passPhrase );
Ticket tgt = getTicket( encTicketPartModifier, serverPrincipal, serverKey );
RequestBodyModifier modifier = new RequestBodyModifier();
modifier.setServerName( getPrincipalName( "ldap/ldap.example.com@EXAMPLE.COM" ) );
modifier.setRealm( "EXAMPLE.COM" );
modifier.setEType( config.getEncryptionTypes() );
modifier.setNonce( random.nextInt() );
KdcOptions kdcOptions = new KdcOptions();
kdcOptions.set( KdcOptions.FORWARDED );
modifier.setKdcOptions( kdcOptions );
long now = System.currentTimeMillis();
KerberosTime requestedEndTime = new KerberosTime( now + 1 * KerberosTime.DAY );
modifier.setTill( requestedEndTime );
HostAddress[] address =
{ new HostAddress( InetAddress.getByName( null ) ) };
HostAddresses addresses = new HostAddresses( address );
modifier.setAddresses( addresses );
RequestBody requestBody = modifier.getRequestBody();
KdcRequest message = getKdcRequest( tgt, requestBody );
handler.messageReceived( session, message );
TicketGrantReply reply = ( TicketGrantReply ) session.getMessage();