Package com.mapr.security
Class SecurityHelper
- java.lang.Object
-
- com.mapr.security.SecurityHelper
-
public class SecurityHelper extends java.lang.ObjectSecurityHelper class
-
-
Constructor Summary
Constructors Constructor Description SecurityHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanaddCLDBsToAuthReqFull(com.mapr.fs.proto.Security.AuthenticationReqFull.Builder bld, java.lang.String clusterName)Adds CLDBs to the cldb field inside AuthenticationReqFull.Builder.static booleancheckCLDBAuthReqFull(com.mapr.fs.proto.Security.AuthenticationReqFull req)Checks to see if this AuthenticationReqFull message has a hostname in the cldb field that matchs that of the current cluster that this node is in.static com.mapr.fs.proto.Security.AuthenticationRespcreateAuthRespWrongTicket()Builds AuthenticationResp message to be sent when server receives a ticket that is not meant for the current node.static java.lang.StringgetClusterFromHost(java.util.List<java.lang.String> hosts)Retrieves the cluster name from a given list of cldb hosts, will return the first cluster name found in order of the hosts.static java.util.List<java.lang.String>getHostFromCluster(java.lang.String clusterName)Retrieves all the cldb hosts for a given cluster, will only include first nic listed for each cldbstatic com.mapr.fs.proto.Security.TicketAndKeyticketReadingHelper()static byte[]zookeeperAuthRequestCreationHelper(com.mapr.fs.proto.Security.TicketAndKey ticketAndKey, long sessionId)
-
-
-
Method Detail
-
zookeeperAuthRequestCreationHelper
public static byte[] zookeeperAuthRequestCreationHelper(com.mapr.fs.proto.Security.TicketAndKey ticketAndKey, long sessionId)
-
ticketReadingHelper
public static com.mapr.fs.proto.Security.TicketAndKey ticketReadingHelper()
-
getHostFromCluster
public static java.util.List<java.lang.String> getHostFromCluster(java.lang.String clusterName)
Retrieves all the cldb hosts for a given cluster, will only include first nic listed for each cldb- Parameters:
clusterName- the cluster name- Returns:
- a List of hosts or null if cluster cannot be found or no host are avalible
-
getClusterFromHost
public static java.lang.String getClusterFromHost(java.util.List<java.lang.String> hosts)
Retrieves the cluster name from a given list of cldb hosts, will return the first cluster name found in order of the hosts.- Parameters:
hosts- list of host names for the cluster desired- Returns:
- the cluster name or null if no clusters can be found
-
addCLDBsToAuthReqFull
public static boolean addCLDBsToAuthReqFull(com.mapr.fs.proto.Security.AuthenticationReqFull.Builder bld, java.lang.String clusterName)Adds CLDBs to the cldb field inside AuthenticationReqFull.Builder.- Parameters:
bld- the builder to add cldb toclusterName- The cluster name that specifies all the cldbs, if null or empty will just default to current cluster name- Returns:
- true if successfully added cldb field to the builder, else false
-
checkCLDBAuthReqFull
public static boolean checkCLDBAuthReqFull(com.mapr.fs.proto.Security.AuthenticationReqFull req)
Checks to see if this AuthenticationReqFull message has a hostname in the cldb field that matchs that of the current cluster that this node is in.- Parameters:
req- Message to be check to see if correct cldb host name is contained in it- Returns:
- true iff one of cldbs' hostname match to one of the hostnames of current cluster, ie if correct cluster
-
createAuthRespWrongTicket
public static com.mapr.fs.proto.Security.AuthenticationResp createAuthRespWrongTicket()
Builds AuthenticationResp message to be sent when server receives a ticket that is not meant for the current node.- Returns:
- The built AuthenticationResp message or null if there was an error
-
-