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


Java Service.setPrincipal方法代码示例

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


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

示例1: updateServiceAndTrackSession

import org.jasig.cas.authentication.principal.Service; //导入方法依赖的package包/类
/**
 * Update service and track session.
 *
 * @param id                         the id
 * @param service                    the service
 * @param onlyTrackMostRecentSession the only track most recent session
 */
protected void updateServiceAndTrackSession(final String id, final Service service, final boolean onlyTrackMostRecentSession) {
    updateState();

    final List<Authentication> authentications = getChainedAuthentications();
    service.setPrincipal(authentications.get(authentications.size()-1).getPrincipal());

    if (onlyTrackMostRecentSession) {
        final String path = normalizePath(service);
        final Collection<Service> existingServices = services.values();
        // loop on existing services
        for (final Service existingService : existingServices) {
            final String existingPath = normalizePath(existingService);
            // if an existing service has the same normalized path, remove it
            // and its service ticket to keep the latest one
            if (StringUtils.equals(path, existingPath)) {
                existingServices.remove(existingService);
                LOGGER.trace("Removed previous tickets for service: {}", existingService);
                break;
            }
        }
    }
    this.services.put(id, service);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:31,代码来源:TicketGrantingTicketImpl.java

示例2: grantServiceTicket

import org.jasig.cas.authentication.principal.Service; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 * <p>The state of the ticket is affected by this operation and the
 * ticket will be considered used. The state update subsequently may
 * impact the ticket expiration policy in that, depending on the policy
 * configuration, the ticket may be considered expired.
 */
@Override
public synchronized ServiceTicket grantServiceTicket(final String id,
    final Service service, final ExpirationPolicy expirationPolicy,
    final boolean credentialsProvided) {
    final ServiceTicket serviceTicket = new ServiceTicketImpl(id, this,
        service, this.getCountOfUses() == 0 || credentialsProvided,
        expirationPolicy);

    updateState();

    final List<Authentication> authentications = getChainedAuthentications();
    service.setPrincipal(authentications.get(authentications.size()-1).getPrincipal());

    this.services.put(id, service);

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


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