use of org.pac4j.core.profile.BasicUserProfile in project cas by apereo.
the class OAuth20TicketGrantingTicketAwareSecurityLogicTests method verifyLoadNoProfileWhenNoTgtAvailable.
@Test
public void verifyLoadNoProfileWhenNoTgtAvailable() {
val request = new MockHttpServletRequest();
val response = new MockHttpServletResponse();
val context = new JEEContext(request, response);
val profileManager = new ProfileManager(context, JEESessionStore.INSTANCE);
profileManager.save(true, new BasicUserProfile(), false);
val logic = new OAuth20TicketGrantingTicketAwareSecurityLogic(ticketGrantingTicketCookieGenerator, ticketRegistry, centralAuthenticationService);
assertTrue(logic.loadProfiles(profileManager, context, JEESessionStore.INSTANCE, List.of()).isEmpty());
}
use of org.pac4j.core.profile.BasicUserProfile in project cas by apereo.
the class OAuth20TicketGrantingTicketAwareSecurityLogicTests method verifyLoadWithBadTicketInSession.
@Test
public void verifyLoadWithBadTicketInSession() {
when(centralAuthenticationService.getTicket(anyString(), any())).thenThrow(new InvalidTicketException("bad ticket"));
val request = new MockHttpServletRequest();
val response = new MockHttpServletResponse();
val context = new JEEContext(request, response);
val profileManager = new ProfileManager(context, JEESessionStore.INSTANCE);
profileManager.save(true, new BasicUserProfile(), false);
JEESessionStore.INSTANCE.set(context, WebUtils.PARAMETER_TICKET_GRANTING_TICKET_ID, UUID.randomUUID().toString());
val logic = new OAuth20TicketGrantingTicketAwareSecurityLogic(ticketGrantingTicketCookieGenerator, ticketRegistry, centralAuthenticationService);
assertTrue(logic.loadProfiles(profileManager, context, JEESessionStore.INSTANCE, List.of()).isEmpty());
}
use of org.pac4j.core.profile.BasicUserProfile in project cas by apereo.
the class OidcAuthenticationAuthorizeSecurityLogicTests method verifyOperation.
@Test
public void verifyOperation() {
val request = new MockHttpServletRequest();
val response = new MockHttpServletResponse();
when(ticketGrantingTicketCookieGenerator.retrieveCookieValue(request)).thenReturn(ticketGrantingTicket.getId());
val context = new JEEContext(request, response);
val profileManager = new ProfileManager(context, JEESessionStore.INSTANCE);
profileManager.save(true, new BasicUserProfile(), false);
val logic = new OidcAuthenticationAuthorizeSecurityLogic(ticketGrantingTicketCookieGenerator, ticketRegistry, centralAuthenticationService);
assertFalse(logic.loadProfiles(profileManager, context, JEESessionStore.INSTANCE, List.of()).isEmpty());
request.setQueryString("prompt=login");
assertTrue(logic.loadProfiles(profileManager, context, JEESessionStore.INSTANCE, List.of()).isEmpty());
}
Aggregations