Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
This artifact provides a single jar that contains all classes required to use remote Jakarta Enterprise Beans and Jakarta Messaging, including
all dependencies. It is intended for use by those not using maven, maven users should just import the Jakarta Enterprise Beans and
Jakarta Messaging BOM's instead (shaded JAR's cause lots of problems with maven, as it is very easy to inadvertently end up
with different versions on classes on the class path).
package org.jgroups.protocols;
import org.jgroups.*;
import org.jgroups.annotations.MBean;
import org.jgroups.annotations.Property;
import org.jgroups.annotations.XmlAttribute;
import org.jgroups.auth.AuthToken;
import org.jgroups.auth.X509Token;
import org.jgroups.conf.ClassConfigurator;
import org.jgroups.protocols.pbcast.GMS;
import org.jgroups.protocols.pbcast.JoinRsp;
import org.jgroups.stack.Protocol;
import org.jgroups.util.MessageBatch;
import org.jgroups.util.MessageIterator;
import org.jgroups.util.Util;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
/**
* The AUTH protocol adds a layer of authentication to JGroups. It intercepts join and merge requests and rejects them
* if the joiner or merger is not permitted to join a or merge into a cluster. AUTH should be placed right below
* {@link GMS} in the configuration.
* Note that some of the AuthTokens (such as MD5Token, SimpleToken etc) cannot prevent rogue members from joining a
* cluster, and are thus deprecated. Read the manual for a detailed description of why.
* @author Chris Mills
* @author Bela Ban
*/
@XmlAttribute(attrs={
"auth_value", // SimpleToken, MD5Token, X509Token
"fixed_members_value", "fixed_members_seperator", // FixedMembershipToken
"client_principal_name", "client_password", "service_principal_name", // Krb5Token
"token_hash", // MD5Token
"match_string", "match_ip_address", "match_logical_name", // RegexMembership
"keystore_type", "cert_alias", "keystore_path", "cipher_type",
"cert_password", "keystore_password" // X509Token
})
@MBean(description="Provides authentication of joiners, to prevent un-authorized joining of a cluster")
public class AUTH extends Protocol {
/** Used on the coordinator to authentication joining member requests against */
protected AuthToken auth_token;
protected static final short GMS_ID=ClassConfigurator.getProtocolId(GMS.class);
/** List of UpHandler which are called when an up event has been received. Usually used by AuthToken impls */
protected final List up_handlers=new ArrayList<>();
protected Address local_addr;
public AUTH() {}
protected volatile boolean authenticate_coord=true;
@Property(description="Do join or merge responses from the coordinator also need to be authenticated")
public AUTH setAuthCoord( boolean authenticateCoord) {
this.authenticate_coord= authenticateCoord; return this;
}
@Property(name="auth_class",description="The fully qualified name of the class implementing the AuthToken interface")
public void setAuthClass(String class_name) throws Exception {
Object obj=Class.forName(class_name).getDeclaredConstructor().newInstance();
auth_token=(AuthToken)obj;
auth_token.setAuth(this);
}
public String getAuthClass() {return auth_token != null? auth_token.getClass().getName() : null;}
public AuthToken getAuthToken() {return auth_token;}
public AUTH setAuthToken(AuthToken token) {this.auth_token=token; return this;}
@Deprecated
public AUTH register(UpHandler handler) {up_handlers.add(handler); return this;}
@Deprecated
public AUTH unregister(UpHandler handler) {up_handlers.remove(handler);return this;}
public Address getAddress() {return local_addr;}
public PhysicalAddress getPhysicalAddress() {return getTransport().getPhysicalAddress();}
public List