Package org.springmodules.workflow.osworkflow.web

Source Code of org.springmodules.workflow.osworkflow.web.AcegiWorkflowContextHandlerInterceptorTests

package org.springmodules.workflow.osworkflow.web;

import org.acegisecurity.Authentication;
import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.context.SecurityContext;
import org.acegisecurity.context.SecurityContextImpl;
import org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.acegisecurity.userdetails.User;

import org.springframework.mock.web.MockHttpServletRequest;

/**
* @author robh
*/
public class AcegiWorkflowContextHandlerInterceptorTests extends AbstractWorkflowContextHandlerInterceptorTests {


  protected MockHttpServletRequest getMockRequest(String userName) {
    User user = new User(userName, "dummy", true, true, true, true, new GrantedAuthority[]{});
    Authentication auth = new UsernamePasswordAuthenticationToken(user, null);
    SecurityContext context = new SecurityContextImpl();
    context.setAuthentication(auth);
    SecurityContextHolder.setContext(context);

    return new MockHttpServletRequest();
  }

  protected AbstractWorkflowContextHandlerInterceptor getInterceptor() {
    return new AcegiWorkflowContextHandlerInterceptor();
  }
}
TOP

Related Classes of org.springmodules.workflow.osworkflow.web.AcegiWorkflowContextHandlerInterceptorTests

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.