- request = httpCallback.getRequest();
- if (request != null) {
- authorization = (Authorization) request
- .getAttribute(HttpContext.AUTHORIZATION);
- if (authorization == null)
- authorization = (Authorization) request.getSession()
- .getAttribute(HttpContext.AUTHORIZATION);
- }
- // if (authorization == null || authorization.getName() == null)
- // if (!isAnonymous) {
- // // ask for username and password
- // NameCallback nameCallback = new NameCallback("User");
- // PasswordCallback passwordCallback = new PasswordCallback(
- // "Password", false);
- //
- // // handle callbacks
- // try {
- // callbackHandler.handle(new Callback[] { nameCallback,
- // passwordCallback });
- // } catch (Exception e) {
- // throw new ArgeoException("Cannot handle callbacks", e);
- // }
-
- if (authorization == null) {
- // create credentials
- final String username = nameCallback.getName();
- if (username == null || username.trim().equals("")) {
- // authorization = userAdmin.getAuthorization(null);
- throw new CredentialNotFoundException(
- "No credentials provided");
- } else {
- char[] password = {};
- if (passwordCallback.getPassword() != null)
- password = passwordCallback.getPassword();
- else
- throw new CredentialNotFoundException(
- "No credentials provided");
-
- User user = userAdmin.getUser(null, username);
- if (user == null)
- return false;
- if (!user.hasCredential(null, password))
- return false;
- authorization = userAdmin.getAuthorization(user);
- }
+
+ // i18n
+ locale = langCallback.getLocale();
+ if (locale == null)
+ locale = Locale.getDefault();
+ // FIXME add it to Subject
+ // UiContext.setLocale(locale);
+
+ username = nameCallback.getName();
+ if (username == null || username.trim().equals("")) {
+ // authorization = userAdmin.getAuthorization(null);
+ throw new CredentialNotFoundException("No credentials provided");