diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..2345405
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,10 @@
+## 版本更新记录
+
+### 【0.0.2】2019-08-01
+
+- 升级 `JustAuth` 版本:1.9.5
+
+### 【0.0.1】2019-07-23
+
+- 使用 `JustAuth` 版本:1.9.2
+
diff --git a/README.md b/README.md
index 78ee939..9870344 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ https://github.com/xkcoding/justauth-spring-boot-starter-demo
- * 测试 Controller - *
- * - * @author yangkai.shen - * @date Created in 2019-07-22 11:17 - */ +@Slf4j @RestController @RequestMapping("/oauth") @RequiredArgsConstructor(onConstructor_ = @Autowired) @@ -75,15 +51,14 @@ public class TestController { @GetMapping("/login/qq") public void login(HttpServletResponse response) throws IOException { AuthRequest authRequest = factory.get(AuthSource.QQ); - response.sendRedirect(authRequest.authorize()); + response.sendRedirect(authRequest.authorize(AuthStateUtils.createState())); } @RequestMapping("/qq/callback") public AuthResponse login(AuthCallback callback) { - AuthRequest authRequest = factory.get(AuthSource.QQ); - AuthResponse response = authRequest.login(callback); - // 移除校验通过的state - AuthState.delete(AuthSource.QQ); + AuthRequest authRequest2 = factory.get(AuthSource.QQ); + AuthResponse response = authRequest2.login(callback); + log.info("【response】= {}", JSONUtil.toJsonStr(response)); return response; } } diff --git a/pom.xml b/pom.xml index 3aa07f1..c228450 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@@@ -26,19 +27,7 @@ public class AuthRequestFactory { * @return {@link AuthRequest} */ public AuthRequest get(AuthSource source) { - return get(source, null); - } - - /** - * 返回AuthRequest对象 - * - * @param source {@link AuthSource} - * @param state {@link AuthSource} - * @return {@link AuthRequest} - */ - public AuthRequest get(AuthSource source, Object state) { AuthConfig config = properties.getType().get(source); - config.setState(state == null ? AuthState.create(source) : AuthState.create(source, state)); switch (source) { case GITHUB: return new AuthGithubRequest(config); @@ -89,7 +78,7 @@ public AuthRequest get(AuthSource source, Object state) { case STACK_OVERFLOW: return new AuthStackOverflowRequest(config); default: - return null; + throw new AuthException(AuthResponseStatus.UNSUPPORTED); } } }