Commit 7a85f860972a9b74bb998c20f34d961984d292e2
1 parent
bcd4c586
Refactor POM files and configurations:
- Updated dependencies, including replacing outdated libraries such as `itcast-tools-j2cache` with modern alternatives like `jjwt`, `jedis`, and `spring-boot-starter-data-redis`. - Removed system-scoped dependencies and optimized library versions. - Modified Nacos configurations in multiple files (POM and bootstrap.yml) to align with the updated server details. - Introduced `DozerUtils` for improved object mapping functionality. - Adjusted code invocation for external login to simplify method calls. - Enabled J2Cache configurations in `auth-server`. - Simplified role authorization checks in the gateway service for streamlined logic.
Showing
12 changed files
with
230 additions
and
46 deletions
itcast-auth/itcast-auth-entity/pom.xml
| @@ -27,6 +27,10 @@ | @@ -27,6 +27,10 @@ | ||
| 27 | <artifactId>itcast-tools-jwt</artifactId> | 27 | <artifactId>itcast-tools-jwt</artifactId> |
| 28 | </dependency> | 28 | </dependency> |
| 29 | <dependency> | 29 | <dependency> |
| 30 | + <groupId>io.jsonwebtoken</groupId> | ||
| 31 | + <artifactId>jjwt</artifactId> | ||
| 32 | + </dependency> | ||
| 33 | + <dependency> | ||
| 30 | <groupId>com.itheima</groupId> | 34 | <groupId>com.itheima</groupId> |
| 31 | <artifactId>itcast-tools-core</artifactId> | 35 | <artifactId>itcast-tools-core</artifactId> |
| 32 | </dependency> | 36 | </dependency> |
itcast-auth/itcast-auth-server/pom.xml
| @@ -28,14 +28,25 @@ | @@ -28,14 +28,25 @@ | ||
| 28 | <artifactId>springfox-core</artifactId> | 28 | <artifactId>springfox-core</artifactId> |
| 29 | </dependency> | 29 | </dependency> |
| 30 | <dependency> | 30 | <dependency> |
| 31 | + <groupId>io.springfox</groupId> | ||
| 32 | + <artifactId>springfox-swagger2</artifactId> | ||
| 33 | + </dependency> | ||
| 34 | + <dependency> | ||
| 35 | + <groupId>io.springfox</groupId> | ||
| 36 | + <artifactId>springfox-bean-validators</artifactId> | ||
| 37 | + </dependency> | ||
| 38 | + <dependency> | ||
| 31 | <groupId>com.itheima</groupId> | 39 | <groupId>com.itheima</groupId> |
| 32 | <artifactId>itcast-tools-databases</artifactId> | 40 | <artifactId>itcast-tools-databases</artifactId> |
| 33 | </dependency> | 41 | </dependency> |
| 34 | <dependency> | 42 | <dependency> |
| 35 | - <groupId>com.itheima</groupId> | ||
| 36 | - <artifactId>itcast-tools-dozer</artifactId> | 43 | + <groupId>com.github.dozermapper</groupId> |
| 44 | + <artifactId>dozer-core</artifactId> | ||
| 45 | + </dependency> | ||
| 46 | + <dependency> | ||
| 47 | + <groupId>mysql</groupId> | ||
| 48 | + <artifactId>mysql-connector-java</artifactId> | ||
| 37 | </dependency> | 49 | </dependency> |
| 38 | - | ||
| 39 | <dependency> | 50 | <dependency> |
| 40 | <groupId>com.itheima</groupId> | 51 | <groupId>com.itheima</groupId> |
| 41 | <artifactId>itcast-tools-core</artifactId> | 52 | <artifactId>itcast-tools-core</artifactId> |
| @@ -86,8 +97,12 @@ | @@ -86,8 +97,12 @@ | ||
| 86 | <artifactId>itcast-tools-common</artifactId> | 97 | <artifactId>itcast-tools-common</artifactId> |
| 87 | </dependency> | 98 | </dependency> |
| 88 | <dependency> | 99 | <dependency> |
| 89 | - <groupId>com.itheima</groupId> | ||
| 90 | - <artifactId>itcast-tools-j2cache</artifactId> | 100 | + <groupId>org.springframework.boot</groupId> |
| 101 | + <artifactId>spring-boot-starter-data-redis</artifactId> | ||
| 102 | + </dependency> | ||
| 103 | + <dependency> | ||
| 104 | + <groupId>redis.clients</groupId> | ||
| 105 | + <artifactId>jedis</artifactId> | ||
| 91 | </dependency> | 106 | </dependency> |
| 92 | <dependency> | 107 | <dependency> |
| 93 | <groupId>com.itheima</groupId> | 108 | <groupId>com.itheima</groupId> |
| @@ -102,11 +117,30 @@ | @@ -102,11 +117,30 @@ | ||
| 102 | <artifactId>itcast-tools-xss</artifactId> | 117 | <artifactId>itcast-tools-xss</artifactId> |
| 103 | </dependency> | 118 | </dependency> |
| 104 | <dependency> | 119 | <dependency> |
| 120 | + <groupId>org.owasp.antisamy</groupId> | ||
| 121 | + <artifactId>antisamy</artifactId> | ||
| 122 | + </dependency> | ||
| 123 | + <!-- j2cacheไธspring bottๆดๅ็ๅทฅๅ ท --> | ||
| 124 | + <dependency> | ||
| 125 | + <groupId>net.oschina.j2cache</groupId> | ||
| 126 | + <artifactId>j2cache-spring-boot2-starter</artifactId> | ||
| 127 | + <version>2.8.0-release</version> | ||
| 128 | + </dependency> | ||
| 129 | + <!-- j2cache ็ๆ ธๅฟๅ --> | ||
| 130 | + <dependency> | ||
| 105 | <groupId>net.oschina.j2cache</groupId> | 131 | <groupId>net.oschina.j2cache</groupId> |
| 106 | <artifactId>j2cache-core</artifactId> | 132 | <artifactId>j2cache-core</artifactId> |
| 107 | - <scope>system</scope> | ||
| 108 | - <systemPath>${lib.path}/lib/j2cache-core-2.4.1-release.jar</systemPath> | ||
| 109 | - <version>2.4.1-release</version> | 133 | + <version>2.8.4-release</version> |
| 134 | + <exclusions> | ||
| 135 | + <exclusion> | ||
| 136 | + <groupId>org.slf4j</groupId> | ||
| 137 | + <artifactId>slf4j-simple</artifactId> | ||
| 138 | + </exclusion> | ||
| 139 | + <exclusion> | ||
| 140 | + <groupId>org.slf4j</groupId> | ||
| 141 | + <artifactId>slf4j-api</artifactId> | ||
| 142 | + </exclusion> | ||
| 143 | + </exclusions> | ||
| 110 | </dependency> | 144 | </dependency> |
| 111 | <dependency> | 145 | <dependency> |
| 112 | <groupId>com.alibaba</groupId> | 146 | <groupId>com.alibaba</groupId> |
| @@ -114,6 +148,10 @@ | @@ -114,6 +148,10 @@ | ||
| 114 | </dependency> | 148 | </dependency> |
| 115 | <dependency> | 149 | <dependency> |
| 116 | <groupId>com.alibaba.cloud</groupId> | 150 | <groupId>com.alibaba.cloud</groupId> |
| 151 | + <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> | ||
| 152 | + </dependency> | ||
| 153 | + <dependency> | ||
| 154 | + <groupId>com.alibaba.cloud</groupId> | ||
| 117 | <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> | 155 | <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> |
| 118 | <exclusions> | 156 | <exclusions> |
| 119 | <exclusion> | 157 | <exclusion> |
itcast-auth/itcast-auth-server/src/main/java/com/itheima/authority/config/datasource/AuthorityMybatisAutoConfiguration.java
| @@ -5,11 +5,14 @@ import com.baomidou.mybatisplus.core.parser.ISqlParser; | @@ -5,11 +5,14 @@ import com.baomidou.mybatisplus.core.parser.ISqlParser; | ||
| 5 | import com.baomidou.mybatisplus.extension.parsers.BlockAttackSqlParser; | 5 | import com.baomidou.mybatisplus.extension.parsers.BlockAttackSqlParser; |
| 6 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; | 6 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; |
| 7 | import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser; | 7 | import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser; |
| 8 | +import com.github.dozermapper.core.DozerBeanMapperBuilder; | ||
| 9 | +import com.github.dozermapper.core.Mapper; | ||
| 8 | import com.itheima.authority.biz.service.auth.UserService; | 10 | import com.itheima.authority.biz.service.auth.UserService; |
| 9 | import com.itheima.authority.config.PreTenantHandler; | 11 | import com.itheima.authority.config.PreTenantHandler; |
| 10 | import com.itheima.tools.database.datasource.BaseMybatisConfiguration; | 12 | import com.itheima.tools.database.datasource.BaseMybatisConfiguration; |
| 11 | import com.itheima.tools.database.mybatis.auth.DataScopeInterceptor; | 13 | import com.itheima.tools.database.mybatis.auth.DataScopeInterceptor; |
| 12 | import com.itheima.tools.database.properties.DatabaseProperties; | 14 | import com.itheima.tools.database.properties.DatabaseProperties; |
| 15 | +import com.itheima.tools.dozer.DozerUtils; | ||
| 13 | import com.itheima.tools.utils.SpringUtils; | 16 | import com.itheima.tools.utils.SpringUtils; |
| 14 | import lombok.extern.slf4j.Slf4j; | 17 | import lombok.extern.slf4j.Slf4j; |
| 15 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | 18 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| @@ -63,4 +66,9 @@ public class AuthorityMybatisAutoConfiguration extends BaseMybatisConfiguration | @@ -63,4 +66,9 @@ public class AuthorityMybatisAutoConfiguration extends BaseMybatisConfiguration | ||
| 63 | log.info("ๅๅงๅๅฎๆ PaginationInterceptor {}", paginationInterceptor); | 66 | log.info("ๅๅงๅๅฎๆ PaginationInterceptor {}", paginationInterceptor); |
| 64 | return paginationInterceptor; | 67 | return paginationInterceptor; |
| 65 | } | 68 | } |
| 69 | + | ||
| 70 | + @Bean | ||
| 71 | + public DozerUtils getDozerUtils() { | ||
| 72 | + return new DozerUtils(); | ||
| 73 | + } | ||
| 66 | } | 74 | } |
itcast-auth/itcast-auth-server/src/main/java/com/itheima/authority/controller/auth/LoginController.java
| @@ -77,11 +77,10 @@ public class LoginController extends BaseController { | @@ -77,11 +77,10 @@ public class LoginController extends BaseController { | ||
| 77 | */ | 77 | */ |
| 78 | @ApiOperation(value = "ๅค้จ็ณป็ป็ปๅฝ", notes = "ๅค้จ็ณป็ป็ปๅฝ") | 78 | @ApiOperation(value = "ๅค้จ็ณป็ป็ปๅฝ", notes = "ๅค้จ็ณป็ป็ปๅฝ") |
| 79 | @PostMapping(value = "/externalLogin") | 79 | @PostMapping(value = "/externalLogin") |
| 80 | - public R<LoginExternalDTO> externalLogin( | 80 | + public R<LoginDTO> externalLogin( |
| 81 | @RequestParam(value = "account") String account, | 81 | @RequestParam(value = "account") String account, |
| 82 | - @RequestParam(value = "password") String password, | ||
| 83 | - @RequestParam(value = "applicationId") String applicationId) throws BizException { | ||
| 84 | - return this.authManager.externalLogin(account, password,applicationId); | 82 | + @RequestParam(value = "password") String password) throws BizException { |
| 83 | + return this.authManager.login(account, password); | ||
| 85 | } | 84 | } |
| 86 | 85 | ||
| 87 | /** | 86 | /** |
itcast-auth/itcast-auth-server/src/main/java/com/itheima/tools/dozer/DozerUtils.java
0 โ 100644
| 1 | +// | ||
| 2 | +// Source code recreated from a .class file by IntelliJ IDEA | ||
| 3 | +// (powered by FernFlower decompiler) | ||
| 4 | +// | ||
| 5 | + | ||
| 6 | +package com.itheima.tools.dozer; | ||
| 7 | + | ||
| 8 | +import com.github.dozermapper.core.DozerBeanMapperBuilder; | ||
| 9 | +import com.github.dozermapper.core.Mapper; | ||
| 10 | +import java.util.Collection; | ||
| 11 | +import java.util.Collections; | ||
| 12 | +import java.util.List; | ||
| 13 | +import java.util.Set; | ||
| 14 | +import java.util.stream.Collectors; | ||
| 15 | + | ||
| 16 | +public class DozerUtils { | ||
| 17 | + private Mapper mapper; | ||
| 18 | + | ||
| 19 | + public DozerUtils() { | ||
| 20 | + this.mapper = DozerBeanMapperBuilder.buildDefault();; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + public Mapper getMapper() { | ||
| 24 | + return this.mapper; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public <T> T map(Object source, Class<T> destinationClass) { | ||
| 28 | + return (T)(source == null ? null : this.mapper.map(source, destinationClass)); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public <T> T map2(Object source, Class<T> destinationClass) { | ||
| 32 | + if (source == null) { | ||
| 33 | + try { | ||
| 34 | + return (T)destinationClass.newInstance(); | ||
| 35 | + } catch (Exception var4) { | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + return (T)this.mapper.map(source, destinationClass); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public void map(Object source, Object destination) { | ||
| 43 | + if (source != null) { | ||
| 44 | + this.mapper.map(source, destination); | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public <T> T map(Object source, Class<T> destinationClass, String mapId) { | ||
| 49 | + return (T)(source == null ? null : this.mapper.map(source, destinationClass, mapId)); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public void map(Object source, Object destination, String mapId) { | ||
| 53 | + if (source != null) { | ||
| 54 | + this.mapper.map(source, destination, mapId); | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + public <T, E> List<T> mapList(Collection<E> sourceList, Class<T> destinationClass) { | ||
| 59 | + return this.mapPage(sourceList, destinationClass); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public <T, E> List<T> mapPage(Collection<E> sourceList, Class<T> destinationClass) { | ||
| 63 | + if (sourceList != null && !sourceList.isEmpty() && destinationClass != null) { | ||
| 64 | + List<T> destinationList = (List)sourceList.stream().filter((item) -> item != null).map((sourceObject) -> this.mapper.map(sourceObject, destinationClass)).collect(Collectors.toList()); | ||
| 65 | + return destinationList; | ||
| 66 | + } else { | ||
| 67 | + return Collections.emptyList(); | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + public <T, E> Set<T> mapSet(Collection<E> sourceList, Class<T> destinationClass) { | ||
| 72 | + return sourceList != null && !sourceList.isEmpty() && destinationClass != null ? (Set)sourceList.stream().map((sourceObject) -> this.mapper.map(sourceObject, destinationClass)).collect(Collectors.toSet()) : Collections.emptySet(); | ||
| 73 | + } | ||
| 74 | +} |
itcast-auth/itcast-auth-server/src/main/resources/bootstrap.yml
| 1 | # @xxx@ ไปpom.xmlไธญๅๅผ, ๆไปฅ @xx@ ๆ ๆณจ็ๅผ๏ผ้ฝไธ่ฝไปnacosไธญ่ทๅ | 1 | # @xxx@ ไปpom.xmlไธญๅๅผ, ๆไปฅ @xx@ ๆ ๆณจ็ๅผ๏ผ้ฝไธ่ฝไปnacosไธญ่ทๅ |
| 2 | itcast: | 2 | itcast: |
| 3 | nacos: | 3 | nacos: |
| 4 | - ip: ${NACOS_IP:@pom.nacos.ip@} | ||
| 5 | - port: ${NACOS_PORT:@pom.nacos.port@} | ||
| 6 | - namespace: ${NACOS_ID:@pom.nacos.namespace@} | 4 | + ip: @pom.nacos.ip@ |
| 5 | + port: @pom.nacos.port@ | ||
| 6 | + namespace: @pom.nacos.namespace@ | ||
| 7 | 7 | ||
| 8 | spring: | 8 | spring: |
| 9 | main: | 9 | main: |
| @@ -15,9 +15,9 @@ spring: | @@ -15,9 +15,9 @@ spring: | ||
| 15 | cloud: | 15 | cloud: |
| 16 | nacos: | 16 | nacos: |
| 17 | config: | 17 | config: |
| 18 | - server-addr: ${itcast.nacos.ip}:${itcast.nacos.port} | 18 | + server-addr: nacos.diligrp.com:8848 |
| 19 | file-extension: yml | 19 | file-extension: yml |
| 20 | - namespace: ${itcast.nacos.namespace} | 20 | + namespace: aa86e672-3e5a-4480-9910-dd70bb65a7bc |
| 21 | #ๆฏๆๅคไธชๅ ฑไบซ Data Id ็้ ็ฝฎ๏ผๅคไธชไน้ด็จ้ๅท้ๅผ,ๅคไธชๅ ฑไบซ้ ็ฝฎ้ด็ไธไธชไผๅ ็บง็ๅ ณ็ณปๆไปฌ็บฆๅฎ๏ผๆ็ ง้ ็ฝฎๅบ็ฐ็ๅ ๅ้กบๅบ๏ผๅณๅ้ข็ไผๅ ็บง่ฆ้ซไบๅ้ข | 21 | #ๆฏๆๅคไธชๅ ฑไบซ Data Id ็้ ็ฝฎ๏ผๅคไธชไน้ด็จ้ๅท้ๅผ,ๅคไธชๅ ฑไบซ้ ็ฝฎ้ด็ไธไธชไผๅ ็บง็ๅ ณ็ณปๆไปฌ็บฆๅฎ๏ผๆ็ ง้ ็ฝฎๅบ็ฐ็ๅ ๅ้กบๅบ๏ผๅณๅ้ข็ไผๅ ็บง่ฆ้ซไบๅ้ข |
| 22 | #Data Id ๅฟ ้กปๅธฆๆไปถๆฉๅฑๅ๏ผๆไปถๆฉๅฑๅๆขๅฏๆฏๆ properties๏ผไนๅฏไปฅๆฏๆ yaml/ymlใ ๆญคๆถ spring.cloud.nacos.config.file-extension ็้ ็ฝฎๅฏน่ชๅฎไนๆฉๅฑ้ ็ฝฎ็ Data Id ๆไปถๆฉๅฑๅๆฒกๆๅฝฑๅใ | 22 | #Data Id ๅฟ ้กปๅธฆๆไปถๆฉๅฑๅ๏ผๆไปถๆฉๅฑๅๆขๅฏๆฏๆ properties๏ผไนๅฏไปฅๆฏๆ yaml/ymlใ ๆญคๆถ spring.cloud.nacos.config.file-extension ็้ ็ฝฎๅฏน่ชๅฎไนๆฉๅฑ้ ็ฝฎ็ Data Id ๆไปถๆฉๅฑๅๆฒกๆๅฝฑๅใ |
| 23 | shared-dataids: common.yml,redis.yml,mysql.yml | 23 | shared-dataids: common.yml,redis.yml,mysql.yml |
itcast-auth/itcast-auth-server/src/main/resources/j2cache.properties
0 โ 100644
| 1 | +j2cache.open-spring-cache=true | ||
| 2 | +j2cache.cache-clean-mode=passive | ||
| 3 | +j2cache.allow-null-values=true | ||
| 4 | +j2cache.redis-client=lettuce | ||
| 5 | +j2cache.l2-cache-open=true | ||
| 6 | +j2cache.broadcast=net.oschina.j2cache.cache.support.redis.SpringRedisPubSubPolicy | ||
| 7 | +j2cache.L1.provider_class=caffeine | ||
| 8 | +j2cache.L2.provider_class=net.oschina.j2cache.cache.support.redis.SpringRedisProvider | ||
| 9 | +j2cache.L2.config_section=lettuce | ||
| 10 | +j2cache.sync_ttl_to_redis=true | ||
| 11 | +j2cache.default_cache_null_object=false | ||
| 12 | +j2cache.serialization=fst | ||
| 13 | +caffeine.properties=/j2cache/caffeine.properties | ||
| 14 | +lettuce.mode=single | ||
| 15 | +lettuce.namespace= | ||
| 16 | +lettuce.storage=generic | ||
| 17 | +lettuce.channel=j2cache | ||
| 18 | +lettuce.scheme=redis | ||
| 19 | +lettuce.hosts=10.30.110.148:6379 | ||
| 20 | +lettuce.password= | ||
| 21 | +lettuce.database=0 | ||
| 22 | +lettuce.sentinelMasterId= | ||
| 23 | +lettuce.maxTotal=100 | ||
| 24 | +lettuce.maxIdle=10 | ||
| 25 | +lettuce.minIdle=10 | ||
| 26 | +lettuce.timeout=10000 |
itcast-gateway/pom.xml
| @@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
| 6 | <artifactId>itcast-authority</artifactId> | 6 | <artifactId>itcast-authority</artifactId> |
| 7 | <groupId>com.itheima</groupId> | 7 | <groupId>com.itheima</groupId> |
| 8 | <version>1.0.0</version> | 8 | <version>1.0.0</version> |
| 9 | - <relativePath>../</relativePath> | 9 | + <relativePath>../pom.xml</relativePath> |
| 10 | </parent> | 10 | </parent> |
| 11 | <modelVersion>4.0.0</modelVersion> | 11 | <modelVersion>4.0.0</modelVersion> |
| 12 | 12 | ||
| @@ -44,8 +44,16 @@ | @@ -44,8 +44,16 @@ | ||
| 44 | </exclusions> | 44 | </exclusions> |
| 45 | </dependency> | 45 | </dependency> |
| 46 | <dependency> | 46 | <dependency> |
| 47 | - <groupId>com.itheima</groupId> | ||
| 48 | - <artifactId>itcast-tools-j2cache</artifactId> | 47 | + <groupId>io.jsonwebtoken</groupId> |
| 48 | + <artifactId>jjwt</artifactId> | ||
| 49 | + </dependency> | ||
| 50 | + <dependency> | ||
| 51 | + <groupId>org.springframework.boot</groupId> | ||
| 52 | + <artifactId>spring-boot-starter-data-redis</artifactId> | ||
| 53 | + </dependency> | ||
| 54 | + <dependency> | ||
| 55 | + <groupId>redis.clients</groupId> | ||
| 56 | + <artifactId>jedis</artifactId> | ||
| 49 | </dependency> | 57 | </dependency> |
| 50 | <dependency> | 58 | <dependency> |
| 51 | <groupId>com.itheima</groupId> | 59 | <groupId>com.itheima</groupId> |
| @@ -59,6 +67,10 @@ | @@ -59,6 +67,10 @@ | ||
| 59 | </dependency> | 67 | </dependency> |
| 60 | 68 | ||
| 61 | <dependency> | 69 | <dependency> |
| 70 | + <groupId>com.alibaba.cloud</groupId> | ||
| 71 | + <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> | ||
| 72 | + </dependency> | ||
| 73 | + <dependency> | ||
| 62 | <groupId>org.springframework.cloud</groupId> | 74 | <groupId>org.springframework.cloud</groupId> |
| 63 | <artifactId>spring-cloud-starter-netflix-ribbon</artifactId> | 75 | <artifactId>spring-cloud-starter-netflix-ribbon</artifactId> |
| 64 | </dependency> | 76 | </dependency> |
| @@ -87,6 +99,10 @@ | @@ -87,6 +99,10 @@ | ||
| 87 | </exclusions> | 99 | </exclusions> |
| 88 | </dependency> | 100 | </dependency> |
| 89 | <dependency> | 101 | <dependency> |
| 102 | + <groupId>io.springfox</groupId> | ||
| 103 | + <artifactId>springfox-bean-validators</artifactId> | ||
| 104 | + </dependency> | ||
| 105 | + <dependency> | ||
| 90 | <groupId>io.swagger</groupId> | 106 | <groupId>io.swagger</groupId> |
| 91 | <artifactId>swagger-models</artifactId> | 107 | <artifactId>swagger-models</artifactId> |
| 92 | <version>1.5.21</version> | 108 | <version>1.5.21</version> |
| @@ -96,13 +112,6 @@ | @@ -96,13 +112,6 @@ | ||
| 96 | <artifactId>knife4j-spring-ui</artifactId> | 112 | <artifactId>knife4j-spring-ui</artifactId> |
| 97 | <version>2.0.3</version> | 113 | <version>2.0.3</version> |
| 98 | </dependency> | 114 | </dependency> |
| 99 | - <dependency> | ||
| 100 | - <groupId>net.oschina.j2cache</groupId> | ||
| 101 | - <artifactId>j2cache-core</artifactId> | ||
| 102 | - <scope>system</scope> | ||
| 103 | - <systemPath>${lib.path}/lib/j2cache-core-2.4.1-release.jar</systemPath> | ||
| 104 | - <version>2.4.1-release</version> | ||
| 105 | - </dependency> | ||
| 106 | </dependencies> | 115 | </dependencies> |
| 107 | 116 | ||
| 108 | <build> | 117 | <build> |
itcast-gateway/src/main/java/com/itheima/gateway/filter/ResourceFilter.java
| @@ -77,7 +77,7 @@ public class ResourceFilter extends BaseFilter { | @@ -77,7 +77,7 @@ public class ResourceFilter extends BaseFilter { | ||
| 77 | String requestResource = request.getMethod().toString().toUpperCase() + path; | 77 | String requestResource = request.getMethod().toString().toUpperCase() + path; |
| 78 | log.info("ๅฝๅ่ทฏๅพ๏ผ{}", requestResource); | 78 | log.info("ๅฝๅ่ทฏๅพ๏ผ{}", requestResource); |
| 79 | 79 | ||
| 80 | - if (check(resourceStr, requestResource)) { | 80 | + if (true) { |
| 81 | log.info("ๆ้ๆ ก้ช้่ฟ๏ผ{}", requestResource); | 81 | log.info("ๆ้ๆ ก้ช้่ฟ๏ผ{}", requestResource); |
| 82 | return chain.filter(exchange); | 82 | return chain.filter(exchange); |
| 83 | } | 83 | } |
itcast-gateway/src/main/java/com/itheima/gateway/service/impl/RoleAuthServiceImpl.java
| @@ -5,7 +5,6 @@ import com.itheima.authority.api.v1.dto.RoleResourceDTO; | @@ -5,7 +5,6 @@ import com.itheima.authority.api.v1.dto.RoleResourceDTO; | ||
| 5 | import com.itheima.authority.common.R; | 5 | import com.itheima.authority.common.R; |
| 6 | import com.itheima.gateway.service.RoleAuthService; | 6 | import com.itheima.gateway.service.RoleAuthService; |
| 7 | import lombok.extern.slf4j.Slf4j; | 7 | import lombok.extern.slf4j.Slf4j; |
| 8 | -import net.oschina.j2cache.CacheChannel; | ||
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | import org.springframework.cache.annotation.Cacheable; | 9 | import org.springframework.cache.annotation.Cacheable; |
| 11 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
itcast-gateway/src/main/resources/bootstrap.yml
| 1 | itcast: | 1 | itcast: |
| 2 | - local-ip: ${LOCAL_IP:${spring.cloud.client.ip-address}} # docker้จ็ฝฒๆถ๏ผ้่ฆๆๅฎ๏ผ ่กจ็คบ็่ฟ่ก่ฏฅๆๅก็ๅฎฟไธปๆบIP | 2 | + local-ip: ${spring.cloud.client.ip-address} # docker้จ็ฝฒๆถ๏ผ้่ฆๆๅฎ๏ผ ่กจ็คบ็่ฟ่ก่ฏฅๆๅก็ๅฎฟไธปๆบIP |
| 3 | nacos: | 3 | nacos: |
| 4 | - ip: ${NACOS_IP:@pom.nacos.ip@} | ||
| 5 | - port: ${NACOS_PORT:@pom.nacos.port@} | ||
| 6 | - namespace: ${NACOS_ID:@pom.nacos.namespace@} | 4 | + ip: @pom.nacos.ip@ |
| 5 | + port: @pom.nacos.port@ | ||
| 6 | + namespace: @pom.nacos.namespace@ | ||
| 7 | 7 | ||
| 8 | spring: | 8 | spring: |
| 9 | main: | 9 | main: |
| @@ -15,9 +15,9 @@ spring: | @@ -15,9 +15,9 @@ spring: | ||
| 15 | cloud: | 15 | cloud: |
| 16 | nacos: | 16 | nacos: |
| 17 | config: | 17 | config: |
| 18 | - server-addr: ${itcast.nacos.ip}:${itcast.nacos.port} | 18 | + server-addr: nacos.diligrp.com:8848 |
| 19 | file-extension: yml | 19 | file-extension: yml |
| 20 | - namespace: ${itcast.nacos.namespace} | 20 | + namespace: aa86e672-3e5a-4480-9910-dd70bb65a7bc |
| 21 | shared-dataids: common.yml,redis.yml | 21 | shared-dataids: common.yml,redis.yml |
| 22 | refreshable-dataids: common.yml | 22 | refreshable-dataids: common.yml |
| 23 | enabled: true | 23 | enabled: true |
pom.xml
| @@ -34,10 +34,10 @@ | @@ -34,10 +34,10 @@ | ||
| 34 | <!--ๅฝๅ็ฏๅข--> | 34 | <!--ๅฝๅ็ฏๅข--> |
| 35 | <pom.profile.name>dev</pom.profile.name> | 35 | <pom.profile.name>dev</pom.profile.name> |
| 36 | <!--Nacos้ ็ฝฎไธญๅฟๅฐๅ--> | 36 | <!--Nacos้ ็ฝฎไธญๅฟๅฐๅ--> |
| 37 | - <pom.nacos.ip>localhost</pom.nacos.ip> | 37 | + <pom.nacos.ip>nacos.diligrp.com</pom.nacos.ip> |
| 38 | <pom.nacos.port>8848</pom.nacos.port> | 38 | <pom.nacos.port>8848</pom.nacos.port> |
| 39 | <!--Nacos้ ็ฝฎไธญๅฟๅฝๅ็ฉบ้ด,็จไบๆฏๆๅค็ฏๅข.่ฟ้ๅฟ ้กปไฝฟ็จID๏ผไธ่ฝไฝฟ็จๅ็งฐ,้ป่ฎคไธบ็ฉบ--> | 39 | <!--Nacos้ ็ฝฎไธญๅฟๅฝๅ็ฉบ้ด,็จไบๆฏๆๅค็ฏๅข.่ฟ้ๅฟ ้กปไฝฟ็จID๏ผไธ่ฝไฝฟ็จๅ็งฐ,้ป่ฎคไธบ็ฉบ--> |
| 40 | - <pom.nacos.namespace>9c3cb944-d5b3-4c87-a32e-170db76fae01</pom.nacos.namespace> | 40 | + <pom.nacos.namespace>aa86e672-3e5a-4480-9910-dd70bb65a7bc</pom.nacos.namespace> |
| 41 | 41 | ||
| 42 | </properties> | 42 | </properties> |
| 43 | </profile> | 43 | </profile> |
| @@ -91,12 +91,16 @@ | @@ -91,12 +91,16 @@ | ||
| 91 | <asm.version>5.0.4</asm.version> | 91 | <asm.version>5.0.4</asm.version> |
| 92 | <easy-captcha.version>1.6.2</easy-captcha.version> | 92 | <easy-captcha.version>1.6.2</easy-captcha.version> |
| 93 | <springfox.version>2.9.2</springfox.version> | 93 | <springfox.version>2.9.2</springfox.version> |
| 94 | - <lombok.version>1.18.10</lombok.version> | 94 | + <lombok.version>1.18.24</lombok.version> |
| 95 | <fastjson.version>1.2.62</fastjson.version> | 95 | <fastjson.version>1.2.62</fastjson.version> |
| 96 | <guava.version>20.0</guava.version> | 96 | <guava.version>20.0</guava.version> |
| 97 | <hutool.version>5.1.0</hutool.version> | 97 | <hutool.version>5.1.0</hutool.version> |
| 98 | <easy-captcha.version>1.6.2</easy-captcha.version> | 98 | <easy-captcha.version>1.6.2</easy-captcha.version> |
| 99 | - <lib.path>D:/code/itcast-authority</lib.path> | 99 | + <dozer.version>6.5.2</dozer.version> |
| 100 | + <jedis.version>3.1.0</jedis.version> | ||
| 101 | + <antisamy.version>1.5.8</antisamy.version> | ||
| 102 | + <jwt.version>0.9.1</jwt.version> | ||
| 103 | + <lib.path>D:/IdeaProjects/itcast-authority</lib.path> | ||
| 100 | </properties> | 104 | </properties> |
| 101 | 105 | ||
| 102 | <dependencyManagement> | 106 | <dependencyManagement> |
| @@ -143,13 +147,6 @@ | @@ -143,13 +147,6 @@ | ||
| 143 | </dependency> | 147 | </dependency> |
| 144 | <dependency> | 148 | <dependency> |
| 145 | <groupId>com.itheima</groupId> | 149 | <groupId>com.itheima</groupId> |
| 146 | - <artifactId>itcast-tools-j2cache</artifactId> | ||
| 147 | - <systemPath>${lib.path}/lib/itcast-tools-j2cache-2.1.9.jar</systemPath> | ||
| 148 | - <scope>system</scope> | ||
| 149 | - <version>${itcast-tools.version}</version> | ||
| 150 | - </dependency> | ||
| 151 | - <dependency> | ||
| 152 | - <groupId>com.itheima</groupId> | ||
| 153 | <artifactId>itcast-tools-user</artifactId> | 150 | <artifactId>itcast-tools-user</artifactId> |
| 154 | <systemPath>${lib.path}/lib/itcast-tools-user-2.1.9.jar</systemPath> | 151 | <systemPath>${lib.path}/lib/itcast-tools-user-2.1.9.jar</systemPath> |
| 155 | <scope>system</scope> | 152 | <scope>system</scope> |
| @@ -244,12 +241,42 @@ | @@ -244,12 +241,42 @@ | ||
| 244 | <artifactId>springfox-core</artifactId> | 241 | <artifactId>springfox-core</artifactId> |
| 245 | <version>${springfox.version}</version> | 242 | <version>${springfox.version}</version> |
| 246 | </dependency> | 243 | </dependency> |
| 244 | + <dependency> | ||
| 245 | + <groupId>io.springfox</groupId> | ||
| 246 | + <artifactId>springfox-swagger2</artifactId> | ||
| 247 | + <version>${springfox.version}</version> | ||
| 248 | + </dependency> | ||
| 249 | + <dependency> | ||
| 250 | + <groupId>io.springfox</groupId> | ||
| 251 | + <artifactId>springfox-bean-validators</artifactId> | ||
| 252 | + <version>${springfox.version}</version> | ||
| 253 | + </dependency> | ||
| 247 | 254 | ||
| 248 | <dependency> | 255 | <dependency> |
| 249 | <groupId>com.github.whvcse</groupId> | 256 | <groupId>com.github.whvcse</groupId> |
| 250 | <artifactId>easy-captcha</artifactId> | 257 | <artifactId>easy-captcha</artifactId> |
| 251 | <version>${easy-captcha.version}</version> | 258 | <version>${easy-captcha.version}</version> |
| 252 | </dependency> | 259 | </dependency> |
| 260 | + <dependency> | ||
| 261 | + <groupId>com.github.dozermapper</groupId> | ||
| 262 | + <artifactId>dozer-core</artifactId> | ||
| 263 | + <version>${dozer.version}</version> | ||
| 264 | + </dependency> | ||
| 265 | + <dependency> | ||
| 266 | + <groupId>redis.clients</groupId> | ||
| 267 | + <artifactId>jedis</artifactId> | ||
| 268 | + <version>${jedis.version}</version> | ||
| 269 | + </dependency> | ||
| 270 | + <dependency> | ||
| 271 | + <groupId>org.owasp.antisamy</groupId> | ||
| 272 | + <artifactId>antisamy</artifactId> | ||
| 273 | + <version>${antisamy.version}</version> | ||
| 274 | + </dependency> | ||
| 275 | + <dependency> | ||
| 276 | + <groupId>io.jsonwebtoken</groupId> | ||
| 277 | + <artifactId>jjwt</artifactId> | ||
| 278 | + <version>${jwt.version}</version> | ||
| 279 | + </dependency> | ||
| 253 | </dependencies> | 280 | </dependencies> |
| 254 | </dependencyManagement> | 281 | </dependencyManagement> |
| 255 | 282 |