🚚 移动文件
This commit is contained in:
21
README.md
21
README.md
@@ -30,7 +30,7 @@ https://github.com/xkcoding/justauth-spring-boot-starter-demo
|
||||
<dependency>
|
||||
<groupId>com.xkcoding</groupId>
|
||||
<artifactId>justauth-spring-boot-starter</artifactId>
|
||||
<version>1.1.0</version>
|
||||
<version>1.2.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
@@ -65,25 +65,18 @@ public class TestController {
|
||||
|
||||
@GetMapping("/login/{type}")
|
||||
public void login(@PathVariable String type, HttpServletResponse response) throws IOException {
|
||||
AuthRequest authRequest = factory.get(getAuthSource(type));
|
||||
AuthRequest authRequest = factory.get(type);
|
||||
response.sendRedirect(authRequest.authorize(AuthStateUtils.createState()));
|
||||
}
|
||||
|
||||
@RequestMapping("/{type}/callback")
|
||||
public AuthResponse login(@PathVariable String type, AuthCallback callback) {
|
||||
AuthRequest authRequest = factory.get(getAuthSource(type));
|
||||
AuthRequest authRequest = factory.get(type);
|
||||
AuthResponse response = authRequest.login(callback);
|
||||
log.info("【response】= {}", JSONUtil.toJsonStr(response));
|
||||
return response;
|
||||
}
|
||||
|
||||
private AuthSource getAuthSource(String type) {
|
||||
if (StrUtil.isNotBlank(type)) {
|
||||
return AuthSource.valueOf(type.toUpperCase());
|
||||
} else {
|
||||
throw new RuntimeException("不支持的类型");
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -250,7 +243,7 @@ public class AuthStateConfiguration {
|
||||
| ------------------ | ------------------------------------------------------------ | ------ | ---------- | ----------------- |
|
||||
| `justauth.enabled` | `boolean` | true | true/false | 是否启用 JustAuth |
|
||||
| `justauth.type` | `java.util.Map<me.zhyd.oauth.config.AuthSource,me.zhyd.oauth.config.AuthConfig>` | 无 | | JustAuth 配置 |
|
||||
| `justauth.cache` | `com.xkcoding.justauth.properties.CacheProperties` | | | JustAuth缓存配置 |
|
||||
| `justauth.cache` | `com.xkcoding.justauth.autoconfigure.CacheProperties` | | | JustAuth缓存配置 |
|
||||
|
||||
`justauth.type` 配置列表
|
||||
|
||||
@@ -263,7 +256,7 @@ public class AuthStateConfiguration {
|
||||
|
||||
| 属性名 | 类型 | 默认值 | 可选项 | 描述 |
|
||||
| ------------------------ | ------------------------------------------------------------ | ----------------- | -------------------- | ------------------------------------------------------------ |
|
||||
| `justauth.cache.type` | `com.xkcoding.justauth.properties.CacheProperties.CacheType` | default | default/redis/custom | 缓存类型,default使用JustAuth默认的缓存实现,redis使用默认的redis缓存实现,custom用户自定义缓存实现 |
|
||||
| `justauth.cache.type` | `com.xkcoding.justauth.autoconfigure.CacheProperties.CacheType` | default | default/redis/custom | 缓存类型,default使用JustAuth默认的缓存实现,redis使用默认的redis缓存实现,custom用户自定义缓存实现 |
|
||||
| `justauth.cache.prefix` | `string` | JUSTAUTH::STATE:: | | 缓存前缀,目前只对redis缓存生效,默认 JUSTAUTH::STATE:: |
|
||||
| `justauth.cache.timeout` | `java.time.Duration` | 3分钟 | | 超时时长,目前只对redis缓存生效,默认3分钟 |
|
||||
|
||||
@@ -281,8 +274,8 @@ public class AuthStateConfiguration {
|
||||
</repository>
|
||||
<!--中央仓库-->
|
||||
<repository>
|
||||
<id>xkcoding-nexus</id>
|
||||
<name>xkcoding nexus</name>
|
||||
<id>oss</id>
|
||||
<name>oss</name>
|
||||
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
|
||||
@@ -21,8 +21,8 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.xkcoding.justauth.properties.ExtendProperties;
|
||||
import com.xkcoding.justauth.properties.JustAuthProperties;
|
||||
import com.xkcoding.justauth.autoconfigure.ExtendProperties;
|
||||
import com.xkcoding.justauth.autoconfigure.JustAuthProperties;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.zhyd.oauth.cache.AuthStateCache;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package com.xkcoding.justauth.properties;
|
||||
package com.xkcoding.justauth.autoconfigure;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package com.xkcoding.justauth.properties;
|
||||
package com.xkcoding.justauth.autoconfigure;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -15,9 +15,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package com.xkcoding.justauth;
|
||||
package com.xkcoding.justauth.autoconfigure;
|
||||
|
||||
import com.xkcoding.justauth.properties.JustAuthProperties;
|
||||
import com.xkcoding.justauth.AuthRequestFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.zhyd.oauth.cache.AuthStateCache;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package com.xkcoding.justauth.properties;
|
||||
package com.xkcoding.justauth.autoconfigure;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -15,10 +15,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package com.xkcoding.justauth;
|
||||
package com.xkcoding.justauth.autoconfigure;
|
||||
|
||||
import com.xkcoding.justauth.cache.RedisStateCache;
|
||||
import com.xkcoding.justauth.properties.JustAuthProperties;
|
||||
import com.xkcoding.justauth.support.cache.RedisStateCache;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.zhyd.oauth.cache.AuthDefaultStateCache;
|
||||
import me.zhyd.oauth.cache.AuthStateCache;
|
||||
@@ -15,9 +15,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
package com.xkcoding.justauth.cache;
|
||||
package com.xkcoding.justauth.support.cache;
|
||||
|
||||
import com.xkcoding.justauth.properties.CacheProperties;
|
||||
import com.xkcoding.justauth.autoconfigure.CacheProperties;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhyd.oauth.cache.AuthStateCache;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
@@ -4,7 +4,7 @@
|
||||
"name": "justauth.type",
|
||||
"type": "java.util.Map<me.zhyd.oauth.config.AuthSource,me.zhyd.oauth.config.AuthConfig>",
|
||||
"description": "JustAuth 配置.",
|
||||
"sourceType": "com.xkcoding.justauth.properties.JustAuthProperties"
|
||||
"sourceType": "com.xkcoding.justauth.autoconfigure.JustAuthProperties"
|
||||
}
|
||||
],
|
||||
"hints": [
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.xkcoding.justauth.JustAuthAutoConfiguration
|
||||
com.xkcoding.justauth.autoconfigure.JustAuthAutoConfiguration
|
||||
|
||||
Reference in New Issue
Block a user