Package org.jgroups.protocols.pbcast.GMS

Examples of org.jgroups.protocols.pbcast.GMS.GmsHeader


    @Override
    public Object up(Event evt) {
        if (evt.getType() == Event.MSG) {
            Message msg = (Message) evt.getArg();
            SaslHeader saslHeader = (SaslHeader) msg.getHeader(SASL_ID);
            GmsHeader gmsHeader = (GmsHeader) msg.getHeader(GMS_ID);
            if (needsAuthentication(gmsHeader)) {
                if (saslHeader == null)
                    throw new IllegalStateException("Found GMS join or merge request but no SASL header");
                if (!serverChallenge(gmsHeader, saslHeader, msg))
                    return null; // failed auth, don't pass up
View Full Code Here


    @Override
    public void up(MessageBatch batch) {
        for (Message msg : batch) {
            // If we have a join or merge request --> authenticate, else pass up
            GmsHeader gmsHeader = (GmsHeader) msg.getHeader(GMS_ID);
            if (needsAuthentication(gmsHeader)) {
                SaslHeader saslHeader = (SaslHeader) msg.getHeader(id);
                if (saslHeader == null) {
                    log.warn("Found GMS join or merge request but no SASL header");
                    sendRejectionMessage(gmsHeader.getType(), batch.sender(), "join or merge without an SASL header");
                    batch.remove(msg);
                } else if (!serverChallenge(gmsHeader, saslHeader, msg)) // authentication failed
                    batch.remove(msg); // don't pass up
            }
        }
View Full Code Here

        case Event.SET_LOCAL_ADDRESS:
            local_addr = (Address) evt.getArg();
            break;
        case Event.MSG:
            Message msg = (Message) evt.getArg();
            GmsHeader hdr = (GmsHeader) msg.getHeader(GMS_ID);
            if (needsAuthentication(hdr)) {
                // We are a client who needs to authenticate
                SaslClientContext ctx = null;
                Address remoteAddress = msg.getDest();
                try {
View Full Code Here

    protected void sendJoinRejectionMessage(Address dest, String error_msg) {
        if (dest == null)
            return;

        JoinRsp joinRes = new JoinRsp(error_msg); // specify the error message on the JoinRsp
        Message msg = new Message(dest).putHeader(GMS_ID, new GmsHeader(GmsHeader.JOIN_RSP)).setBuffer(
                GMS.marshal(joinRes));
        down_prot.down(new Event(Event.MSG, msg));
    }
View Full Code Here

        down_prot.down(new Event(Event.MSG, msg));
    }

    protected void sendMergeRejectionMessage(Address dest) {
        Message msg = new Message(dest).setFlag(Message.Flag.OOB);
        GmsHeader hdr = new GmsHeader(GmsHeader.MERGE_RSP);
        hdr.setMergeRejected(true);
        msg.putHeader(GMS_ID, hdr);
        if (log.isDebugEnabled())
            log.debug("merge response=" + hdr);
        down_prot.down(new Event(Event.MSG, msg));
    }
View Full Code Here

TOP

Related Classes of org.jgroups.protocols.pbcast.GMS.GmsHeader

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.