java - Spring security custom authentication how to access firstname and lastname -


i using custom authentication using credentials , ipaddress, however, need display user firstname , lastname on ui. whereas not using userdetails , using usernamepasswordauthenticationtoken, how can access firstname , lastname, userdetails bean saved in details.

account account = (account)accountdao.loaduserbyusername(username);     if(!account.getpassword().equals(password)) {         logger.debug("[user authentication]invalid password:"+password);         return null;     }     logger.warn(string.format("[user authentication]%s %s",new object[]{account.getfirstname(),account.getlastname()}));     isauthenticatedbyip = false;      for(allowedipaddress allowedipaddress:account.getallowedips()){         if(allowedipaddress.getipaddress().equals("0.0.0.0")||allowedipaddress.getipaddress().equals(useripaddress)) {             isauthenticatedbyip = true;             break;         }      }       // authenticated, user's ip address matches 1 in database     if (isauthenticatedbyip)     {          logger.debug("[user authentication]isauthenticatedbyip true, ip addresses match");  usernamepasswordauthenticationtoken result = null;  result = new  usernamepasswordauthenticationtoken(account.getusername(), account.getpassword(), account.getauthorities()) ;  result.setdetails(account); return result } else {   logger.warn("[user authentication]user ip not allowed "+useripaddress); } 

how fields of account in jsp displaying welcome message user.

in spring mvc can make custom userdetail bean session scoped bean , set require values in after successful login firstname,lastname etc.use value wherever want.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -