use of org.craftercms.profile.api.Ticket in project profile by craftercms.
the class AuthenticationServiceImplTest method testAuthenticate.
@Test
public void testAuthenticate() throws Exception {
Ticket ticket = authenticationService.authenticate(TENANT_NAME, USERNAME1, PASSWORD);
assertNotNull(ticket);
assertEquals(PROFILE1_ID.toString(), ticket.getProfileId());
assertNotNull(ticket.getLastRequestTime());
verify(profileService).getProfileByUsername(TENANT_NAME, USERNAME1, ProfileConstants.NO_ATTRIBUTE);
verify(ticketRepository).insert(ticket);
}
use of org.craftercms.profile.api.Ticket in project profile by craftercms.
the class AuthenticationServiceIT method testInvalidateTicket.
@Test
public void testInvalidateTicket() throws Exception {
Ticket ticket = authenticationService.authenticate(DEFAULT_TENANT_NAME, ADMIN_USERNAME, ADMIN_PASSWORD);
assertNotNull(ticket);
authenticationService.invalidateTicket(ticket.getId());
ticket = authenticationService.getTicket(ticket.getId());
assertNull(ticket);
}
use of org.craftercms.profile.api.Ticket in project profile by craftercms.
the class AuthenticationServiceIT method testGetTicket.
@Test
public void testGetTicket() throws Exception {
Ticket ticket = authenticationService.authenticate(DEFAULT_TENANT_NAME, ADMIN_USERNAME, ADMIN_PASSWORD);
assertNotNull(ticket);
Date lastRequestTime = ticket.getLastRequestTime();
ticket = authenticationService.getTicket(ticket.getId());
assertNotNull(ticket);
assertTrue(ticket.getLastRequestTime().after(lastRequestTime));
authenticationService.invalidateTicket(ticket.getId());
}
use of org.craftercms.profile.api.Ticket in project profile by craftercms.
the class ProfileServiceImplTest method getTicket.
private Ticket getTicket() {
Ticket ticket = new Ticket();
ticket.setId(TICKET_ID);
ticket.setTenant(TENANT1_NAME);
ticket.setProfileId(PROFILE1_ID.toString());
ticket.setLastRequestTime(new Date());
return ticket;
}
Aggregations