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


Java TicketGrantingTicket.getId方法代码示例

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


在下文中一共展示了TicketGrantingTicket.getId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTicketGrantingTicket

import org.jasig.cas.ticket.TicketGrantingTicket; //导入方法依赖的package包/类
/**
 * Create new ticket granting ticket.
 *
 * @param requestBody username and password application/x-www-form-urlencoded values
 * @param request raw HttpServletRequest used to call this method
 * @return ResponseEntity representing RESTful response
 */
@RequestMapping(value = "/tickets", method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public final ResponseEntity<String> createTicketGrantingTicket(@RequestBody final MultiValueMap<String, String> requestBody,
                                                               final HttpServletRequest request) {
    try (Formatter fmt = new Formatter()) {
        final TicketGrantingTicket tgtId = this.cas.createTicketGrantingTicket(obtainCredential(requestBody));
        final URI ticketReference = new URI(request.getRequestURL().toString() + '/' + tgtId.getId());
        final HttpHeaders headers = new HttpHeaders();
        headers.setLocation(ticketReference);
        headers.setContentType(MediaType.TEXT_HTML);
        fmt.format("<!DOCTYPE HTML PUBLIC \\\"-//IETF//DTD HTML 2.0//EN\\\"><html><head><title>");
        //IETF//DTD HTML 2.0//EN\\\"><html><head><title>");
        fmt.format("%s %s", HttpStatus.CREATED, HttpStatus.CREATED.getReasonPhrase())
                .format("</title></head><body><h1>TGT Created</h1><form action=\"%s", ticketReference.toString())
                .format("\" method=\"POST\">Service:<input type=\"text\" name=\"service\" value=\"\">")
                .format("<br><input type=\"submit\" value=\"Submit\"></form></body></html>");
        return new ResponseEntity<String>(fmt.toString(), headers, HttpStatus.CREATED);
    } catch (final Throwable e) {
        LOGGER.error(e.getMessage(), e);
        return new ResponseEntity<String>(e.getMessage(), HttpStatus.BAD_REQUEST);
    }
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:29,代码来源:TicketsResource.java

示例2: createTicketGrantingTicket

import org.jasig.cas.ticket.TicketGrantingTicket; //导入方法依赖的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

示例3: addTicket

import org.jasig.cas.ticket.TicketGrantingTicket; //导入方法依赖的package包/类
@Override
public void addTicket(final Ticket ticket) {
    if (ticket instanceof TicketGrantingTicket) {
        final TicketGrantingTicket ticketGrantingTicket = (TicketGrantingTicket) ticket;
        final String ticketId = ticketGrantingTicket.getId();
        final String userName = ticketGrantingTicket.getAuthentication().getPrincipal().getId().toLowerCase();

        logger.debug("Creating mapping ticket {} to user name {}", ticketId, userName);

        this.cache.put(ticketId, userName);
    }

    this.ticketRegistry.addTicket(ticket);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:15,代码来源:TicketRegistryDecorator.java

示例4: generate

import org.jasig.cas.ticket.TicketGrantingTicket; //导入方法依赖的package包/类
@Override
public String generate(final Service service, final TicketGrantingTicket ticketGrantingTicket) {
    final String accessToken = ticketGrantingTicket.getId() + UserProfile.SEPARATOR + service.getId();
    LOGGER.debug("Created access token {}, now encoding it as base64", accessToken);
    return CompressionUtils.encodeBase64(accessToken.getBytes());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:7,代码来源:DefaultAccessTokenGenerator.java

示例5: delegateTicketGrantingTicket

import org.jasig.cas.ticket.TicketGrantingTicket; //导入方法依赖的package包/类
/**
 * @throws IllegalArgumentException if the ServiceTicketId or the
 * Credential are null.
 */
@Audit(
    action="PROXY_GRANTING_TICKET",
    actionResolverName="GRANT_PROXY_GRANTING_TICKET_RESOLVER",
    resourceResolverName="GRANT_PROXY_GRANTING_TICKET_RESOURCE_RESOLVER")
@Profiled(tag="GRANT_PROXY_GRANTING_TICKET", logFailuresSeparately = false)
@Transactional(readOnly = false)
public String delegateTicketGrantingTicket(final String serviceTicketId, final Credential... credentials)
        throws AuthenticationException, TicketException {

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

    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.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 TicketGrantingTicket ticketGrantingTicket = serviceTicket
            .grantTicketGrantingTicket(
                    this.ticketGrantingTicketUniqueTicketIdGenerator
                            .getNewTicketId(TicketGrantingTicket.PREFIX),
                    authentication, this.ticketGrantingTicketExpirationPolicy);

    this.ticketRegistry.addTicket(ticketGrantingTicket);

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

示例6: putTicketGrantingTicketInScopes

import org.jasig.cas.ticket.TicketGrantingTicket; //导入方法依赖的package包/类
/**
 * Put ticket granting ticket in request and flow scopes.
 *
 * @param context the context
 * @param ticket the ticket value
 */
public static void putTicketGrantingTicketInScopes(
    final RequestContext context, @NotNull final TicketGrantingTicket ticket) {
    final String ticketValue = ticket != null ? ticket.getId() : null;
    putTicketGrantingTicketInScopes(context, ticketValue);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:12,代码来源:WebUtils.java


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