Package org.jayasoft.woj.common.model.security

Examples of org.jayasoft.woj.common.model.security.UAK


        if (visibilityId != null) {
            v = Visibility.fromInt(visibilityId.intValue());
        }
   
        if (userName!=null && userPass!=null && machineIdent!=null && userKey != null && userId != null && groups != null && v != null && pluginVersion != null) {
            return new UAK(userName, userPass, machineIdent, userId, groups, v, pluginVersion, userKey);
        } else {
            return null;
        }
    }
View Full Code Here


     * Should be called only when we are the master. In other cases UAK should be obtained through
     * classical auto login system
     */
    private void ensureUAK() {
        if (UnifiedAuthentificationService.getInstance().getUAK() == null) {
            UAK k = UnifiedAuthentificationService.getInstance().newUAK();
            k.computeUserKey(getCurrentPrivateKey().getValue());
            UnifiedAuthentificationService.getInstance().setUAK(k);
        } else {
            UAK k = UnifiedAuthentificationService.getInstance().getUAK();
            k.computeUserKey(getCurrentPrivateKey().getValue());
        }
    }
View Full Code Here

        Long userId = null;
        List groups = null;
        Visibility v = null;

        LOGGER.debug("looking for UAK in request");
        UAK uak = null;
        try {
          if ((uak = (UAK) request.getAttribute(UAK_KEY)) != null) {
            LOGGER.debug("UAK found in request "+uak);
            return uak;
          }

          LOGGER.debug("looking for UAK in session");
          HttpSession s = request.getSession();
          if (s!=null) {
            if ((uak = (UAK) s.getAttribute(UAK_KEY)) != null) {
              LOGGER.debug("UAK found in Session "+uak);
              return uak;
            } else {
              if (s.getAttribute(Parameters.SESSION_USER_REGISTRED) != null) {
                userName = (String)s.getAttribute(Parameters.SESSION_USER_NAME);
                userPass = (String)s.getAttribute(Parameters.SESSION_USER_PASS);
                machineIdent = (String)s.getAttribute(Parameters.SESSION_USER_MACHINE_IDENT);
                userKey = (String)s.getAttribute(Parameters.SESSION_USER_KEY);
                pluginVersion = (String)s.getAttribute(Parameters.SESSION_PLUGIN_VERSION);
                userId = (Long)s.getAttribute(Parameters.SESSION_USER_ID);
                groups = (List)s.getAttribute(Parameters.SESSION_USER_GROUPS);
                v = (Visibility)s.getAttribute(Parameters.SESSION_PUBLISH_VISIBILITY_RIGHT);
              }
            }
          }

          if (userName==null || userPass==null || machineIdent==null || userKey==null || userId == null || groups == null || v == null || pluginVersion == null) {
              // we try to get information from the request
              LOGGER.debug("No UAK found in Request/Session and no user registered : Creating UAK from request paramters.");
              Map p = ServletHelper.getParametersAsString(request);
              uak = getUAK(p);
              LOGGER.debug("UAK created from request parameters : " + uak);
          } else {
              LOGGER.debug("No UAK found in Request/Session, but user registered : Creating UAK from user registration information.");
              uak = new UAK(userName, userPass, machineIdent, userId, groups, v, pluginVersion, userKey);
          }
         
          return uak;
        } finally {
          // store UAK found in request
View Full Code Here

                        if (userLogged==null) {
                            LOGGER.debug("user try to access repository page without being logged in.");
                            return ActionsHelper.loginForwardName();
                        }
                       
                        UAK uak = null;
                        try {
                            uak = getUserUAK(userLogged, request);   
                        } catch (Exception e) {
                            LOGGER.warn("user cannot be connected due to", e);
                        }
                       
                        if (uak==null) {
                            // not identified on master
                            return "repository.show.error";
                        } else {
                            Visibility v = uak.getPublishVisibilityRight();
                            List visibilities = new ArrayList(Arrays.asList(Visibility.getVisibilitiesUpTo(v)));
                            if (userLogged.getGroup() == null) {
                                visibilities.remove(Visibility.PRIVATE);
                            }
                            request.setAttribute(Params.REPOSITORY.SHOW.REQUEST.VISIBILITIES, visibilities);
View Full Code Here

            HttpAuthentificationService af = new HttpAuthentificationService();
            af.setServer(new SimpleTargetServerProvider(Portal.getInstance().getMasterServer()));
            af.setUnifiedAuthService(uas);
            af.setSsp(userSSP);
           
            UAK u = null;
            try {
                Authentification a = af.authenticate(userLogged.getLogin(), userLogged.getPassword(), CommonSecurityHelper.BROWSER, true, Portal.getInstance().getVersion());
                if (a instanceof AuthSuccessfull) {
                    AuthSuccessfull au = (AuthSuccessfull)a;
                    u = au.getKey();
                    uas.setLoginInfo(userLogged.getLogin(), userLogged.getPassword(), CommonSecurityHelper.BROWSER, true, Portal.getVersion(), u.getUserId(), u.getGroups(), u.getPublishVisibilityRight());
                    uas.setUAK(u);
                }
            } catch (org.jayasoft.woj.common.services.ServiceException e) {
                e.printStackTrace();
            }
           
            final UAK uak = u;
            uakProvider = new UAKProvider() {
                public UAK getUAK() {
                    return uak;
                }
            };
View Full Code Here

TOP

Related Classes of org.jayasoft.woj.common.model.security.UAK

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.