for ( String roleName : roles ) {
authList.add( new GrantedAuthorityImpl( roleName ) );
}
GrantedAuthority[] authorities = authList.toArray( new GrantedAuthority[0] );
UserDetails userDetails = new User( username, PASSWORD, true, true, true, true, authorities );
Authentication auth = new UsernamePasswordAuthenticationToken( userDetails, PASSWORD, authorities );
PentahoSessionHolder.setSession( pentahoSession );
// this line necessary for Spring Security's MethodSecurityInterceptor
SecurityContextHolder.getContext().setAuthentication( auth );
createUserHomeFolder( tenant, username );