session.setAttribute(ROLLER_SESSION, rollerSession);
}
Principal principal = request.getUserPrincipal();
if (rollerSession.getAuthenticatedUser() == null && principal != null) {
try {
UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();
User user = umgr.getUserByUserName(principal.getName());
// try one time to auto-provision, only happens if user==null
// which means installation has SSO-enabled in security.xml
if(user == null && WebloggerConfig.getBooleanProperty("users.sso.autoProvision.enabled")) {
// provisioning enabled, get provisioner and execute
AutoProvision provisioner = RollerContext.getAutoProvision();
if(provisioner != null) {
boolean userProvisioned = provisioner.execute();
if(userProvisioned) {
// try lookup again real quick
user = umgr.getUserByUserName(principal.getName());
}
}
}
// only set authenticated user if user is enabled
if(user != null && user.getEnabled().booleanValue()) {