Commit c26c71f0 authored by Quxl's avatar Quxl

x

parent 5b8f4703
package com.egolm.sso.oauth;
public class NoTokenException extends OAuthApiException {
private static final long serialVersionUID = 1L;
}
......@@ -345,9 +345,9 @@ public interface OAuthApi {
* @param headers HTTP头信息
* @param data HTTP请求参数
* @return HTTP请求响应结果
* @throws NoTokenException
* @throws OAuthTokenException Token不存在(没有授权)时,抛出此异常
*/
default String doPost(String url, Map<String, String> headers, JSONObject data) throws NoTokenException {
default String doPost(String url, Map<String, String> headers, JSONObject data) throws OAuthTokenException {
try {
String jsonData = data == null ? "" : data.toString();
logger.debug("oauth post url: " + url);
......@@ -355,7 +355,7 @@ public interface OAuthApi {
logger.debug("oauth post data: " + jsonData);
OAuthToken token = this.getOAuthToken();
if(token == null) {
throw new NoTokenException();
throw new OAuthTokenException("OAuthToken not found");
}
if(System.currentTimeMillis() - token.getCreateMillis() > ((token.getExpiresIn()-5) * 60 * 1000)) {
token = this.refreshOAuthToken();
......
package com.egolm.sso.oauth;
public class OAuthTokenException extends OAuthApiException {
private static final long serialVersionUID = 5506671150969428663L;
public OAuthTokenException() {
super();
}
public OAuthTokenException(String message, Throwable e) {
super(message, e);
}
public OAuthTokenException(String message) {
super(message);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment