java - Spring security service configuration -


i´m trying build java ee app prototype using different frameworks. works fine except security layer. choose use spring secutiry configured spring configuration. code this:

spring secutiry config

      @configuration     @enablewebmvcsecurity     public class securityconfig extends websecurityconfigureradapter {          @autowired         private myuserdetailsservice userdetailsservice;          @override         protected userdetailsservice userdetailsservice () {             return this.userdetailsservice;         }          @override         public void configure(websecurity web) throws exception {             web             .ignoring()             .antmatchers("/resources/**");         }          @override         protected void configure(httpsecurity http) throws exception {             http             .formlogin()             .loginpage("/login")             .loginprocessingurl("/login/authenticate")             .failureurl("/login?error=bad_credentials")             .and()             .logout()             .logouturl("/signout")             .deletecookies("jsessionid")             .and()             .authorizerequests()             .antmatchers("/admin/**").hasrole("admin")             .antmatchers("/**").permitall()             .and()             .csrf();         }     }  

user detail service

      @service("myuserdetailsservice")     public class myuserdetailsservice implements userdetailsservice {          public static final logger log = logger.getlogger(myuserdetailsservice.class);          public myuserdetailsservice() {         }          @autowired         private userdao userdao;          @override         public userdetails loaduserbyusername(string username) throws usernamenotfoundexception {             final user user = getsystemuser(username);             final list authorities = getuserauthorities(user);             return builduserforauthentication(user, authorities);         }          private user builduserforauthentication(user user, list authorities) {             //...         }          private user getsystemuser(string alias) {             //...         }          private list getuserauthorities(user user) {             //...             return null;         }     }  

what i´m expecting code when "/login/authenticate" reached user & pass params, underlying spring code invokes user service, never happens.

what i´m missing?

thanks in advance!

pd: i´m using spring security 3.2.3.release

you should register custom userdetailsservice authentication,

@override protected void registerauthentication(authenticationmanagerbuilder auth)        throws exception {     auth.userdetailsservice(this.userdetailsservice); } 

for 3.2.3 config should be

@autowired public void configureglobal(authenticationmanagerbuilder auth) throws exception {     auth.userdetailsservice(this.userdetailsservice); } 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -