Commit ac689ac7 authored by Liang Ding's avatar Liang Ding

🎨 动态切换登录授权接口地址

parent cce83b6d
...@@ -22,11 +22,16 @@ package org.b3log.solo.model; ...@@ -22,11 +22,16 @@ package org.b3log.solo.model;
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://hacpai.com/member/e">Dongxu Wang</a> * @author <a href="https://hacpai.com/member/e">Dongxu Wang</a>
* @version 1.7.0.2, Feb 11, 2019 * @version 1.7.0.3, Feb 27, 2019
* @since 0.3.1 * @since 0.3.1
*/ */
public final class Common { public final class Common {
/**
* Key of URL.
*/
public static final String URL = "url";
/** /**
* Key of referer. * Key of referer.
*/ */
......
...@@ -55,7 +55,7 @@ import java.util.concurrent.ConcurrentHashMap; ...@@ -55,7 +55,7 @@ import java.util.concurrent.ConcurrentHashMap;
* </ul> * </ul>
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.4, Feb 15, 2019 * @version 1.0.0.5, Feb 27, 2019
* @since 2.9.5 * @since 2.9.5
*/ */
@RequestProcessor @RequestProcessor
...@@ -137,6 +137,7 @@ public class OAuthGitHubProcessor { ...@@ -137,6 +137,7 @@ public class OAuthGitHubProcessor {
return; return;
} }
final String clientId = result.optString(Common.DATA); final String clientId = result.optString(Common.DATA);
final String loginAuthURL = result.optString(Common.URL);
String referer = context.param("referer"); String referer = context.param("referer");
if (StringUtils.isBlank(referer)) { if (StringUtils.isBlank(referer)) {
...@@ -146,7 +147,7 @@ public class OAuthGitHubProcessor { ...@@ -146,7 +147,7 @@ public class OAuthGitHubProcessor {
final String state = referer + ":::" + RandomStringUtils.randomAlphanumeric(16) + ":::cb=" + cb + ":::"; final String state = referer + ":::" + RandomStringUtils.randomAlphanumeric(16) + ":::cb=" + cb + ":::";
STATES.put(state, URLs.encode(state)); STATES.put(state, URLs.encode(state));
final String path = "https://github.com/login/oauth/authorize" + "?client_id=" + clientId + "&state=" + state final String path = loginAuthURL + "?client_id=" + clientId + "&state=" + state
+ "&scope=public_repo,read:user,user:email,user:follow"; + "&scope=public_repo,read:user,user:email,user:follow";
context.sendRedirect(path); context.sendRedirect(path);
......
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