Commit 886e8e16 authored by Quxl's avatar Quxl

x

parent 385053b5
......@@ -51,7 +51,7 @@ public interface OAuthApi {
}
}
default OAuthToken getOAuthToken() {
default OAuthToken doLogin() {
try {
HttpServletRequest request = this.getHttpServletRequest();
HttpSession session = request.getSession();
......@@ -83,7 +83,14 @@ public interface OAuthApi {
}
}
default OAuthToken refreshOAuthToken() {
default void doLogout() {
HttpServletRequest request = this.getHttpServletRequest();
HttpSession session = request.getSession();
session.removeAttribute(OAUTH_TOKEN_SESSION);
session.invalidate();
}
default OAuthToken refresh() {
try {
HttpServletRequest request = this.getHttpServletRequest();
HttpSession session = request.getSession();
......@@ -124,7 +131,7 @@ public interface OAuthApi {
String resBody = resourceResponse.getBody();
return resBody;
} catch (OAuthProblemException e) {
this.refreshOAuthToken();
this.refresh();
return doRequest(method, url, parameters);
} catch (Exception e) {
throw new OAuthApiException(e.getMessage(), e);
......
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