Comments (4)
其实zuul做了就可以了,其他的内部服务可以不用认证,或者简单点用ip认证就行了。如果想控制的更严格,就可以用我提的方式。token没必要放redis,token不像session,token解密后本身就可以获取到用户信息
from spring-cloud.
@yinjihuan 多谢指点! 另外,代码中有一个地方不太明白,劳烦你看一下,自动刷新token:
@Scheduled(fixedDelay = ONE_Minute) public void reloadApiToken() { token = authService.getToken(); while (StringUtils.isBlank(token)) { try { Thread.sleep(1000); token = authService.getToken(); } catch (InterruptedException e) { logger.error("", e); } } }
===== “authService.getToken()”这个方法没有找到
from spring-cloud.
https://blog.csdn.net/u010889990/article/details/78701032
from spring-cloud.
关于eureka server 配置安全验证的问题
@EnableWebSecurity
static class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
}
}
楼主,请问这段代码必须要在启动类里面添加这个才会生效吗?
Spring Boot Version:2.1.3.RELEASE
Spring Cloud:Greenwich.RELEASE
我将这一段代码配置配置在启动类以外的新建的包,结果不行,其他服务注册不上。
是因为需要将这一段代码配置放到启动类里面吗?
Spring Boot更新版本真的有点坑了,需要注意的太多,就因为这些配置问题,源码都看了不少,然后就这一个eureka server安全验证的问题,搞了我一个月了。
如果有时间的话,楼主可以帮我看看吗?我实在是解决不了了,花费太多时间
from spring-cloud.
Related Issues (11)
- eureka配置了spring security后,客户端启动报错,请求不到服务器 HOT 10
- restTemplate报错:No instances available for localhost HOT 2
- zuul 报403非法请求 HOT 1
- spring cloud gateway 中 如何使用示例断言
- 找不到依赖 HOT 2
- cxytiandi-jdbc在哪下载? HOT 2
- 《Spring Cloud微服务》入门,实战与进阶,第2章的源码spring-boot-starter-demo问题 HOT 1
- 注释错误
- spring cluod gateway HOT 1
- 从配置获取就不用在配置类中设值了吧 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-cloud.