* @param login
* @return
*/
public static final Identity createAndPersistIdentityAsUser(String login) {
Manager securityManager = ManagerFactory.getManager();
SecurityGroup group = securityManager.findSecurityGroupByName(Constants.GROUP_OLATUSERS);
if (group == null) group = securityManager.createAndPersistNamedSecurityGroup(Constants.GROUP_OLATUSERS);
User user = UserManager.getInstance().createUser("first" + login, "last" + login, login + "@" + maildomain);
Identity identity = securityManager.createAndPersistIdentityAndUser(login, user, OLATAuthenticationController.PROVIDER_OLAT, login,
Encoder.encrypt("A6B7C8"));
securityManager.addIdentityToSecurityGroup(identity, group);