Examples of UAK


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

   
    public final Object invoke(Map params) throws Exception {
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(getName() + " command is invoked with param: " + params);
      }
        UAK uak = SecurityHelper.getAndCheckUAK(params);
        checkAuthorization(uak, params);
        return securedInvoke(uak, params);
    }
View Full Code Here

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

public abstract class SecuredServlet extends WOJServlet {
    private final static Logger LOGGER = LoggingManager.getLogger(SecuredServlet.class.getName());
   
    final protected void wojDoPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        UAK uak = SecurityHelper.getUAK(request);
       
        if (uak == null) {
            throw new NoUAKException();
        } else {
            if (!uak.checkUserKey(WOJServer.getInstance().getPrivateKey())) {
                // we try to authenticate again
                // 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);
View Full Code Here

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

            a.setStatus(Answer.STATUS_NO_UAK);
            a.setObject(e.getMessage());
        } catch (InvalidUAKException e) {
            if (retryAuthenticate) {
                // we check if the login info is not ok
                UAK uak = e.getUak();
               
                // we try to authenticate again
                // 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());
View Full Code Here

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

      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(getName() + " command is invoked with param: " + m);
      }
        // here we can't check security more than that, because there are good chance the uak key has been
        // computed with another master private key
        UAK uak = SecurityHelper.getUAK(m);
        if (uak == null) {
            throw new NoUAKException();
        }
        String encodedObject = (String) m.get(ServerCommands.NOTIFY_NEW_MASTER.P_SERVER);
        Server server = (Server) ServiceProvider.getDefault().getEncodingService().decode(encodedObject);
View Full Code Here

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

    private UAK getUAK() {
        return getServerServicesProvider().getAuthentificationService().getUAK();   
    }
   
    boolean isAdministrator() {
      UAK uak = getUAK();
      if(uak != null) {
        return uak.isAdmin();
      }
      return false;
    }
View Full Code Here

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

        return uak.isAdmin();
      }
      return false;
    }
    boolean hasGroup() {
      UAK uak = getUAK();
      if(uak != null) {
        return uak.getGroups() != null && !uak.getGroups().isEmpty();
      }
      return false;
    }
View Full Code Here

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

     */
    public static void redirectToHost(HttpServletRequest request, HttpServletResponse response, Server newHost) {
        String url = newHost.getFullUrlString()+getRequestedUrl(request);
        Map params = new HashMap(ServletHelper.getParametersAsString(request));
        params.put("redirected", "true");
        UAK uak = SecurityHelper.getUAK(request);
        if (uak != null && SecurityHelper.getUAK(params) == null) {
            SecurityHelper.fillMapWithUAK(params, uak);
        }
        url = URLHelper.appendParameters(url, params);
        redirectToURL(response, url);
View Full Code Here

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

                        }

                        PrincipalRight pr = WOJServer.getInstance().getDataService().getRightsDao().getConsolidatedPrincipalRight(new Long(u.getId()), groups);
                        Visibility publishVisibility = pr == null ? Visibility.DEFAULT_VISIBILITY : pr.getPublishVisibility();
                       
                        UAK uak = new UAK(userName, userPassword, computerIdent, new Long(u.getId()), groups, publishVisibility, pluginId);
                        if (!uak.isAdmin() && !uak.isServer()) {
                            if (!WOJServer.getInstance().getDataService().getLoginTraceDao().login(u, computerIdent)) {
                                LOGGER.info("User : " + u.getLogin() + " has already used a trial on a different computer, login refused");
                                return newAuthFailed(AuthFailed.ERROR, "you have already used a trial license on this computer");
                            }
                        }
View Full Code Here

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

    public UAKProvider newAutoLoginUAKProvider(BasicServerServicesProvider provider) {
        return new AutoLoginUAKProvider(provider, this);
    }

    public UAK newUAK() {
        return new UAK(
                getUsername(),
                _passwordEncrypted?getPassword():ChecksumUtil.SHA_1.computeAsString(new ByteArrayInputStream(getPassword().getBytes())),
                getComputerID(),
                getId(),
                getGroups(),
View Full Code Here

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

            throw new ServiceException(e.getMessage());
        }
    }

    protected Map fillMapWithUAK(Map params) {
        UAK uak = _uakProvider.getUAK();
        if (uak != null) {
            return CommonSecurityHelper.fillMapWithUAK(params, uak);
        } else {
            throw new IllegalStateException("no uak found while calling a secured service");
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.