Created
          September 7, 2011 18:02 
        
      - 
      
- 
        Save mente/1201270 to your computer and use it in GitHub Desktop. 
    Smartfox Filter
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class AuthenticationFilter extends SFSExtensionFilter { | |
| @Override | |
| public void destroy() {} | |
| @Override | |
| public FilterAction handleClientRequest(String s, User user, ISFSObject object) throws SFSException { | |
| ThreadState state = new SubjectThreadState(ShiroUtils.getSubject(user.getSession())); | |
| //how to unbind it later? | |
| state.bind(); | |
| return FilterAction.CONTINUE; | |
| } | |
| @Override | |
| public FilterAction handleServerEvent(ISFSEvent isfsEvent) throws SFSException { | |
| User user = (User) isfsEvent.getParameter(SFSEventParam.USER); | |
| ThreadState state; | |
| if (user != null) { | |
| state = new SubjectThreadState(ShiroUtils.getSubject(user.getSession())); | |
| } else { | |
| state = new SubjectThreadState(ShiroUtils.newSubject()); | |
| } | |
| //how to unbind it later? | |
| state.bind(); | |
| return FilterAction.CONTINUE; | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment