1
0
mirror of synced 2025-12-15 18:58:03 +08:00

🚚 移动文件

This commit is contained in:
Yangkai.Shen
2019-10-09 15:46:26 +08:00
parent 8eceb0f1cd
commit a2ce42c0f3
10 changed files with 21 additions and 29 deletions

View File

@@ -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>

View File

@@ -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;

View File

@@ -15,7 +15,7 @@
*
*/
package com.xkcoding.justauth.properties;
package com.xkcoding.justauth.autoconfigure;
import lombok.Getter;
import lombok.Setter;

View File

@@ -15,7 +15,7 @@
*
*/
package com.xkcoding.justauth.properties;
package com.xkcoding.justauth.autoconfigure;
import lombok.Getter;
import lombok.Setter;

View File

@@ -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;

View File

@@ -15,7 +15,7 @@
*
*/
package com.xkcoding.justauth.properties;
package com.xkcoding.justauth.autoconfigure;
import lombok.Getter;
import lombok.Setter;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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": [

View File

@@ -1,2 +1,2 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.xkcoding.justauth.JustAuthAutoConfiguration
com.xkcoding.justauth.autoconfigure.JustAuthAutoConfiguration