You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|