Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

服务安全方案 #3

Open
itancan opened this issue Sep 5, 2018 · 4 comments
Open

服务安全方案 #3

itancan opened this issue Sep 5, 2018 · 4 comments

Comments

@itancan
Copy link

itancan commented Sep 5, 2018

楼主,你好!看了你的书,受益匪浅!关于服务安全,想问一下,最终服务安全的方案是不是:zuul+feign一起使用呢?另外,token放在redis会不会更好?

@yinjihuan
Copy link
Owner

其实zuul做了就可以了,其他的内部服务可以不用认证,或者简单点用ip认证就行了。如果想控制的更严格,就可以用我提的方式。token没必要放redis,token不像session,token解密后本身就可以获取到用户信息

@itancan
Copy link
Author

itancan commented Sep 5, 2018

@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()”这个方法没有找到

@itancan
Copy link
Author

itancan commented Sep 5, 2018

@yongqilei
Copy link

关于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安全验证的问题,搞了我一个月了。
如果有时间的话,楼主可以帮我看看吗?我实在是解决不了了,花费太多时间

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants