当前位置: 首页>>代码示例>>Java>>正文


Java NeverExpiresExpirationPolicy类代码示例

本文整理汇总了Java中org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy的典型用法代码示例。如果您正苦于以下问题:Java NeverExpiresExpirationPolicy类的具体用法?Java NeverExpiresExpirationPolicy怎么用?Java NeverExpiresExpirationPolicy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NeverExpiresExpirationPolicy类属于org.jasig.cas.ticket.support包,在下文中一共展示了NeverExpiresExpirationPolicy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: verifyDoubleGrantDifferentServiceTicket

import org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy; //导入依赖的package包/类
@Test
public void verifyDoubleGrantDifferentServiceTicket() {
    final TicketGrantingTicket t = new TicketGrantingTicketImpl("test", null, null,
            org.jasig.cas.authentication.TestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());

    t.grantServiceTicket(
            this.uniqueTicketIdGenerator.getNewTicketId(ServiceTicket.PREFIX),
            org.jasig.cas.services.TestUtils.getService(),
            new NeverExpiresExpirationPolicy(),
            false,
            true);
    t.grantServiceTicket(
            this.uniqueTicketIdGenerator.getNewTicketId(ServiceTicket.PREFIX),
            org.jasig.cas.services.TestUtils.getService2(),
            new NeverExpiresExpirationPolicy(),
            false,
            true);

    assertEquals(2, t.getServices().size());
}
 
开发者ID:yuweijun,项目名称:cas-server-4.2.1,代码行数:21,代码来源:TicketGrantingTicketImplTests.java

示例2: verifySuccessfulServiceTicket

import org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy; //导入依赖的package包/类
@Test
public void verifySuccessfulServiceTicket() throws Exception {
    final MockRequestContext context = new MockRequestContext();
    final MockHttpServletRequest request = new MockHttpServletRequest();
    final Authentication authentication = org.jasig.cas.authentication.TestUtils.getAuthentication("scootman28");
    final TicketGrantingTicket t = new TicketGrantingTicketImpl("TGT-11", authentication,
            new NeverExpiresExpirationPolicy());

    this.ticketRegistry.addTicket(t);

    request.setParameter(OpenIdProtocolConstants.OPENID_IDENTITY, "http://openid.aol.com/scootman28");
    request.setParameter(OpenIdProtocolConstants.OPENID_RETURNTO, "http://www.cnn.com");

    final OpenIdService service = new OpenIdServiceFactory().createService(request);
    context.getFlowScope().put("service", service);
    context.getFlowScope().put("ticketGrantingTicketId", t.getId());

    context.setExternalContext(new ServletExternalContext(new MockServletContext(), request,
            new MockHttpServletResponse()));
    assertEquals("success", this.action.execute(context).getId());
}
 
开发者ID:yuweijun,项目名称:cas-server-4.2.1,代码行数:22,代码来源:OpenIdSingleSignOnActionTests.java

示例3: testTicketGrantingTicketGrantedTwice

