1
私は2つのアプリケーションを実行して認証とルーティング(zuulプロキシを使用)とUIを管理する "ゲートウェイ" "/ admin")をゲートウェイの後ろに置きます。認証されていない場合、プロキシされたURLをzuulに戻す方法
"/ login"(またはゲートウェイ自体の他のエンドポイント)を押すと、 "login.html"ページにルーティングされ、資格情報を入力して正しく認証されます。その後、私は "/ admin"に問題なくアクセスできます。
私の問題は、認証前に「/ admin」を押すと、「/login.html」にルーティングされず、「基本認証」ポップアップで認証情報を要求するだけです欲しい。
ここはゲートウェイサーバー上の私の設定です。
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.sessionManagement()
.maximumSessions(1)
.expiredUrl("/login")
.maxSessionsPreventsLogin(false)
.sessionRegistry(sessionRegistry())
.and()
.sessionCreationPolicy(SessionCreationPolicy.ALWAYS)
.invalidSessionUrl("/login");
http.addFilterBefore(new ApiKeyAuthenticationFilter(macSigner()), BasicAuthenticationFilter.class);
http.httpBasic().and()
.authorizeRequests()
.antMatchers("/", "/home", "/index","/support.html", "/about.html","/features.html","/fonts/**","/ws/**",
"/contacts.html","/img/**","/logos/**","/docs/**").permitAll()
.antMatchers("/admin**").hasRole("ADMIN")
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.csrf().ignoringAntMatchers("/resource/api/**","/api/**").csrfTokenRepository(csrfTokenRepository())
.and()
.addFilterAfter(csrfHeaderFilter(), SessionManagementFilter.class)
.logout()
.logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
.logoutSuccessUrl("/login")
.permitAll();
}
とここに私の管理サーバー
@Override
protected void configure(HttpSecurity http) throws Exception {
http.httpBasic().and().authorizeRequests().anyRequest().authenticated();
http.csrf().disable();
}
上の設定で誰も私にしてください掘るする場所になど、いくつかのアドバイスを与えることはできますか?
これはあなたに感謝働きました! –