Using spring security for HTTP Basic authentication is simple and straightforward to use, as follows:
<security:http> <Security:http-basic></Security:http-basic> <Security:intercept-urlpattern="/**"Access= "Role_user"/> </security:http> <!--using AuthenticationManager for authentication-related configurations - <!--the Authentication-manager element specifies a authenticationmanager, It requires a authenticationprovider (corresponding to the Authentication-provider element) for true authentication - <Security:authentication-manager> <Security:authentication-provider> <Security:user-service> <Security:username= "User"Password= "User"authorities= "Role_user"/> <Security:username= "Admin"Password= "Admin"authorities= "Role_user, role_admin"/> </Security:user-service> </Security:authentication-provider> </Security:authentication-manager>
Spring Security's HTTP Basic authentication