• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java AuthenticationException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createTicketGrantingTicket

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
@Audit(
    action="TICKET_GRANTING_TICKET",
    actionResolverName="CREATE_TICKET_GRANTING_TICKET_RESOLVER",
    resourceResolverName="CREATE_TICKET_GRANTING_TICKET_RESOURCE_RESOLVER")
@Timed(name = "CREATE_TICKET_GRANTING_TICKET_TIMER")
@Metered(name = "CREATE_TICKET_GRANTING_TICKET_METER")
@Counted(name="CREATE_TICKET_GRANTING_TICKET_COUNTER", monotonic=true)
@Override
public TicketGrantingTicket createTicketGrantingTicket(final AuthenticationContext context)
        throws AuthenticationException, AbstractTicketException {

    final Authentication authentication = context.getAuthentication();
    final TicketGrantingTicketFactory factory = this.ticketFactory.get(TicketGrantingTicket.class);
    final TicketGrantingTicket ticketGrantingTicket = factory.create(authentication);

    this.ticketRegistry.addTicket(ticketGrantingTicket);

    doPublishEvent(new CasTicketGrantingTicketCreatedEvent(this, ticketGrantingTicket));

    return ticketGrantingTicket;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:22,代码来源:CentralAuthenticationServiceImpl.java


示例2: loginUnsuccessfully

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
@Override
protected MockHttpServletResponse loginUnsuccessfully(final String username, final String fromAddress)
        throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    final MockHttpServletResponse response = new MockHttpServletResponse();
    request.setMethod("POST");
    request.setParameter("username", username);
    request.setRemoteAddr(fromAddress);
    final MockRequestContext context = new MockRequestContext();
    context.setCurrentEvent(new Event("", "error"));
    request.setAttribute("flowRequestContext", context);
    ClientInfoHolder.setClientInfo(new ClientInfo(request));

    getThrottle().preHandle(request, response, null);

    try {
        authenticationManager.authenticate(AuthenticationTransaction.wrap(badCredentials(username)));
    } catch (final AuthenticationException e) {
        getThrottle().postHandle(request, response, null, null);
        return response;
    }
    fail("Expected AbstractAuthenticationException");
    return null;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:25,代码来源:InspektrThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapterTests.java


示例3: grantServiceTicket

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
@Audit(
    action="SERVICE_TICKET",
    actionResolverName="GRANT_SERVICE_TICKET_RESOLVER",
    resourceResolverName="GRANT_SERVICE_TICKET_RESOURCE_RESOLVER")
@Timed(name = "GRANT_SERVICE_TICKET_TIMER")
@Metered(name="GRANT_SERVICE_TICKET_METER")
@Counted(name="GRANT_SERVICE_TICKET_COUNTER", monotonic=true)
@Override
public ServiceTicket grantServiceTicket(final String ticketGrantingTicketId,
    final Service service) throws TicketException {
    try {
        return this.grantServiceTicket(ticketGrantingTicketId, service, (Credential[]) null);
    } catch (final AuthenticationException e) {
        throw new IllegalStateException("Unexpected authentication exception", e);
    }
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:17,代码来源:CentralAuthenticationServiceImpl.java


示例4: loginUnsuccessfully

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
@Override
protected MockHttpServletResponse loginUnsuccessfully(final String username, final String fromAddress)
        throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    final MockHttpServletResponse response = new MockHttpServletResponse();
    request.setMethod("POST");
    request.setParameter("username", username);
    request.setRemoteAddr(fromAddress);
    final MockRequestContext context = new MockRequestContext();
    context.setCurrentEvent(new Event("", "error"));
    request.setAttribute("flowRequestContext", context);
    ClientInfoHolder.setClientInfo(new ClientInfo(request));

    getThrottle().preHandle(request, response, null);

    try {
        authenticationManager.authenticate(badCredentials(username));
    } catch (final AuthenticationException e) {
        getThrottle().postHandle(request, response, null, null);
        return response;
    }
    fail("Expected AuthenticationException");
    return null;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:25,代码来源:InspektrThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapterTests.java


示例5: createTicketGrantingTicket

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
/**
 * @throws IllegalArgumentException if the credentials are null.
 */
@Audit(
    action="TICKET_GRANTING_TICKET",
    actionResolverName="CREATE_TICKET_GRANTING_TICKET_RESOLVER",
    resourceResolverName="CREATE_TICKET_GRANTING_TICKET_RESOURCE_RESOLVER")
@Profiled(tag = "CREATE_TICKET_GRANTING_TICKET", logFailuresSeparately = false)
@Transactional(readOnly = false)
public String createTicketGrantingTicket(final Credential... credentials)
        throws AuthenticationException, TicketException {

    Assert.notNull(credentials, "credentials cannot be null");

    final Authentication authentication = this.authenticationManager.authenticate(credentials);

    final TicketGrantingTicket ticketGrantingTicket = new TicketGrantingTicketImpl(
        this.ticketGrantingTicketUniqueTicketIdGenerator
            .getNewTicketId(TicketGrantingTicket.PREFIX),
        authentication, this.ticketGrantingTicketExpirationPolicy);

    this.ticketRegistry.addTicket(ticketGrantingTicket);
    return ticketGrantingTicket.getId();
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:25,代码来源:CentralAuthenticationServiceImpl.java


示例6: loginUnsuccessfully

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
@Override
protected MockHttpServletResponse loginUnsuccessfully(final String username, final String fromAddress)
        throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    final MockHttpServletResponse response = new MockHttpServletResponse();
    request.setMethod("POST");
    request.setParameter("username", username);
    request.setRemoteAddr(fromAddress);
    MockRequestContext context = new MockRequestContext();
    context.setCurrentEvent(new Event("", "error"));
    request.setAttribute("flowRequestContext", context);
    ClientInfoHolder.setClientInfo(new ClientInfo(request));

    getThrottle().preHandle(request, response, null);

    try {
        authenticationManager.authenticate(badCredentials(username));
    } catch (final AuthenticationException e) {
        getThrottle().postHandle(request, response, null, null);
        return response;
    }
    fail("Expected AuthenticationException");
    return null;
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:25,代码来源:InspektrThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapterTests.java


示例7: handleAccountNotFoundExceptionByDefefault

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
@Test
public void handleAccountNotFoundExceptionByDefefault() {
    final AuthenticationExceptionHandler handler = new AuthenticationExceptionHandler();
    final MessageContext ctx = mock(MessageContext.class);
    
    final Map<String, Class<? extends Exception>> map = new HashMap<>();
    map.put("notFound", AccountNotFoundException.class);
    final String id = handler.handle(new AuthenticationException(map), ctx);
    assertEquals(id, AccountNotFoundException.class.getSimpleName());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:11,代码来源:AuthenticationExceptionHandlerTests.java


示例8: handleUnknownExceptionByDefefault

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
@Test
public void handleUnknownExceptionByDefefault() {
    final AuthenticationExceptionHandler handler = new AuthenticationExceptionHandler();
    final MessageContext ctx = mock(MessageContext.class);
    
    final Map<String, Class<? extends Exception>> map = new HashMap<>();
    map.put("unknown", GeneralSecurityException.class);
    final String id = handler.handle(new AuthenticationException(map), ctx);
    assertEquals(id, "UNKNOWN");
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:11,代码来源:AuthenticationExceptionHandlerTests.java


示例9: createProxyGrantingTicket

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
@Audit(
        action="PROXY_GRANTING_TICKET",
        actionResolverName="CREATE_PROXY_GRANTING_TICKET_RESOLVER",
        resourceResolverName="CREATE_PROXY_GRANTING_TICKET_RESOURCE_RESOLVER")
@Timed(name = "CREATE_PROXY_GRANTING_TICKET_TIMER")
@Metered(name = "CREATE_PROXY_GRANTING_TICKET_METER")
@Counted(name="CREATE_PROXY_GRANTING_TICKET_COUNTER", monotonic=true)
@Override
public ProxyGrantingTicket createProxyGrantingTicket(final String serviceTicketId, final AuthenticationContext context)
        throws AuthenticationException, AbstractTicketException {

    final ServiceTicket serviceTicket =  this.ticketRegistry.getTicket(serviceTicketId, ServiceTicket.class);

    if (serviceTicket == null || serviceTicket.isExpired()) {
        logger.debug("ServiceTicket [{}] has expired or cannot be found in the ticket registry", serviceTicketId);
        throw new InvalidTicketException(serviceTicketId);
    }

    final RegisteredService registeredService = this.servicesManager
            .findServiceBy(serviceTicket.getService());

    verifyRegisteredServiceProperties(registeredService, serviceTicket.getService());
    
    if (!registeredService.getProxyPolicy().isAllowedToProxy()) {
        logger.warn("ServiceManagement: Service [{}] attempted to proxy, but is not allowed.", serviceTicket.getService().getId());
        throw new UnauthorizedProxyingException();
    }

    final Authentication authentication = context.getAuthentication();
    final ProxyGrantingTicketFactory factory = this.ticketFactory.get(ProxyGrantingTicket.class);
    final ProxyGrantingTicket proxyGrantingTicket = factory.create(serviceTicket, authentication);

    logger.debug("Generated proxy granting ticket [{}] based off of [{}]", proxyGrantingTicket, serviceTicketId);
    this.ticketRegistry.addTicket(proxyGrantingTicket);

    doPublishEvent(new CasProxyGrantingTicketCreatedEvent(this, proxyGrantingTicket));

    return proxyGrantingTicket;

}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:41,代码来源:CentralAuthenticationServiceImpl.java


示例10: authenticateTwiceWithRenew

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
/**
 * This test simulates :
 * - a first authentication for a default service
 * - a second authentication with the renew parameter and the same service (and same credentials)
 * - a validation of the second ticket.
 * When supplemental authentications were returned with the chained authentications, the validation specification
 * failed as it only expects one authentication. Thus supplemental authentications should not be returned in the
 * chained authentications. Both concepts are orthogonal.
 *
 * @throws AbstractTicketException
 * @throws AuthenticationException
 */
@Test
public void authenticateTwiceWithRenew() throws AbstractTicketException, AuthenticationException {
    final CentralAuthenticationService cas = getCentralAuthenticationService();
    final Service svc = getService("testDefault");
    final UsernamePasswordCredential goodCredential = TestUtils.getCredentialsWithSameUsernameAndPassword();
    final AuthenticationContext ctx =  TestUtils.getAuthenticationContext(getAuthenticationSystemSupport(), svc);
    final TicketGrantingTicket tgtId = cas.createTicketGrantingTicket(ctx);
    cas.grantServiceTicket(tgtId.getId(), svc, ctx);
    // simulate renew with new good same credentials
    final ServiceTicket st2Id = cas.grantServiceTicket(tgtId.getId(), svc, ctx);
    final Assertion assertion = cas.validateServiceTicket(st2Id.getId(), svc);
    final ValidationSpecification validationSpecification = new Cas20WithoutProxyingValidationSpecification();
    assertTrue(validationSpecification.isSatisfiedBy(assertion));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:27,代码来源:CentralAuthenticationServiceImplTests.java


示例11: verifyDestroyRemoteRegistry

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
/**
 * This test checks that the TGT destruction happens properly for a remote registry.
 * It previously failed when the deletion happens before the ticket was marked expired because an update was necessary for that.
 *
 * @throws AuthenticationException
 * @throws AbstractTicketException
 */
@Test
public void verifyDestroyRemoteRegistry() throws AbstractTicketException, AuthenticationException {
    final MockOnlyOneTicketRegistry registry = new MockOnlyOneTicketRegistry();
    final TicketGrantingTicketImpl tgt = new TicketGrantingTicketImpl("TGT-1", mock(Authentication.class),
        mock(ExpirationPolicy.class));
    final MockExpireUpdateTicketLogoutManager logoutManager = new MockExpireUpdateTicketLogoutManager(registry);
    registry.addTicket(tgt);
    final CentralAuthenticationServiceImpl cas = new CentralAuthenticationServiceImpl(registry, null, null, logoutManager);
    cas.setApplicationEventPublisher(mock(ApplicationEventPublisher.class));
    cas.destroyTicketGrantingTicket(tgt.getId());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:19,代码来源:CentralAuthenticationServiceImplTests.java


示例12: processAuthenticationAttempt

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
private AuthenticationContext processAuthenticationAttempt(final Service service, final Credential... credential) throws
        AuthenticationException {
    final AuthenticationContextBuilder builder = new DefaultAuthenticationContextBuilder(
            this.authenticationSystemSupport.getPrincipalElectionStrategy());
    final AuthenticationTransaction transaction =
            AuthenticationTransaction.wrap(credential);
    this.authenticationSystemSupport.getAuthenticationTransactionManager()
            .handle(transaction, builder);
    return builder.build(service);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:11,代码来源:MultifactorAuthenticationTests.java


示例13: createTicketGrantingTicket

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * @throws IllegalArgumentException if the Credentials are null or if given
 * invalid credentials.
 */
@Override
public TicketGrantingTicket createTicketGrantingTicket(final Credential... credentials)
        throws AuthenticationException, TicketException {

    Assert.notNull(credentials, "credentials cannot be null");
    checkForErrors(credentials);

    return this.centralAuthenticationService.createTicketGrantingTicket(credentials);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:15,代码来源:RemoteCentralAuthenticationService.java


示例14: grantServiceTicket

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * @throws IllegalArgumentException if given invalid credentials
 */
@Override
public ServiceTicket grantServiceTicket(
        final String ticketGrantingTicketId, final Service service, final Credential... credentials)
        throws AuthenticationException, TicketException {

    checkForErrors(credentials);

    return this.centralAuthenticationService.grantServiceTicket(ticketGrantingTicketId, service, credentials);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:14,代码来源:RemoteCentralAuthenticationService.java


示例15: delegateTicketGrantingTicket

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * @throws IllegalArgumentException if the credentials are invalid.
 */
@Override
public TicketGrantingTicket delegateTicketGrantingTicket(final String serviceTicketId, final Credential... credentials)
        throws AuthenticationException, TicketException {

    checkForErrors(credentials);

    return this.centralAuthenticationService.delegateTicketGrantingTicket(serviceTicketId, credentials);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:13,代码来源:RemoteCentralAuthenticationService.java


示例16: delegateTicketGrantingTicket

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
@Audit(
    action="PROXY_GRANTING_TICKET",
    actionResolverName="GRANT_PROXY_GRANTING_TICKET_RESOLVER",
    resourceResolverName="GRANT_PROXY_GRANTING_TICKET_RESOURCE_RESOLVER")
@Timed(name="GRANT_PROXY_GRANTING_TICKET_TIMER")
@Metered(name="GRANT_PROXY_GRANTING_TICKET_METER")
@Counted(name="GRANT_PROXY_GRANTING_TICKET_COUNTER", monotonic=true)
@Override
public TicketGrantingTicket delegateTicketGrantingTicket(final String serviceTicketId, final Credential... credentials)
        throws AuthenticationException, TicketException {

    final ServiceTicket serviceTicket =  this.serviceTicketRegistry.getTicket(serviceTicketId, ServiceTicket.class);

    if (serviceTicket == null || serviceTicket.isExpired()) {
        logger.debug("ServiceTicket [{}] has expired or cannot be found in the ticket registry", serviceTicketId);
        throw new InvalidTicketException(serviceTicketId);
    }

    final RegisteredService registeredService = this.servicesManager
            .findServiceBy(serviceTicket.getService());

    verifyRegisteredServiceProperties(registeredService, serviceTicket.getService());
    
    if (!registeredService.getProxyPolicy().isAllowedToProxy()) {
        logger.warn("ServiceManagement: Service [{}] attempted to proxy, but is not allowed.", serviceTicket.getService().getId());
        throw new UnauthorizedProxyingException();
    }

    final Authentication authentication = this.authenticationManager.authenticate(credentials);

    final String pgtId = this.ticketGrantingTicketUniqueTicketIdGenerator.getNewTicketId(
            TicketGrantingTicket.PROXY_GRANTING_TICKET_PREFIX);
    final TicketGrantingTicket proxyGrantingTicket = serviceTicket.grantTicketGrantingTicket(pgtId,
                                authentication, this.ticketGrantingTicketExpirationPolicy);

    logger.debug("Generated proxy granting ticket [{}] based off of [{}]", proxyGrantingTicket, serviceTicketId);
    this.ticketRegistry.addTicket(proxyGrantingTicket);

    return proxyGrantingTicket;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:41,代码来源:CentralAuthenticationServiceImpl.java


示例17: createTicketGrantingTicket

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
@Audit(
    action="TICKET_GRANTING_TICKET",
    actionResolverName="CREATE_TICKET_GRANTING_TICKET_RESOLVER",
    resourceResolverName="CREATE_TICKET_GRANTING_TICKET_RESOURCE_RESOLVER")
@Timed(name = "CREATE_TICKET_GRANTING_TICKET_TIMER")
@Metered(name = "CREATE_TICKET_GRANTING_TICKET_METER")
@Counted(name="CREATE_TICKET_GRANTING_TICKET_COUNTER", monotonic=true)
@Override
public TicketGrantingTicket createTicketGrantingTicket(final Credential... credentials)
        throws AuthenticationException, TicketException {

    final Set<Credential> sanitizedCredentials = sanitizeCredentials(credentials);
    if (sanitizedCredentials.size() > 0) {
        final Authentication authentication = this.authenticationManager.authenticate(credentials);

        final TicketGrantingTicket ticketGrantingTicket = new TicketGrantingTicketImpl(
                this.ticketGrantingTicketUniqueTicketIdGenerator
                        .getNewTicketId(TicketGrantingTicket.PREFIX),
                authentication, this.ticketGrantingTicketExpirationPolicy);

        this.ticketRegistry.addTicket(ticketGrantingTicket);
        return ticketGrantingTicket;
    }
    final String msg = "No credentials were specified in the request for creating a new ticket-granting ticket";
    logger.warn(msg);
    throw new TicketCreationException(new IllegalArgumentException(msg));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:28,代码来源:CentralAuthenticationServiceImpl.java


示例18: verifyDontUseValidatorsToCheckValidCredentials

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
@Test
public void verifyDontUseValidatorsToCheckValidCredentials() throws Exception {
    try {
        this.remoteCentralAuthenticationService.createTicketGrantingTicket(
                TestUtils.getCredentialsWithDifferentUsernameAndPassword());
        fail("AuthenticationException expected.");
    } catch (final AuthenticationException e) {
        return;
    }
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:11,代码来源:RemoteCentralAuthenticationServiceTests.java


示例19: authenticateTwiceWithRenew

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
/**
 * This test simulates :
 * - a first authentication for a default service
 * - a second authentication with the renew parameter and the same service (and same credentials)
 * - a validation of the second ticket.
 * 
 * When supplemental authentications were returned with the chained authentications, the validation specification
 * failed as it only expects one authentication. Thus supplemental authentications should not be returned in the
 * chained authentications. Both concepts are orthogonal.
 *  
 * @throws org.jasig.cas.ticket.TicketException
 * @throws AuthenticationException
 */
@Test
public void authenticateTwiceWithRenew() throws TicketException, AuthenticationException {
    final CentralAuthenticationService cas = getCentralAuthenticationService();
    final Service svc = TestUtils.getService("testDefault");
    final UsernamePasswordCredential goodCredential = TestUtils.getCredentialsWithSameUsernameAndPassword();
    final TicketGrantingTicket tgtId = cas.createTicketGrantingTicket(goodCredential);
    cas.grantServiceTicket(tgtId.getId(), svc);
    // simulate renew with new good same credentials
    final ServiceTicket st2Id = cas.grantServiceTicket(tgtId.getId(), svc, goodCredential);
    final Assertion assertion = cas.validateServiceTicket(st2Id.getId(), svc);
    final ValidationSpecification validationSpecification = new Cas20WithoutProxyingValidationSpecification();
    assertTrue(validationSpecification.isSatisfiedBy(assertion));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:27,代码来源:CentralAuthenticationServiceImplTests.java


示例20: verifyDestroyRemoteRegistry

import org.jasig.cas.authentication.AuthenticationException; //导入依赖的package包/类
/**
 * This test checks that the TGT destruction happens properly for a remote registry.
 * It previously failed when the deletion happens before the ticket was marked expired because an update was necessary for that.
 *
 * @throws AuthenticationException
 * @throws org.jasig.cas.ticket.TicketException
 */
@Test
public void verifyDestroyRemoteRegistry() throws TicketException, AuthenticationException {
    final MockOnlyOneTicketRegistry registry = new MockOnlyOneTicketRegistry();
    final TicketGrantingTicketImpl tgt = new TicketGrantingTicketImpl("TGT-1", mock(Authentication.class),
            mock(ExpirationPolicy.class));
    final MockExpireUpdateTicketLogoutManager logoutManager = new MockExpireUpdateTicketLogoutManager(registry);
    // consider authentication has happened and the TGT is in the registry
    registry.addTicket(tgt);
    // create a new CASimpl
    final CentralAuthenticationServiceImpl cas = new CentralAuthenticationServiceImpl(registry,  null,  null, null, null, null, null,
            null, logoutManager);
    // destroy to mark expired and then delete : the opposite would fail with a "No ticket to update" error from the registry
    cas.destroyTicketGrantingTicket(tgt.getId());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:22,代码来源:CentralAuthenticationServiceImplTests.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Type类代码示例发布时间:2022-05-23
下一篇:
Java Naming类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap