Authentication auth = new TestingAuthenticationToken("username", "password", new GrantedAuthority[] {new GrantedAuthorityImpl(Constants.BLOG_PUBLISHER_ROLE)});
SecurityContextHolder.getContext().setAuthentication(auth);
}
public static void runAsBlogContributor() {
Authentication auth = new TestingAuthenticationToken("username", "password", new GrantedAuthority[] {new GrantedAuthorityImpl(Constants.BLOG_CONTRIBUTOR_ROLE)});
SecurityContextHolder.getContext().setAuthentication(auth);
}