+
+ // i18n
+ Locale locale = langCallback.getLocale();
+ if (locale == null)
+ locale = Locale.getDefault();
+ UiContext.setLocale(locale);
+
+ // authorization = (Authorization)
+ // sharedState.get(CmsAuthUtils.SHARED_STATE_AUTHORIZATION);
+ //
+ // if (authorization == null) {
+ // create credentials
+ username = nameCallback.getName();
+ if (username == null || username.trim().equals("")) {
+ // authorization = userAdmin.getAuthorization(null);
+ throw new CredentialNotFoundException("No credentials provided");
+ }
+ // char[] password = {};
+ if (passwordCallback.getPassword() != null)
+ password = passwordCallback.getPassword();
+ else
+ throw new CredentialNotFoundException("No credentials provided");
+ // FIXME move Argeo specific convention from user admin to here
+ User user = userAdmin.getUser(null, username);
+ if (user == null)
+ throw new FailedLoginException("Invalid credentials");
+ if (!user.hasCredential(null, password))
+ throw new FailedLoginException("Invalid credentials");
+ // return false;
+
+ // Log and monitor new login
+ // if (log.isDebugEnabled())
+ // log.debug("Logged in to CMS with username [" + username +
+ // "]");
+
+ authorization = userAdmin.getAuthorization(user);
+ assert authorization != null;
+ }
+
+ // }
+ // if
+ // (!sharedState.containsKey(CmsAuthUtils.SHARED_STATE_AUTHORIZATION))
+ sharedState.put(CmsAuthUtils.SHARED_STATE_AUTHORIZATION, authorization);
+ return authorization != null;