@Test
public void testKrbErrCantPostdate() throws Exception
{
TgtRequest tgtReq = new TgtRequest();
tgtReq.setClientPrincipal( principalName );
tgtReq.setPassword( userPassword );
tgtReq.setStartTime( System.currentTimeMillis() + 600000 ); // now + 10 min
try
{
conn.getTgt( tgtReq );
fail("should fail with KDC_ERR_CANNOT_POSTDATE");
}
catch( KerberosException e )
{
KrbError err = e.getError();
assertNotNull( err );
assertEquals( ErrorType.KDC_ERR_CANNOT_POSTDATE, err.getErrorCode() );
}
tgtReq.setPostdated( true );
TgTicket tgt = conn.getTgt( tgtReq );
assertNotNull( tgt );
}