Commit d68cf3a3 authored by Quxl's avatar Quxl

x

parent 45ec31fe
...@@ -54,7 +54,7 @@ public interface OAuthApi { ...@@ -54,7 +54,7 @@ public interface OAuthApi {
default void doOAuthLogin() { default void doOAuthLogin() {
try { try {
String redirectUrl = this.getOAuthPath(); String redirectUrl = this.getAuthorizationUrl();
HttpServletResponse response = this.getHttpServletResponse(); HttpServletResponse response = this.getHttpServletResponse();
response.sendRedirect(redirectUrl); response.sendRedirect(redirectUrl);
} catch (OAuthApiException e) { } catch (OAuthApiException e) {
...@@ -64,7 +64,7 @@ public interface OAuthApi { ...@@ -64,7 +64,7 @@ public interface OAuthApi {
} }
} }
default String getOAuthPath() { default String getAuthorizationUrl() {
try { try {
OAuthConfig config = this.getOAuthConfig(); OAuthConfig config = this.getOAuthConfig();
AuthenticationRequestBuilder builder = OAuthClientRequest.authorizationLocation(config.getAuthorizeUrl()); AuthenticationRequestBuilder builder = OAuthClientRequest.authorizationLocation(config.getAuthorizeUrl());
...@@ -85,7 +85,7 @@ public interface OAuthApi { ...@@ -85,7 +85,7 @@ public interface OAuthApi {
} }
} }
default void doOAuthCallback() { default void callback() {
try { try {
HttpServletRequest request = this.getHttpServletRequest(); HttpServletRequest request = this.getHttpServletRequest();
HttpSession session = request.getSession(); HttpSession session = request.getSession();
...@@ -120,7 +120,7 @@ public interface OAuthApi { ...@@ -120,7 +120,7 @@ public interface OAuthApi {
} }
} }
default void doLogout() { default void removeOAuthToken() {
try { try {
HttpServletRequest request = this.getHttpServletRequest(); HttpServletRequest request = this.getHttpServletRequest();
HttpSession session = request.getSession(); HttpSession session = request.getSession();
...@@ -133,7 +133,7 @@ public interface OAuthApi { ...@@ -133,7 +133,7 @@ public interface OAuthApi {
} }
} }
default void refresh() { default void refreshOAuthToken() {
try { try {
HttpServletRequest request = this.getHttpServletRequest(); HttpServletRequest request = this.getHttpServletRequest();
HttpSession session = request.getSession(); HttpSession session = request.getSession();
...@@ -187,7 +187,7 @@ public interface OAuthApi { ...@@ -187,7 +187,7 @@ public interface OAuthApi {
} catch (OAuthApiException e) { } catch (OAuthApiException e) {
throw e; throw e;
} catch (OAuthProblemException e) { } catch (OAuthProblemException e) {
this.refresh(); this.refreshOAuthToken();
return doPost(url, headers, data); return doPost(url, headers, data);
} catch (Throwable e) { } catch (Throwable e) {
throw new OAuthApiException(e.getMessage(), 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