import org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy; //导入依赖的package包/类
@Test
public void testTicketGrantingTicketGrantedTwice() {
    Authentication a = TestUtils.getAuthentication();
    TicketGrantingTicket t = new TicketGrantingTicketImpl("test", TestUtils.getAuthentication(),
            new NeverExpiresExpirationPolicy());
    ServiceTicket s = t.grantServiceTicket(this.uniqueTicketIdGenerator.getNewTicketId(ServiceTicket.PREFIX),
            TestUtils.getService(), new MultiTimeUseOrTimeoutExpirationPolicy(1, 5000), false);
    s.grantTicketGrantingTicket(this.uniqueTicketIdGenerator.getNewTicketId(TicketGrantingTicket.PREFIX), a,
            new NeverExpiresExpirationPolicy());

    try {
        s.grantTicketGrantingTicket(this.uniqueTicketIdGenerator.getNewTicketId(TicketGrantingTicket.PREFIX), a,
                new NeverExpiresExpirationPolicy());
        fail("Exception expected.");
    } catch (final Exception e) {
        return;
    }
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:19,代码来源:ServiceTicketImplTests.java

示例4: testGrantServiceTicketWithExpiredTicketGrantingTicket

import org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy; //导入依赖的package包/类
@Test(expected=TicketException.class)
    public void testGrantServiceTicketWithExpiredTicketGrantingTicket() throws Exception {
        ((CentralAuthenticationServiceImpl) getCentralAuthenticationService()).setTicketGrantingTicketExpirationPolicy(
                new ExpirationPolicy() {
            private static final long serialVersionUID = 1L;

            public boolean isExpired(final TicketState ticket) {
                return true;
            }});
    final String ticketId = getCentralAuthenticationService()
        .createTicketGrantingTicket(
            TestUtils.getCredentialsWithSameUsernameAndPassword());
    try {
        getCentralAuthenticationService().grantServiceTicket(ticketId,
            TestUtils.getService());
    } finally {
        ((CentralAuthenticationServiceImpl) getCentralAuthenticationService()).setTicketGrantingTicketExpirationPolicy(
                new NeverExpiresExpirationPolicy());
    }
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:21,代码来源:CentralAuthenticationServiceImplTests.java

示例5: testValidateServiceTicketWithExpires

import org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy; //导入依赖的package包/类
@Test
public void testValidateServiceTicketWithExpires() throws Exception {
    ((CentralAuthenticationServiceImpl) getCentralAuthenticationService())
        .setServiceTicketExpirationPolicy(new MultiTimeUseOrTimeoutExpirationPolicy(
            1, 1100));
    final String ticketGrantingTicket = getCentralAuthenticationService()
        .createTicketGrantingTicket(
            TestUtils.getCredentialsWithSameUsernameAndPassword());
    final String serviceTicket = getCentralAuthenticationService()
        .grantServiceTicket(ticketGrantingTicket, TestUtils.getService());

    getCentralAuthenticationService().validateServiceTicket(serviceTicket,
        TestUtils.getService());

    assertFalse(getTicketRegistry().deleteTicket(serviceTicket));
    ((CentralAuthenticationServiceImpl) getCentralAuthenticationService())
        .setServiceTicketExpirationPolicy(new NeverExpiresExpirationPolicy());
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:19,代码来源:CentralAuthenticationServiceImplTests.java

示例6: verifyDoubleGrantSimilarServiceTicketKeepMostRecentSession

import org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy; //导入依赖的package包/类
@Test
public void verifyDoubleGrantSimilarServiceTicketKeepMostRecentSession() {
    final TicketGrantingTicket t = new TicketGrantingTicketImpl("test", null, null,
            org.jasig.cas.authentication.TestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());

    t.grantServiceTicket(
            this.uniqueTicketIdGenerator.getNewTicketId(ServiceTicket.PREFIX),
            org.jasig.cas.services.TestUtils.getService("http://host.com?test"),
            new NeverExpiresExpirationPolicy(),
            false,
            true);
    t.grantServiceTicket(
            this.uniqueTicketIdGenerator.getNewTicketId(ServiceTicket.PREFIX),
            org.jasig.cas.services.TestUtils.getService("http://host.com;JSESSIONID=xxx"),
            new NeverExpiresExpirationPolicy(),
            false,
            true);

    assertEquals(1, t.getServices().size());
}
 
开发者ID:yuweijun,项目名称:cas-server-4.2.1,代码行数:21,代码来源:TicketGrantingTicketImplTests.java

示例7: setUp

import org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    this.action = new PrincipalFromRequestRemoteUserNonInteractiveCredentialsAction();

    final Map<String, UniqueTicketIdGenerator> idGenerators = new HashMap<>();
    idGenerators.put(SimpleWebApplicationServiceImpl.class.getName(), new DefaultUniqueTicketIdGenerator());


    final AuthenticationManager authenticationManager = new PolicyBasedAuthenticationManager(
            Collections.<AuthenticationHandler, PrincipalResolver>singletonMap(
                    new PrincipalBearingCredentialsAuthenticationHandler(),
                    new PrincipalBearingPrincipalResolver()));
    final CentralAuthenticationServiceImpl centralAuthenticationService = new CentralAuthenticationServiceImpl(
            new DefaultTicketRegistry(), null, authenticationManager, new DefaultUniqueTicketIdGenerator(),
            idGenerators, new NeverExpiresExpirationPolicy(), new NeverExpiresExpirationPolicy(),
            mock(ServicesManager.class), mock(LogoutManager.class));
    this.action.setCentralAuthenticationService(centralAuthenticationService);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:19,代码来源:PrincipalFromRequestRemoteUserNonInteractiveCredentialsActionTests.java

示例8: verifyGetChainedPrincipalsWithTwo

import org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy; //导入依赖的package包/类
@Test
public void verifyGetChainedPrincipalsWithTwo() {
    final Authentication authentication = org.jasig.cas.authentication.TestUtils.getAuthentication();
    final Authentication authentication1 = org.jasig.cas.authentication.TestUtils.getAuthentication("test1");
    final List<Authentication> principals = new ArrayList<>();
    principals.add(authentication);
    principals.add(authentication1);

    final TicketGrantingTicketImpl t1 = new TicketGrantingTicketImpl("test", null, null,
        authentication1, new NeverExpiresExpirationPolicy());
    final TicketGrantingTicket t = new TicketGrantingTicketImpl("test",
            org.jasig.cas.authentication.TestUtils.getService("gantor"), t1,
        authentication, new NeverExpiresExpirationPolicy());

    assertEquals(principals, t.getChainedAuthentications());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:17,代码来源:TicketGrantingTicketImplTests.java

示例9: verifyDoubleGrantSimilarServiceWithPathTicketKeepMostRecentSession

import org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy; //导入依赖的package包/类
@Test
public void verifyDoubleGrantSimilarServiceWithPathTicketKeepMostRecentSession() {
    final TicketGrantingTicket t = new TicketGrantingTicketImpl("test", null, null,
            org.jasig.cas.authentication.TestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());

    t.grantServiceTicket(
            this.uniqueTicketIdGenerator.getNewTicketId(ServiceTicket.PREFIX),
            org.jasig.cas.services.TestUtils.getService("http://host.com/webapp1"),
            new NeverExpiresExpirationPolicy(),
            false,
            true);
    t.grantServiceTicket(
            this.uniqueTicketIdGenerator.getNewTicketId(ServiceTicket.PREFIX),
            org.jasig.cas.services.TestUtils.getService("http://host.com/webapp1?test=true"),
            new NeverExpiresExpirationPolicy(),
            false,
            true);

    assertEquals(1, t.getServices().size());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:21,代码来源:TicketGrantingTicketImplTests.java

示例10: verifyDoubleGrantSameServiceTicketKeepAll

import org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy; //导入依赖的package包/类
@Test
public void verifyDoubleGrantSameServiceTicketKeepAll() {
    final TicketGrantingTicket t = new TicketGrantingTicketImpl("test", null, null,
            org.jasig.cas.authentication.TestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());

    t.grantServiceTicket(
            this.uniqueTicketIdGenerator.getNewTicketId(ServiceTicket.PREFIX),
            org.jasig.cas.services.TestUtils.getService(),
            new NeverExpiresExpirationPolicy(),
            false,
            true);
    t.grantServiceTicket(
            this.uniqueTicketIdGenerator.getNewTicketId(ServiceTicket.PREFIX),
            org.jasig.cas.services.TestUtils.getService(),
            new NeverExpiresExpirationPolicy(),
            false,
            false);

    assertEquals(2, t.getServices().size());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:21,代码来源:TicketGrantingTicketImplTests.java

示例11: verifyDoubleGrantDifferentServiceOnPathTicket

import org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy; //导入依赖的package包/类
@Test
public void verifyDoubleGrantDifferentServiceOnPathTicket() {
    final TicketGrantingTicket t = new TicketGrantingTicketImpl("test", null, null,
            org.jasig.cas.authentication.TestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());

    t.grantServiceTicket(
            this.uniqueTicketIdGenerator.getNewTicketId(ServiceTicket.PREFIX),
            org.jasig.cas.services.TestUtils.getService("http://host.com/webapp1"),
            new NeverExpiresExpirationPolicy(),
            false,
            true);
    t.grantServiceTicket(
            this.uniqueTicketIdGenerator.getNewTicketId(ServiceTicket.PREFIX),
            org.jasig.cas.services.TestUtils.getService("http://host.com/webapp2"),
            new NeverExpiresExpirationPolicy(),
            false,
            true);

    assertEquals(2, t.getServices().size());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:21,代码来源:TicketGrantingTicketImplTests.java

示例12: verifyWebApplicationServices

import org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy; //导入依赖的package包/类
@Test
public void verifyWebApplicationServices() {
    final MockService testService = new MockService("test");
    final TicketGrantingTicket t = new TicketGrantingTicketImpl("test", null, null,
        TestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
    t.grantServiceTicket(this.uniqueTicketIdGenerator
        .getNewTicketId(ServiceTicket.PREFIX), testService,
        new NeverExpiresExpirationPolicy(), false);
    Map<String, Service> services = t.getServices();
    assertEquals(1, services.size());
    final String ticketId = services.keySet().iterator().next();
    assertEquals(testService, services.get(ticketId));
    t.removeAllServices();
    services = t.getServices();
    assertEquals(0, services.size());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:17,代码来源:TicketGrantingTicketImplTests.java

示例13: verifyServiceTicketAsFromNotInitialCredentials

import org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy; //导入依赖的package包/类
@Test
public void verifyServiceTicketAsFromNotInitialCredentials() {
    final TicketGrantingTicket t = new TicketGrantingTicketImpl("test", null, null,
            org.jasig.cas.authentication.TestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());

    t.grantServiceTicket(
            this.uniqueTicketIdGenerator.getNewTicketId(ServiceTicket.PREFIX),
            org.jasig.cas.services.TestUtils.getService(),
            new NeverExpiresExpirationPolicy(),
            false,
            true);
    final ServiceTicket s = t.grantServiceTicket(
            this.uniqueTicketIdGenerator.getNewTicketId(ServiceTicket.PREFIX),
            org.jasig.cas.services.TestUtils.getService(),
            new NeverExpiresExpirationPolicy(),
            false,
            true);

    assertFalse(s.isFromNewLogin());
}
 
开发者ID:yuweijun,项目名称:cas-server-4.2.1,代码行数:21,代码来源:TicketGrantingTicketImplTests.java

示例14: verifySuccessfulServiceTicket

import org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy; //导入依赖的package包/类
@Test
public void verifySuccessfulServiceTicket() throws Exception {
    final MockRequestContext context = new MockRequestContext();
    final MockHttpServletRequest request = new MockHttpServletRequest();
    final Authentication authentication = TestUtils.getAuthentication("scootman28");
    final TicketGrantingTicket t = new TicketGrantingTicketImpl("TGT-11", authentication,
            new NeverExpiresExpirationPolicy());

    this.ticketRegistry.addTicket(t);

    request.setParameter(OpenIdConstants.OPENID_IDENTITY, "http://openid.aol.com/scootman28");
    request.setParameter(OpenIdConstants.OPENID_RETURNTO, "http://www.cnn.com");

    final OpenIdService service = OpenIdService.createServiceFrom(request, null);
    context.getFlowScope().put("service", service);
    context.getFlowScope().put("ticketGrantingTicketId", t.getId());

    context.setExternalContext(new ServletExternalContext(new MockServletContext(), request,
            new MockHttpServletResponse()));
    assertEquals("success", this.action.execute(context).getId());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:22,代码来源:OpenIdSingleSignOnActionTests.java

示例15: setUp

import org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    this.action = new PrincipalFromRequestUserPrincipalNonInteractiveCredentialsAction();

    final Map<String, UniqueTicketIdGenerator> idGenerators = new HashMap<>();
    idGenerators.put(SimpleWebApplicationServiceImpl.class.getName(), new DefaultUniqueTicketIdGenerator());


    final AuthenticationManager authenticationManager = new PolicyBasedAuthenticationManager(
            Collections.<AuthenticationHandler, PrincipalResolver>singletonMap(
                    new PrincipalBearingCredentialsAuthenticationHandler(),
                    new PrincipalBearingPrincipalResolver()));

    final CentralAuthenticationServiceImpl centralAuthenticationService = new CentralAuthenticationServiceImpl(
            new DefaultTicketRegistry(), null, authenticationManager, new DefaultUniqueTicketIdGenerator(),
            idGenerators, new NeverExpiresExpirationPolicy(), new NeverExpiresExpirationPolicy(),
            mock(ServicesManager.class), mock(LogoutManager.class));

    this.action.setCentralAuthenticationService(centralAuthenticationService);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:21,代码来源:PrincipalFromRequestUserPrincipalNonInteractiveCredentialsActionTests.java


注:本文中的org.jasig.cas.ticket.support.NeverExpiresExpirationPolicy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。