私は、IBM Libertyプロファイル上で動作するスプリングセキュリティWebアプリケーションを実行しているspringmvcを実行しています。私はすべてを設定するJavaの設定を使用して(とweb.xml)。次のようにクラスWebSecurityConfigurerAdapterを拡張IBM LibertyプロファイルbasicRegistryとスプリングセキュリティ構成を接続する方法
は、私は、ユーザーの単純なリストを設定します。
@Autowired
public void configureGlobalSecurity(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("bill").password("123456").roles("USER");
}
私は私のコードでユーザー情報をしたくないので、私はserver.xmlにユーザー・レジストリーを移動したいですIBM Libertyプロファイル・サーバーのインストール。
<basicRegistry>
<user name="bill" password="123456"/>
</basicRegistry>
どうすれば設定できますか?
追加情報私は、耳と戦争モジュールを備えたマルチモジュールプロジェクトを使用しています。したがって、server.xmlの最後の行は
<enterpriseApplication id="hellospringEAR" location="hellospringEAR-00.00.0001-SNAPSHOT.ear" name="hellospringEAR"/>
です。ヒントやアドバイスをいただければ幸いです。コンテナは
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
private static final Logger LOGGER = LoggerFactory.getLogger(SecurityConfig.class);
@Autowired
private ApplicationProperties appProperties;
@Override
protected void configure(final HttpSecurity http) throws Exception {
http.authorizeRequests()
.anyRequest().authenticated()
.and().httpBasic();
if (appProperties.isContainerManaged()) {
LOGGER.info("using container managed");
http.jee();
}
http.csrf().disable()
.logout()
.permitAll();
}
}
詳細ここで(つまり、JEE()メソッドです)、セキュリティを管理するため
チェックこの[記事](のhttp:// stackoverflowの.com/a/9847324/3701228)、SpringセキュリティとJava EEの統合を構成する方法について説明しています(サイトのminderについては説明していますが、プリンシパルは同じです。 – Gas