- Authorization authorization = subject
- .getPrivateCredentials(Authorization.class).iterator().next();
- if (request != null && authorization.getName() != null) {
- request.setAttribute(HttpContext.REMOTE_USER,
- authorization.getName());
- request.setAttribute(HttpContext.AUTHORIZATION, authorization);
- request.getSession().setAttribute(HttpContext.AUTHORIZATION,
- authorization);
- subject.getPrivateCredentials().add(request.getSession());
+ // Set<KerberosPrincipal> kerberosPrincipals =
+ // subject.getPrincipals(KerberosPrincipal.class);
+ // if (kerberosPrincipals.size() != 0) {
+ // KerberosPrincipal kerberosPrincipal =
+ // kerberosPrincipals.iterator().next();
+ // System.out.println(kerberosPrincipal);
+ // UserAdmin userAdmin =
+ // bc.getService(bc.getServiceReference(UserAdmin.class));
+ // User user = userAdmin.getUser(null, kerberosPrincipal.getName());
+ // Authorization authorization = userAdmin.getAuthorization(user);
+ // sharedState.put(SHARED_STATE_AUTHORIZATION, authorization);
+ // }
+ if (authorization == null) {
+ return false;
+ // throw new LoginException("Authorization should not be null");
+ } else {
+ CmsAuthUtils.addAuthentication(subject, authorization);
+ return true;