configure(HttpSecurity)
, configure(WebSecurity)
및 configure(AuthenticationManagerBuilder)
을 재정의 할 수있는 사람은 누구입니까?HttpSecurity, WebSecurity and AuthenticationManagerBuilder
55
A
답변
55
configure (AuthenticationManagerBuilder)은 AuthenticationProviders를 쉽게 추가 할 수있게하여 인증 메커니즘을 설정하는 데 사용됩니다. 다음은 내장 된 'user'및 'admin'로그인을 사용하여 메모리 내 인증을 정의합니다.
public void configure(AuthenticationManagerBuilder auth) {
auth
.inMemoryAuthentication()
.withUser("user")
.password("password")
.roles("USER")
.and()
.withUser("admin")
.password("password")
.roles("ADMIN","USER");
}
구성은 (HttpSecurity)은 선택 일치를 기반으로 자원 레벨에서 웹의 구성 기반 보안을 할 수 있습니다 - 예를 들어, 아래 예제에서는/admin /으로 시작하는 URL을 ADMIN 역할이있는 사용자로 제한하고 다른 URL을 성공적으로 인증해야한다고 선언합니다.
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeUrls()
.antMatchers("/admin/**").hasRole("ADMIN")
.anyRequest().authenticated()
}
구성 (WebSecurity)이 글로벌 보안에 영향을 구성 설정에 사용됩니다 (리소스를 무시 설정 디버그 모드는 사용자 정의 방화벽 정의를 구현하여 요청을 거부). 예를 들어, 다음 방법을 사용하면 인증을 위해/resources /로 시작하는 모든 요청이 무시됩니다.
public void configure(WebSecurity web) throws Exception {
web
.ignoring()
.antMatchers("/resources/**");
}
당신은 자세한 내용은
Spring Security Java Config Preview: Web Security
을 위해 다음 링크를 참조 할 수 있습니다
관련 문제
- 1. WebSecurity CreateUserAndAccount
- 2. 자바 스프링 부팅/봄 보안 (HttpSecurity)에서 세션이 만료 될 때 자동 로그 아웃하는 방법
- 3. HttpSecurity With Spring, 차별화 URL 권한
- 4. HttpSecurity SOAP 웹 서비스 (Springboot)에서 작동하지
- 5. WebSecurity 내가 내 asp.net 웹 사이트에서 WebSecurity 함께 일하고
- 6. SimpleMembershipProvider/WebSecurity 구성
- 7. WebMatrix WebSecurity PasswordSalt
- 8. SimpleMembershipProvider 대 WebSecurity
- 9. Webmatrix WebSecurity not authenticating
- 10. NHibernate와 Postgresql에서 WebSecurity 사용하기?
- 11. 여러 데이터베이스가있는 WebSecurity
- 12. WebSecurity 및 긴 ID
- 13. SimpleMembership - WebSecurity GetConfirmationToken Problems
- 14. 작성한 사용자를 삭제하는 방법 websecurity
- 15. 로그인 실패 - LocalDB, EF, WebSecurity
- 16. EntityCodeFirst + MVC4 WebSecurity = 슬픈 날
- 17. asp.net websecurity 사용자 정의 필드
- 18. DotNetOpenAuth/WebSecurity 기본 정보 교환
- 19. WebAPI + SimpleMembership + WebSecurity - 인증 할 수 없습니까?
- 20. .Net winForms 응용 프로그램에서 WebSecurity 사용
- 21. W3school : ASP.net 자습서 : WebSecurity 객체 추가
- 22. Websecurity 로그 아웃 링크? - Webmatrix, Razor
- 23. WebSecurity '비밀번호 재설정 토큰 ID'유효성을 확인하는 방법?
- 24. WebSecurity 브라우저 창 수명 동안 만 로그인
- 25. WebMatrix WebSecurity : 무작위로 사용자 로그 아웃을 유지합니다.
- 26. WebMatrix.WebData의 WebSecurity Simple Membership 암호 검색
- 27. asp.net mvc 4 websecurity two step login
- 28. SimpleMemberShip WebSecurity 한 번만 등록하면 로그인하십시오.
- 29. Codeigniter AND AND AND
- 30. 여러 개의 디스패처 서블릿을 사용하는 Spring Multiple HttpSecurity