【发布时间】:2019-02-07 15:06:45
【问题描述】:
我正在研究 Spring Cloud + Boot 示例。在此示例中,我希望进行 SSO。当我运行这个应用程序时,我得到了很好的响应,但看起来像
此行有多个标记 - NoOpPasswordEncoder 类型已弃用 - NoOpPasswordEncoder 类型的方法 getInstance() 是 已弃用
application.properties
server.port: 9000
server.servlet.context-path: /services
security.oauth2.client.clientId: pluralsight
security.oauth2.client.clientSecret: pluralsightsecret
security.oauth2.client.authorized-grant-types: authorization_code,refresh_token,password,client_credentials
security.oauth2.client.scope:toll_read,toll_report
ServiceConfig.java
@Configuration
public class ServiceConfig extends GlobalAuthenticationConfigurerAdapter {
@Override
public void init(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.passwordEncoder(NoOpPasswordEncoder.getInstance())
.withUser("agoldberg").password("pass1").roles("USER")
.and()
.withUser("bgoldberg").password("pass2").roles("USER", "OPERATOR");
}
}
主方法:
@SpringBootApplication
@EnableAuthorizationServer
public class PluralsightSpringcloudM4SecureauthserverApplication {
public static void main(String[] args) {
SpringApplication.run(PluralsightSpringcloudM4SecureauthserverApplication.class, args);
}
}
但 STS 显示错误。不推荐使用的方法的替换是什么?
【问题讨论】:
标签: spring spring-boot single-sign-on microservices spring-cloud