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 );