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

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


    }
   
    public void syncPrivateKey(Server server, boolean force) {
        LOGGER.info("syncing private key with "+server);
        try {
            Key newPrivateKey = ServerServicesProvider.get(server).getSynchronizationService().getPrivateKey();
            if (newPrivateKey != null) {
                WOJServer.getInstance().getServerManagementService().setNewPrivateKey(newPrivateKey);
            }
        } catch (ServiceException e) {
            LOGGER.warn("a problem occured while synchronizing private key with "+server, e);
View Full Code Here


    }

    public Object securedInvoke(UAK uak, Map m) {
        String encodedObject = (String) m.get(ServerCommands.NOTIFY_NEW_PRIVATE_KEY.P_KEY);
        encodedObject = encodedObject == null ? "" : encodedObject.trim();
        Key key = encodedObject.length() == 0 ? null : (Key)ServiceProvider.getDefault().getEncodingService().decode(encodedObject);
        WOJServer.getInstance().getServerManagementService().setNewPrivateKey(key);
        return null;
    }
View Full Code Here

    public boolean isMaster() {
        return getServerManagementService().isMaster();
    }
   
    public String getPrivateKey() {
        Key currentPrivateKey = getServerManagementService().getCurrentPrivateKey();
        return currentPrivateKey == null ? null : currentPrivateKey.getValue();
    }
View Full Code Here

        }
        String encodedObject = (String) m.get(ServerCommands.NOTIFY_NEW_MASTER.P_SERVER);
        Server server = (Server) ServiceProvider.getDefault().getEncodingService().decode(encodedObject);
        encodedObject = (String) m.get(ServerCommands.NOTIFY_NEW_MASTER.P_KEY);
        encodedObject = encodedObject == null ? "" : encodedObject.trim();
        Key key = encodedObject.length() == 0 ? null : (Key)ServiceProvider.getDefault().getEncodingService().decode(encodedObject);
       
        WOJServer.getInstance().getServerManagementService().notifyNewMaster(server, key);
        return null;
    }
View Full Code Here

    public MasterKeyProvider() {
    }
   
    protected Key getNewKey() {
        long gmtTime = TimeUtil.getGMTMillis();
        return new Key(ChecksumUtil.encodeAsString(ChecksumUtil.SHA_1, String.valueOf(gmtTime)), gmtTime + TimeUtil.MILLISECONDS_A_DAY, getServer());
//            return new Key(ChecksumUtil.encodeAsString(ChecksumUtil.SHA_1, String.valueOf(gmtTime)), gmtTime + (1000*30));
    }
View Full Code Here

        }
        return _keyProvider.getCurrentKey();
    }
   
    private boolean shouldUpdateKey() {
        Key currentKey = _keyProvider.getCurrentKey();
        return currentKey==null || !currentKey.isValid();
    }
View Full Code Here

    private synchronized void setMaster(Server master, boolean updateWOJServerState) {
        LOGGER.info("new master in "+_localServer+": old="+_master+" new="+master);
        boolean wasMaster = isMaster();
        _master = master;
        UnifiedAuthentificationService.getInstance().setAuthentificationServer(master);
        Key key = _keyProvider.getCurrentKey();
        if (key == null || (master != null && !master.equals(key.getServer()))) {
            LOGGER.debug("previous private key wasn't from new master: getting new");
            _keyProvider.setCurrentKey(null); // ensure that we discard our own key even if we have trouble contacting master
            newPrivateKey(!isMaster());
        }
        if (wasMaster != isMaster()) {
View Full Code Here

TOP

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

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.