[英]How to configure Spring-Security to access user details in database?
[英]Spring security configure access
我在Spring Security中配置端點訪問。 我要完成的工作:
這是我的配置,它滿足了兩項要求,並阻止了非登錄用戶訪問/ logout。
http.authorizeRequests() .antMatchers("/register").permitAll() .antMatchers("/register/*").permitAll() .antMatchers("/favicon.ico").permitAll() .antMatchers("**/*.html").permitAll() .antMatchers("**/*.css").permitAll() .antMatchers("**/*.js").permitAll() .and() .formLogin().loginPage("/login").failureUrl("/login-error").defaultSuccessUrl("/") .usernameParameter("username").passwordParameter("password") .and() .logout().logoutSuccessUrl("/login").deleteCookies("JSESSIONID").logoutUrl("/logout");
確保對您的應用程序的請求要求用戶使用.anyRequest()。authenticated()進行身份驗證
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.