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


Java TicketState.getCountOfUses方法代码示例

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


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

示例1: isExpired

import org.jasig.cas.ticket.TicketState; //导入方法依赖的package包/类
@Override
public boolean isExpired(final TicketState ticketState) {
    final long currentTimeInMillis = System.currentTimeMillis();
    final long lastTimeTicketWasUsed = ticketState.getLastTimeUsed();

    if (ticketState.getCountOfUses() == 0
        && (currentTimeInMillis - lastTimeTicketWasUsed < this.timeToKillInMilliSeconds)) {
        LOGGER.debug("Ticket is not expired due to a count of zero and the time being less "
                + "than the timeToKillInMilliseconds");
        return false;
    }

    if ((currentTimeInMillis - lastTimeTicketWasUsed >= this.timeToKillInMilliSeconds)) {
        LOGGER.debug("Ticket is expired due to the time being greater than the timeToKillInMilliseconds");
        return true;
    }

    if ((currentTimeInMillis - lastTimeTicketWasUsed <= this.timeInBetweenUsesInMilliSeconds)) {
        LOGGER.warn("Ticket is expired due to the time being less than the waiting period.");
        return true;
    }

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

示例2: isExpired

import org.jasig.cas.ticket.TicketState; //导入方法依赖的package包/类
@Override
public boolean isExpired(final TicketState ticketState) {
    if (ticketState == null) {
        LOGGER.debug("Ticket state is null for {}", this.getClass().getSimpleName());
        return true;
    }
    final long countUses = ticketState.getCountOfUses();
    if (countUses >= this.numberOfUses) {
        LOGGER.debug("Ticket usage count {} is greater than or equal to {}", countUses, this.numberOfUses);
        return true;
    }

    final long systemTime = System.currentTimeMillis();
    final long lastTimeUsed = ticketState.getLastTimeUsed();
    final long difference = systemTime - lastTimeUsed;

    if (difference >= this.timeToKillInMilliSeconds) {
        LOGGER.debug("Ticket has expired because the difference between current time [{}] "
            + "and ticket time [{}] is greater than or equal to [{}]", systemTime, lastTimeUsed,
            this.timeToKillInMilliSeconds);
        return true;
    }
    return false;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:25,代码来源:MultiTimeUseOrTimeoutExpirationPolicy.java

示例3: isExpired

import org.jasig.cas.ticket.TicketState; //导入方法依赖的package包/类
@Override
public boolean isExpired(final TicketState ticketState) {
    final long currentTimeInMillis = System.currentTimeMillis();
    final long lastTimeTicketWasUsed = ticketState.getLastTimeUsed();

    if (ticketState.getCountOfUses() == 0
        && (currentTimeInMillis - lastTimeTicketWasUsed < this.timeToKillInMilliSeconds)) {
        logger.debug("Ticket is not expired due to a count of zero and the time being less "
                + "than the timeToKillInMilliseconds");
        return false;
    }

    if ((currentTimeInMillis - lastTimeTicketWasUsed >= this.timeToKillInMilliSeconds)) {
        logger.debug("Ticket is expired due to the time being greater than the timeToKillInMilliseconds");
        return true;
    }

    if ((currentTimeInMillis - lastTimeTicketWasUsed <= this.timeInBetweenUsesInMilliSeconds)) {
        logger.warn("Ticket is expired due to the time being less than the waiting period.");
        return true;
    }

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

示例4: isExpired

import org.jasig.cas.ticket.TicketState; //导入方法依赖的package包/类
public boolean isExpired(final TicketState ticketState) {
    if (ticketState.getCountOfUses() == 0
        && (System.currentTimeMillis() - ticketState.getLastTimeUsed() < this.timeToKillInMilliSeconds)) {
        LOGGER.debug("Ticket is not expired due to a count of zero and the time being less "
                + "than the timeToKillInMilliseconds");
        return false;
    }

    if ((System.currentTimeMillis() - ticketState.getLastTimeUsed() >= this.timeToKillInMilliSeconds)) {
        LOGGER.debug("Ticket is expired due to the time being greater than the timeToKillInMilliseconds");
        return true;
    }

    if ((System.currentTimeMillis() - ticketState.getLastTimeUsed() <= this.timeInBetweenUsesInMilliSeconds)) {
        LOGGER.warn("Ticket is expired due to the time being less than the waiting period.");
        return true;
    }

    return false;
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:21,代码来源:ThrottledUseAndTimeoutExpirationPolicy.java

示例5: isExpired

import org.jasig.cas.ticket.TicketState; //导入方法依赖的package包/类
@Override
public boolean isExpired(final TicketState ticketState) {
    return (ticketState == null)
        || (ticketState.getCountOfUses() >= this.numberOfUses)
        || (System.currentTimeMillis() - ticketState.getLastTimeUsed() >= this.timeToKillInMilliSeconds);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:7,代码来源:MultiTimeUseOrTimeoutExpirationPolicy.java

示例6: isExpired

import org.jasig.cas.ticket.TicketState; //导入方法依赖的package包/类
public boolean isExpired(final TicketState ticketState) {
    return (ticketState == null)
        || (ticketState.getCountOfUses() >= this.numberOfUses)
        || (System.currentTimeMillis() - ticketState.getLastTimeUsed() >= this.timeToKillInMilliSeconds);
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:6,代码来源:MultiTimeUseOrTimeoutExpirationPolicy.java


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