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

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


        p.put(Commands.AUTHENTICATE.P_USER_PASS, isPasswordEncoded?password:encodePassword(password));
        p.put(Commands.AUTHENTICATE.P_USER_MACHINE_IDENT, computerId);
        p.put(Commands.AUTHENTICATE.P_PLUGIN_VERSION, clientVersion);
        Authentification auth = (Authentification) callCommand(Commands.AUTHENTICATE.NAME, p, true);
        if (auth instanceof AuthSuccessfull) {
            AuthSuccessfull success = (AuthSuccessfull) auth;
            getUnifiedAuthentificationService().setUAK(success.getKey());
            if (success.getServer() != null) {
                try {
                    _ssp.getCluster().setCurrent(new Server(new URL(success.getServer())));
                } catch (MalformedURLException e) {
                    LOGGER.error("Unable to build from url current server for cluster url="+success.getServer());
                }
            }
            LOGGER.info("User logged in: "+user+" uak="+success.getKey());
        } else {
            getUnifiedAuthentificationService().setUAK(null);
            LOGGER.info("User authentication didn't succeed for "+user+". Resetting uak to null");
        }
        return auth;
View Full Code Here


                // TODO : check if we are master or authenticate to master if we aren't
                Authentification a = WOJServer.getInstance().getAuthentificationService().authenticate(uak.getUserName(), uak.getUserPass(), uak.getComputerId(), uak.getPluginVersion());
               
                //Current server can not serve the request, we send a redirect to the good server
                if(a instanceof AuthSuccessfull) {
                    AuthSuccessfull as = (AuthSuccessfull)a;
                    SecurityHelper.saveAuthentification(request.getSession(), a);
                    uak = as.getKey();
                } else {
                    throw new InvalidUAKException(uak);
                }
            } else {
                if (request.getSession() != null) {
View Full Code Here

                // TODO : check if we are master or authenticate to master if we aren't
                Authentification auth = WOJServer.getInstance().getAuthentificationService().authenticate(uak.getUserName(), uak.getUserPass(), uak.getComputerId(), uak.getPluginVersion());
               
                //Current server can not serve the request, we send a redirect to the good server
                if(auth instanceof AuthSuccessfull) {
                    AuthSuccessfull as = (AuthSuccessfull)auth;
                    SecurityHelper.fillMapWithUAK(parameterMap, as.getKey());
                    // new attempt with new uak, but without any other attempt to reauthenticate
                    if (doPost(a, request, response, command, parameterMap, false)) {
                        a.setNewUAK(as.getKey());
                    }
                } else {
                    a.setStatus(Answer.STATUS_BAD_UAK);
                    a.setObject(e.getMessage());
                }
View Full Code Here

            String url = (String)parameters.get(Parameters.REDIRECT_URL_PARAMETER);
            if (url == null) {
              url = request.getContextPath();
            }
            if (a instanceof AuthSuccessfull) {
                AuthSuccessfull as = (AuthSuccessfull)a;
                SecurityHelper.saveAuthentification(ServletHelper.getCurrentSession(), a);
                Map params = new HashMap();
                int index = url.indexOf("?p=");
        if (index != -1) {
                  // There is paramemters
                  String pathParam = url.substring(index + 3);
                  url = url.substring(0, index);
                  // BUG FIX 844
                  // The pathParam has been UTF8 encoded we have to decode it
                  pathParam = URLDecoder.decode(pathParam, "UTF-8");
                  params.putAll(URLHelper.decodeParams(pathParam));
                }
                url = URLHelper.appendParameters(url, SecurityHelper.fillMapWithUAK(params, as.getKey()));
                throw new URLRedirectException(url);
            } else {
                RequestDispatcher d = getServletContext().getRequestDispatcher("/login.jsp");
                request.setAttribute("message", "Invalid authentication. Please try again.");
                request.setAttribute(Parameters.REDIRECT_URL_PARAMETER, url);
View Full Code Here

        if(auth == null) {
            resetLoginInfos();
        } else {
          if (auth instanceof AuthSuccessfull) {
            LOGGER.debug("AuthSuccessfull:"+auth); //$NON-NLS-1$
            AuthSuccessfull success = (AuthSuccessfull) auth;
            _serverVersion = (String) success.getExtraParameter(Authentification.SERVER_VERSION);
            _serverConfiguration = success.getExtraParameters();
            setExpirationDate(success.getLicenceExpirationDate());
            return true;
          } else if (auth instanceof AuthFailed) {
            LOGGER.debug("AuthFailed:"+auth); //$NON-NLS-1$
            AuthFailed failed = (AuthFailed) auth;
            _serverVersion = (String) failed.getExtraParameter(Authentification.SERVER_VERSION);
View Full Code Here

                            return newAuthFailed(AuthFailed.ERROR, "your account is already in use on another computer");
                        }

                        computeUserKey(uak);
                       
                        AuthSuccessfull success = new AuthSuccessfull(uak);
                        success.setLicenceExpirationTime(new Long(u.getValidUntil()));
                        //TODO check message
                        success.setHasMessage(false);
                        //TODO get user server if set in user if not use random or nearest one
                        if(StringUtils.isEmpty(u.getWojServer())) {
                          success.setServer(WOJServer.getInstance().getServer().getFullUrlString());
                        } else {
                          success.setServer(u.getWojServer());
                        }
                        //add server version in response
                        success.addExtraParameters(Authentification.SERVER_VERSION, WOJServer.getVersion());
                        if (WOJServer.getInstance().isEnterpriseEdition()) {
                            try {
                                WOJServer.getInstance().getLicenseService().controlLicenses();
                            } catch (LicenseException le) {
                                LOGGER.info("too many licenses in use", le);
View Full Code Here

        }
    }
   
    public static void saveAuthentification(HttpSession s, Authentification a) {
        if (a instanceof AuthSuccessfull && s != null) {
            AuthSuccessfull as = (AuthSuccessfull)a;
            putInSession(s, as.getKey());
        }
    }
View Full Code Here

           
            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();
View Full Code Here

TOP

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

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.