package com.epmet.auth; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.server.ServerWebExchange; /** * 外部应用认证处理器父类 */ public abstract class ExtAppAuthProcessor { private Logger logger = LoggerFactory.getLogger(getClass()); private int diffMillins = 1000 * 60 * 5; public abstract void auth(String appId, String token, Long ts, ServerWebExchange exchange); /** * 时间戳校验 * @param timestamp * @return */ protected boolean validTimeStamp(Long timestamp) { long now = System.currentTimeMillis(); if (Math.abs(now - timestamp) > diffMillins) { return false; } return true; } }