org.jasig.cas.web.support.CookieRetrievingCookieGenerator Java Examples

The following examples show how to use org.jasig.cas.web.support.CookieRetrievingCookieGenerator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LogoutActionTests.java    From springboot-shiro-cas-mybatis with MIT License 6 votes vote down vote up
@Before
public void onSetUp() throws Exception {
    this.request = new MockHttpServletRequest();
    this.response = new MockHttpServletResponse();
    this.requestContext = mock(RequestContext.class);
    final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
    when(this.requestContext.getExternalContext()).thenReturn(servletExternalContext);
    when(servletExternalContext.getNativeRequest()).thenReturn(request);
    when(servletExternalContext.getNativeResponse()).thenReturn(response);
    final LocalAttributeMap flowScope = new LocalAttributeMap();
    when(this.requestContext.getFlowScope()).thenReturn(flowScope);

    this.warnCookieGenerator = new CookieRetrievingCookieGenerator();
    this.serviceRegistryDao = new InMemoryServiceRegistryDaoImpl();
    this.serviceManager = new DefaultServicesManagerImpl(serviceRegistryDao);
    this.serviceManager.reload();

    this.warnCookieGenerator.setCookieName("test");

    this.ticketGrantingTicketCookieGenerator = new CookieRetrievingCookieGenerator();
    this.ticketGrantingTicketCookieGenerator.setCookieName(COOKIE_TGC_ID);

    this.logoutAction = new LogoutAction();
    this.logoutAction.setServicesManager(this.serviceManager);
}
 
Example #2
Source File: LogoutActionTests.java    From cas4.0.x-server-wechat with Apache License 2.0 6 votes vote down vote up
@Before
public void onSetUp() throws Exception {
    this.request = new MockHttpServletRequest();
    this.response = new MockHttpServletResponse();
    this.requestContext = mock(RequestContext.class);
    final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
    when(this.requestContext.getExternalContext()).thenReturn(servletExternalContext);
    when(servletExternalContext.getNativeRequest()).thenReturn(request);
    when(servletExternalContext.getNativeResponse()).thenReturn(response);
    final LocalAttributeMap flowScope = new LocalAttributeMap();
    when(this.requestContext.getFlowScope()).thenReturn(flowScope);

    this.warnCookieGenerator = new CookieRetrievingCookieGenerator();
    this.serviceRegistryDao = new InMemoryServiceRegistryDaoImpl();
    this.serviceManager = new DefaultServicesManagerImpl(serviceRegistryDao);
    this.serviceManager.reload();

    this.warnCookieGenerator.setCookieName("test");

    this.ticketGrantingTicketCookieGenerator = new CookieRetrievingCookieGenerator();
    this.ticketGrantingTicketCookieGenerator.setCookieName(COOKIE_TGC_ID);

    this.logoutAction = new LogoutAction();
    this.logoutAction.setServicesManager(this.serviceManager);
}
 
Example #3
Source File: SendTicketGrantingTicketAction.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
/**
 * Instantiates a new Send ticket granting ticket action.
 *
 * @param ticketGrantingTicketCookieGenerator the ticket granting ticket cookie generator
 * @param centralAuthenticationService the central authentication service
 * @param servicesManager the services manager
 */
public SendTicketGrantingTicketAction(final CookieRetrievingCookieGenerator ticketGrantingTicketCookieGenerator,
                                      final CentralAuthenticationService centralAuthenticationService,
                                      final ServicesManager servicesManager) {
    super();
    this.ticketGrantingTicketCookieGenerator = ticketGrantingTicketCookieGenerator;
    this.centralAuthenticationService = centralAuthenticationService;
    this.servicesManager = servicesManager;
}
 
Example #4
Source File: TerminateSessionAction.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
/**
 * Creates a new instance with the given parameters.
 * @param cas Core business logic object.
 * @param tgtCookieGenerator TGT cookie generator.
 * @param warnCookieGenerator Warn cookie generator.
 */
public TerminateSessionAction(
        final CentralAuthenticationService cas,
        final CookieRetrievingCookieGenerator tgtCookieGenerator,
        final CookieRetrievingCookieGenerator warnCookieGenerator) {
    this.centralAuthenticationService = cas;
    this.ticketGrantingTicketCookieGenerator = tgtCookieGenerator;
    this.warnCookieGenerator = warnCookieGenerator;
}
 
Example #5
Source File: InitialFlowSetupActionTests.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    this.warnCookieGenerator = new CookieRetrievingCookieGenerator();
    this.tgtCookieGenerator = new CookieRetrievingCookieGenerator();
    this.action.setTicketGrantingTicketCookieGenerator(this.tgtCookieGenerator);
    this.action.setWarnCookieGenerator(this.warnCookieGenerator);
    final ArgumentExtractor[] argExtractors = new ArgumentExtractor[] {new CasArgumentExtractor()};
    this.action.setArgumentExtractors(Arrays.asList(argExtractors));

    this.servicesManager = mock(ServicesManager.class);
    when(this.servicesManager.findServiceBy(any(Service.class))).thenReturn(TestUtils.getRegisteredService("test"));
    this.action.setServicesManager(this.servicesManager);

    this.action.afterPropertiesSet();
}
 
