Commit 21589cee authored by Quxl's avatar Quxl

x

parent 422e9925
......@@ -77,7 +77,7 @@ public interface OAuthApi {
OAuthClientRequest oauthResponse = builder.buildQueryMessage();
String redirectUrl = oauthResponse.getLocationUri();
redirectUrl = redirectUrl.replaceAll("\\+", "%20");
logger.debug("redirect:" + redirectUrl);
logger.debug("oauth authorization url:" + redirectUrl);
return redirectUrl;
} catch (OAuthApiException e) {
throw e;
......@@ -89,7 +89,7 @@ public interface OAuthApi {
default void callback() {
try {
HttpServletRequest request = this.getHttpServletRequest();
logger.debug("oauth callback: " + request.getRequestURI() + " " + JSON.toJSONString(request.getParameterMap()));
logger.debug("oauth callback request: " + request.getRequestURI() + " " + JSON.toJSONString(request.getParameterMap()));
OAuthConfig config = this.getOAuthConfig();
OAuthAuthzResponse oauthAuthzResponse = OAuthAuthzResponse.oauthCodeAuthzResponse(request);
String code = oauthAuthzResponse.getCode();
......@@ -108,6 +108,7 @@ public interface OAuthApi {
String idToken = oAuthResponse.getParam("id_token");
String tokenType = oAuthResponse.getTokenType();
OAuthToken token = new OAuthToken(accessToken, refreshToken, idToken, tokenType, expiresIn);
logger.debug("oauth callback result: " + JSON.toJSONString(token));
saveOAuthToken(token);
} catch (OAuthApiException e) {
throw e;
......@@ -147,11 +148,9 @@ public interface OAuthApi {
builder.setClientId(config.getClientId());
builder.setClientSecret(config.getClientSecret());
OAuthClientRequest oauthClientRequest = builder.buildQueryMessage();
logger.debug("oauth refresh request: " + oauthClientRequest.getLocationUri());
logger.debug("oauth refresh headers: " + JSON.toJSONString(oauthClientRequest.getHeaders()));
logger.debug("oauth refresh body: " + JSON.toJSONString(oauthClientRequest.getBody()));
OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient());
OAuthJSONAccessTokenResponse oAuthResponse = oAuthClient.accessToken(oauthClientRequest, OAuth.HttpMethod.POST);
String accessToken = oAuthResponse.getAccessToken();
......@@ -160,7 +159,7 @@ public interface OAuthApi {
String idToken = oAuthResponse.getParam("id_token");
String tokenType = oAuthResponse.getTokenType();
OAuthToken newToken = new OAuthToken(accessToken, refreshToken, idToken, tokenType, expiresIn);
logger.debug("oauth refresh:" + JSON.toJSONString(newToken));
logger.debug("oauth refresh result:" + JSON.toJSONString(newToken));
session.setAttribute(OAUTH_TOKEN_SESSION, newToken);
} catch (OAuthApiException e) {
throw e;
......@@ -171,9 +170,9 @@ public interface OAuthApi {
default String doPost(String url, Map<String, String> headers, JSONObject data) {
try {
logger.debug("oauth post: " + url);
logger.debug("oauth headers: " + JSON.toJSONString(headers));
logger.debug("oauth data: " + data.toJSONString());
logger.debug("oauth post url: " + url);
logger.debug("oauth post headers: " + JSON.toJSONString(headers));
logger.debug("oauth post data: " + data.toJSONString());
String accept = "application/json";
String requestId = ("" + System.currentTimeMillis());
String countryCode = System.getProperty("X-SE-IFW-CountryCode");
......@@ -194,7 +193,7 @@ public interface OAuthApi {
clientRequest.setHeaders(headers);
OAuthResourceResponse resourceResponse = oAuthClient.resource(clientRequest, "POST", OAuthResourceResponse.class);
String resBody = resourceResponse.getBody();
logger.debug("oauth result: " + resBody);
logger.debug("oauth post result: " + resBody);
return resBody;
} catch (OAuthApiException e) {
throw 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