java - How to get hold of user details in custom expression handlers -


i using custom security expression handler , using spring 3.2.0. here custom expression root class :

public class customerportalsecurityexpressionroot extends websecurityexpressionroot {      private static final log logger = logfactory.getlog(customerportalsecurityexpressionroot.class);      private customerportalpanicservice customerportalpanicservice;      public customerportalsecurityexpressionroot(authentication a, filterinvocation fi) {         super(a, fi);     }      public boolean ispanicking() {         if (customerportalpanicservice != null) {              return customerportalpanicservice.ispanicking();         } else {             logger.warn("customerportalpanicservice not available.");             return false;         }     }       public boolean hasgotpermission(string title){          logger.debug("coming inside has permission! @public class customerportalsecurityexpressionroot "+title);         return true;     }     public void setcustomerportalpanicservice(customerportalpanicservice customerportalpanicservice) {         this.customerportalpanicservice = customerportalpanicservice;     } } 

i using way in spring security config file :

 <http auto-config="true" use-expressions="true" >          <form-login login-page="/login" login-processing-url="/loginifm" authentication-failure-url="/login/?login_error=1" username-parameter="username" password-parameter="password" />         <logout invalidate-session="true" logout-success-url="/" logout-url="/logout_ifm" />           <expression-handler ref="websecurityexpressionhandler"/>          <!-- rules. -->         <!--     <intercept-url pattern="/" access="permitall" /> -->          <intercept-url pattern="/hardcopy/*" access="isauthenticated() , haspermission('tw')" />     </http>   <!-- expression custom handler -->     <b:bean id="websecurityexpressionhandler" class="no.user.security.dnwebsecurityexpressionhandler" /> 

the authentication taking place using authentication manager, want know how hold of user details coming json response after authentication? know there haspermission thing in permissionevaluator, more flexible me. help!

you can use securitycontextholder.getcontext().getauthentication().getauthorities() hold of authorities granted authenticated user.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -