use of org.apereo.cas.mock.MockServiceTicket in project cas by apereo.
the class TicketEncryptionDecryptionTests method checkSerializationOfStBase64Encode.
@Test
public void checkSerializationOfStBase64Encode() {
final MockServiceTicket st = new MockServiceTicket("serviceid", RegisteredServiceTestUtils.getService(), tgt);
final byte[] bytes = SerializationUtils.serializeAndEncodeObject(cipher, st);
final String string = EncodingUtils.encodeBase64(bytes);
assertNotNull(string);
final byte[] result = EncodingUtils.decodeBase64(string);
final Ticket obj = SerializationUtils.decodeAndDeserializeObject(result, cipher, Ticket.class);
assertNotNull(obj);
}
use of org.apereo.cas.mock.MockServiceTicket in project cas by apereo.
the class TicketEncryptionDecryptionTests method checkSerializationOfSt.
@Test
public void checkSerializationOfSt() {
final MockServiceTicket st = new MockServiceTicket("serviceid", RegisteredServiceTestUtils.getService(), tgt);
final byte[] bytes = SerializationUtils.serializeAndEncodeObject(cipher, st);
final Ticket obj = SerializationUtils.decodeAndDeserializeObject(bytes, cipher, Ticket.class);
assertNotNull(obj);
}
use of org.apereo.cas.mock.MockServiceTicket in project cas by apereo.
the class MemCacheTicketRegistryTests method verifyExpiration.
@Test
public void verifyExpiration() throws Exception {
final String id = "ST-1234567890ABCDEFGHIJKL-exp1";
final MockServiceTicket ticket = new MockServiceTicket(id, RegisteredServiceTestUtils.getService(), new MockTicketGrantingTicket("test"));
ticket.setExpiration(new AlwaysExpiresExpirationPolicy());
registry.addTicket(ticket);
Thread.sleep(1500);
assertNull(registry.getTicket(id, ServiceTicket.class));
}
use of org.apereo.cas.mock.MockServiceTicket in project cas by apereo.
the class MemCacheTicketRegistryTests method verifyWriteGetDelete.
@Test
public void verifyWriteGetDelete() throws Exception {
final String id = "ST-1234567890ABCDEFGHIJKL123-crud";
final ServiceTicket ticket = new MockServiceTicket(id, RegisteredServiceTestUtils.getService(), new MockTicketGrantingTicket("test"));
registry.addTicket(ticket);
final ServiceTicket ticketFromRegistry = (ServiceTicket) registry.getTicket(id);
assertNotNull(ticketFromRegistry);
assertEquals(id, ticketFromRegistry.getId());
registry.deleteTicket(id);
assertNull(registry.getTicket(id));
}
use of org.apereo.cas.mock.MockServiceTicket in project cas by apereo.
the class KryoTranscoderTests method verifyEncodeDecode.
@Test
public void verifyEncodeDecode() throws Exception {
final TicketGrantingTicket tgt = new MockTicketGrantingTicket(USERNAME);
final ServiceTicket expectedST = new MockServiceTicket(ST_ID, RegisteredServiceTestUtils.getService(), tgt);
assertEquals(expectedST, transcoder.decode(transcoder.encode(expectedST)));
final Credential userPassCredential = new UsernamePasswordCredential(USERNAME, PASSWORD);
final TicketGrantingTicket expectedTGT = new MockTicketGrantingTicket(USERNAME);
expectedTGT.grantServiceTicket(ST_ID, null, null, false, true);
assertEquals(expectedTGT, transcoder.decode(transcoder.encode(expectedTGT)));
internalProxyTest("http://localhost");
internalProxyTest("https://localhost:8080/path/file.html?p1=v1&p2=v2#fragment");
}
Aggregations