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

Java Cas30ServiceTicketValidator类代码示例

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

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



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

示例1: validateRequestAndBuildCasAssertion

import org.jasig.cas.client.validation.Cas30ServiceTicketValidator; //导入依赖的package包/类
private Assertion validateRequestAndBuildCasAssertion(final HttpServletResponse response,
                                                      final HttpServletRequest request,
                                                      final Pair<AuthnRequest, MessageContext> pair) throws Exception {
    final AuthnRequest authnRequest = pair.getKey();
    final String ticket = CommonUtils.safeGetParameter(request, CasProtocolConstants.PARAMETER_TICKET);
    final Cas30ServiceTicketValidator validator = new Cas30ServiceTicketValidator(this.serverPrefix);

    final HttpsURLConnectionFactory factory = new HttpsURLConnectionFactory();
    factory.setHostnameVerifier(this.hostnameVerifier);
    validator.setURLConnectionFactory(factory);
    
    validator.setRenew(authnRequest.isForceAuthn());
    final String serviceUrl = constructServiceUrl(request, response, pair);
    LOGGER.debug("Created service url for validation: [{}]", serviceUrl);
    final Assertion assertion = validator.validate(ticket, serviceUrl);
    logCasValidationAssertion(assertion);
    return assertion;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:19,代码来源:SSOPostProfileCallbackHandlerController.java


示例2: validateRequestAndBuildCasAssertion

import org.jasig.cas.client.validation.Cas30ServiceTicketValidator; //导入依赖的package包/类
private Assertion validateRequestAndBuildCasAssertion(final HttpServletResponse response,
                                                      final HttpServletRequest request,
                                                      final WSFederationRequest fedRequest) throws Exception {
    final String ticket = CommonUtils.safeGetParameter(request, CasProtocolConstants.PARAMETER_TICKET);
    final Cas30ServiceTicketValidator validator = new Cas30ServiceTicketValidator(casProperties.getServer().getPrefix());
    final String serviceUrl = constructServiceUrl(request, response, fedRequest);
    LOGGER.debug("Created service url for validation: [{}]", serviceUrl);
    final Assertion assertion = validator.validate(ticket, serviceUrl);
    LOGGER.debug("Located CAS assertion [{}]", assertion);
    return assertion;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:12,代码来源:WSFederationValidateRequestCallbackController.java


示例3: generateToken

import org.jasig.cas.client.validation.Cas30ServiceTicketValidator; //导入依赖的package包/类
/**
 * Generate token string.
 *
 * @param service    the service
 * @param parameters the parameters
 * @return the jwt
 */
protected String generateToken(final Service service, final Map<String, String> parameters) {
    try {
        final String ticketId = parameters.get(CasProtocolConstants.PARAMETER_TICKET);
        final Cas30ServiceTicketValidator validator = new Cas30ServiceTicketValidator(casProperties.getServer().getPrefix());
        final Assertion assertion = validator.validate(ticketId, service.getId());
        final JWTClaimsSet.Builder claims =
                new JWTClaimsSet.Builder()
                        .audience(service.getId())
                        .issuer(casProperties.getServer().getPrefix())
                        .jwtID(ticketId)
                        .issueTime(assertion.getAuthenticationDate())
                        .subject(assertion.getPrincipal().getName());
        assertion.getAttributes().forEach(claims::claim);
        assertion.getPrincipal().getAttributes().forEach(claims::claim);

        if (assertion.getValidUntilDate() != null) {
            claims.expirationTime(assertion.getValidUntilDate());
        } else {
            final ZonedDateTime dt = ZonedDateTime.now().plusSeconds(ticketGrantingTicketExpirationPolicy.getTimeToLive());
            claims.expirationTime(DateTimeUtils.dateOf(dt));
        }
        final JWTClaimsSet claimsSet = claims.build();
        final JSONObject object = claimsSet.toJSONObject();
        return tokenCipherExecutor.encode(object.toJSONString());
    } catch (final Exception e) {
        throw Throwables.propagate(e);
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:36,代码来源:TokenWebApplicationServiceResponseBuilder.java


示例4: build

import org.jasig.cas.client.validation.Cas30ServiceTicketValidator; //导入依赖的package包/类
@Override
public TicketValidator build() {
    Cas30ServiceTicketValidator ticketValidator = new Cas30ServiceTicketValidator(casServerUrlPrefix);
    if (proxyChainsValidation != null) {
        logger.warn(OMISSION_MESSAGE_TEMPLATE, "proxyChainsValidation");
    }
    if (proxyChains != null) {
        logger.warn(OMISSION_MESSAGE_TEMPLATE, "proxyChains");
    }
    if (allowEmptyProxyChain != null) {
        logger.warn(OMISSION_MESSAGE_TEMPLATE, "allowEmptyProxyChain");
    }
    super.configure(ticketValidator);
    return ticketValidator;
}
 
开发者ID:kakawait,项目名称:cas-security-spring-boot-starter,代码行数:16,代码来源:CasTicketValidatorBuilder.java


示例5: internalInit

import org.jasig.cas.client.validation.Cas30ServiceTicketValidator; //导入依赖的package包/类
@Override
protected void internalInit(final WebContext context) {
    CommonHelper.assertNotBlank("casServerPrefixUrl", this.casServerPrefixUrl);
    if (CommonHelper.isBlank(casRestUrl)) {
        casRestUrl = casServerPrefixUrl;
        if (!casRestUrl.endsWith("/")) {
            casRestUrl += "/";
        }
        casRestUrl += "v1/tickets";
    }
    if (this.ticketValidator == null) {
        this.ticketValidator =  new Cas30ServiceTicketValidator(this.casServerPrefixUrl);
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:15,代码来源:CasRestAuthenticator.java


示例6: testDoGetPassiveAndForced

import org.jasig.cas.client.validation.Cas30ServiceTicketValidator; //导入依赖的package包/类
@Test
public void testDoGetPassiveAndForced() throws Exception {
    //Mock some objects.
    HttpServletRequest request = createDoGetHttpServletRequest(CONVERSATION_TICKET_GATEWAY_ATTEMPTED, TICKET, "true");
    HttpServletResponse response = createMockHttpServletResponse();
    Assertion assertion = createMockAssertion();

    Cas20ServiceTicketValidator ticketValidator = PowerMockito.mock(Cas30ServiceTicketValidator.class);
    PowerMockito.when(ticketValidator.validate(TICKET, URL_WITH_CONVERSATION_GATEWAY_ATTEMPTED)).thenReturn(assertion);

    PowerMockito.mockStatic(ExternalAuthentication.class);
    BDDMockito.given(ExternalAuthentication.startExternalAuthentication(request)).willReturn(E1S1);

    //Prep our object
    ShibcasAuthServlet shibcasAuthServlet = createShibcasAuthServlet();

    //Override the internal Cas30TicketValidator because we don't want it to call a real server
    MemberModifier.field(ShibcasAuthServlet.class, "ticketValidator").set(shibcasAuthServlet, ticketValidator);

    //Passive and forced request/response
    BDDMockito.given(request.getAttribute(ExternalAuthentication.FORCE_AUTHN_PARAM)).willReturn("true");
    BDDMockito.given(request.getAttribute(ExternalAuthentication.PASSIVE_AUTHN_PARAM)).willReturn("true");
    shibcasAuthServlet.doGet(request, response);

    //Verify
    verify(request).setAttribute(ExternalAuthentication.PRINCIPAL_NAME_KEY, JDOE);
}
 
开发者ID:Unicon,项目名称:shib-cas-authn3,代码行数:28,代码来源:ShibcasAuthServletTest.java


示例7: ticketValidator

import org.jasig.cas.client.validation.Cas30ServiceTicketValidator; //导入依赖的package包/类
@Bean
public Cas30ServiceTicketValidator ticketValidator() {
	Cas30ServiceTicketValidator validator = new Cas30ServiceTicketValidator(loginProperties.getCasUrl());
	validator.setEncoding("UTF-8");
	return validator;
}
 
开发者ID:easycodebox,项目名称:easycode,代码行数:7,代码来源:ShiroConfig.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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