Example #6
Source File: SendTicketGrantingTicketActionTests.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
@Before
public void onSetUp() throws Exception {

    this.ticketGrantingTicketCookieGenerator = new CookieRetrievingCookieGenerator();
    ticketGrantingTicketCookieGenerator.setCookieName("TGT");

    this.action = new SendTicketGrantingTicketAction(ticketGrantingTicketCookieGenerator,
            getCentralAuthenticationService(), getServicesManager());
    this.action.setServicesManager(getServicesManager());
    this.action.setCreateSsoSessionCookieOnRenewAuthentications(true);
    this.action.afterPropertiesSet();

    this.context = new MockRequestContext();
}
 
Example #7
Source File: TerminateSessionAction.java    From cas4.0.x-server-wechat with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new instance with the given parameters.
 * @param cas Core business logic object.
 * @param tgtCookieGenerator TGT cookie generator.
 * @param warnCookieGenerator Warn cookie generator.
 */
public TerminateSessionAction(
        final CentralAuthenticationService cas,
        final CookieRetrievingCookieGenerator tgtCookieGenerator,
        final CookieRetrievingCookieGenerator warnCookieGenerator) {
    this.centralAuthenticationService = cas;
    this.ticketGrantingTicketCookieGenerator = tgtCookieGenerator;
    this.warnCookieGenerator = warnCookieGenerator;
}
 
Example #8
Source File: InitialFlowSetupActionTests.java    From cas4.0.x-server-wechat with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    this.warnCookieGenerator = new CookieRetrievingCookieGenerator();
    this.warnCookieGenerator.setCookiePath("");
    this.tgtCookieGenerator = new CookieRetrievingCookieGenerator();
    this.tgtCookieGenerator.setCookiePath("");
    this.action.setTicketGrantingTicketCookieGenerator(this.tgtCookieGenerator);
    this.action.setWarnCookieGenerator(this.warnCookieGenerator);
    final ArgumentExtractor[] argExtractors = new ArgumentExtractor[] {new CasArgumentExtractor()};
    this.action.setArgumentExtractors(Arrays.asList(argExtractors));
    this.action.afterPropertiesSet();
    this.action.afterPropertiesSet();
}
 
Example #9
Source File: InitialFlowSetupAction.java    From springboot-shiro-cas-mybatis with MIT License 4 votes vote down vote up
public void setTicketGrantingTicketCookieGenerator(
    final CookieRetrievingCookieGenerator ticketGrantingTicketCookieGenerator) {
    this.ticketGrantingTicketCookieGenerator = ticketGrantingTicketCookieGenerator;
}
 
Example #10
Source File: InitialFlowSetupAction.java    From springboot-shiro-cas-mybatis with MIT License 4 votes vote down vote up
public void setWarnCookieGenerator(final CookieRetrievingCookieGenerator warnCookieGenerator) {
    this.warnCookieGenerator = warnCookieGenerator;
}
 
Example #11
Source File: SendTicketGrantingTicketAction.java    From springboot-shiro-cas-mybatis with MIT License 4 votes vote down vote up
/**
 * @deprecated As of 4.1, use constructors instead.
 * @param ticketGrantingTicketCookieGenerator the id generator
 */
@Deprecated
public void setTicketGrantingTicketCookieGenerator(final CookieRetrievingCookieGenerator ticketGrantingTicketCookieGenerator) {
    logger.warn("setTicketGrantingTicketCookieGenerator() is deprecated and has no effect. Use constructors instead.");
}
 
Example #12
Source File: InitialFlowSetupAction.java    From cas4.0.x-server-wechat with Apache License 2.0 4 votes vote down vote up
public void setTicketGrantingTicketCookieGenerator(
    final CookieRetrievingCookieGenerator ticketGrantingTicketCookieGenerator) {
    this.ticketGrantingTicketCookieGenerator = ticketGrantingTicketCookieGenerator;
}
 
Example #13
Source File: InitialFlowSetupAction.java    From cas4.0.x-server-wechat with Apache License 2.0 4 votes vote down vote up
public void setWarnCookieGenerator(final CookieRetrievingCookieGenerator warnCookieGenerator) {
    this.warnCookieGenerator = warnCookieGenerator;
}
 
Example #14
Source File: SendTicketGrantingTicketAction.java    From cas4.0.x-server-wechat with Apache License 2.0 4 votes vote down vote up
public void setTicketGrantingTicketCookieGenerator(final CookieRetrievingCookieGenerator ticketGrantingTicketCookieGenerator) {
    this.ticketGrantingTicketCookieGenerator= ticketGrantingTicketCookieGenerator;
}
 
Example #15
Source File: SendTicketGrantingTicketActionTests.java    From cas4.0.x-server-wechat with Apache License 2.0 4 votes vote down vote up
@Before
public void onSetUp() throws Exception {
    this.action = new SendTicketGrantingTicketAction();

    this.ticketGrantingTicketCookieGenerator = new CookieRetrievingCookieGenerator();

    this.ticketGrantingTicketCookieGenerator.setCookieName("TGT");

    this.action.setCentralAuthenticationService(getCentralAuthenticationService());

    this.action.setTicketGrantingTicketCookieGenerator(this.ticketGrantingTicketCookieGenerator);

    this.action.afterPropertiesSet();

    this.context = new MockRequestContext();
}
 
Example #16
Source File: SendTicketGrantingTicketAction.java    From cas-mfa with Apache License 2.0 4 votes vote down vote up
public void setTicketGrantingTicketCookieGenerator(final CookieRetrievingCookieGenerator ticketGrantingTicketCookieGenerator) {
    this.ticketGrantingTicketCookieGenerator= ticketGrantingTicketCookieGenerator;
}