Package com.mapr.security
Class Security
java.lang.Object
com.mapr.security.Security
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidBlacklistAndCloseConnections(int[] uids, long[] blacklistTimes, boolean reinitList) static StringByteArrayToString(String preFix, byte[] bArray) static voidCloneAndGenerateTicketFile(DataInputStream fsin, long expiration, DataOutputStream outTicket) Given an input stream for ticket file, clone the current cluster ticket with given expiration.static byte[]DecodeDataFromKeyFile(byte[] encodedData, MutableInt erri) static byte[]Decrypt(com.mapr.fs.proto.Security.Key key, byte[] inBuf, MutableInt erri) static com.mapr.fs.proto.Security.TicketDecryptTicket(byte[] encryptedTicket, MutableInt erri) static booleanstatic byte[]EncodeDataForWritingToKeyFile(byte[] serializedProtobuf, MutableInt erri) static byte[]Encrypt(com.mapr.fs.proto.Security.Key key, byte[] inBuf, MutableInt erri) static voidGenerateAndWriteTicketAndKey(String userName, long expiration, DataOutputStream outTicket) Used by JT to generate a ticket for user for a specific jobstatic com.mapr.fs.proto.Security.Keystatic com.mapr.fs.proto.Security.TicketAndKeyGenerateTicketAndKey(com.mapr.fs.proto.Security.ServerKeyType keyType, String userName, int uid, int[] gids, long expiryTime, long maxRenewalTimeSec, TicketOptionalParams tOptionalParams, MutableInt erri) static com.mapr.fs.proto.Security.TicketAndKeyGenerateTicketAndKeyUsingServerKey(com.mapr.fs.proto.Security.ServerKeyType keyType, com.mapr.fs.proto.Security.Key key, String userName, int uid, int[] gids, long expiryTime, long maxRenewalTimeSec, boolean isExternal, long capabilities, MutableInt erri) static com.mapr.fs.proto.Security.KeygetCLDBKeyFromHSM(MutableInt erri) static com.mapr.fs.proto.Security.KeyGetClusterKey(com.mapr.fs.proto.Security.Key CldbKey, long time) static com.mapr.fs.proto.Security.KeyGetKey(com.mapr.fs.proto.Security.ServerKeyType keyType, MutableInt erri) static com.mapr.fs.proto.Security.KeyGetServerKey(com.mapr.fs.proto.Security.Key CldbKey, long time) static com.mapr.fs.proto.Security.TicketAndKeyGetTicketAndKeyForCluster(com.mapr.fs.proto.Security.ServerKeyType keyType, String clusterName, MutableInt erri) static booleanstatic booleanIsTicketAndKeyUsable(com.mapr.fs.proto.Security.TicketAndKey ticketAndKey) static voidstatic voidMergeAndGenerateTicketFile(DataInputStream fsin, String userName, long expiration, DataOutputStream outTicket) static voidRemoveFromBlacklist(int[] uids) static com.mapr.fs.proto.Security.TicketAndKeyRenewTicketAndKey(com.mapr.fs.proto.Security.ServerKeyType keyType, com.mapr.fs.proto.Security.TicketAndKey ticketAndKey, long expiryTime, MutableInt erri) static intSetKey(com.mapr.fs.proto.Security.ServerKeyType keyType, com.mapr.fs.proto.Security.Key key) static intSetKeyFile(com.mapr.fs.proto.Security.ServerKeyType keyType, String path) static intSetTicketAndKey(com.mapr.fs.proto.Security.ServerKeyType keyType, String clusterName, com.mapr.fs.proto.Security.TicketAndKey ticketAndKey) static intSetTicketAndKeyFile(String path) static voidstatic StringTicketAndKeyToString(String prefix, com.mapr.fs.proto.Security.TicketAndKey t) static StringTicketToString(String prefix, com.mapr.fs.proto.Security.Ticket t) static voidstatic StringUserCredsToString(String prefix, com.mapr.fs.proto.Security.CredentialsMsg c) static com.mapr.fs.proto.Security.TicketValidateTicketAndKey(com.mapr.fs.proto.Security.TicketAndKey t, MutableInt err)
-
Field Details
-
MAX_EXPIRY_TIME
public static long MAX_EXPIRY_TIME
-
-
Method Details
-
GenerateRandomKey
public static com.mapr.fs.proto.Security.Key GenerateRandomKey() -
Encrypt
-
Decrypt
-
EncodeDataForWritingToKeyFile
-
DecodeDataFromKeyFile
-
isHSMFeatureEnabled
public static boolean isHSMFeatureEnabled() -
doesDareKeyExist
public static boolean doesDareKeyExist() -
getCLDBKeyFromHSM
-
SetKeyFile
-
SetKey
public static int SetKey(com.mapr.fs.proto.Security.ServerKeyType keyType, com.mapr.fs.proto.Security.Key key) -
GetKey
public static com.mapr.fs.proto.Security.Key GetKey(com.mapr.fs.proto.Security.ServerKeyType keyType, MutableInt erri) -
GenerateTicketAndKey
public static com.mapr.fs.proto.Security.TicketAndKey GenerateTicketAndKey(com.mapr.fs.proto.Security.ServerKeyType keyType, String userName, int uid, int[] gids, long expiryTime, long maxRenewalTimeSec, TicketOptionalParams tOptionalParams, MutableInt erri) -
GenerateAndWriteTicketAndKey
public static void GenerateAndWriteTicketAndKey(String userName, long expiration, DataOutputStream outTicket) throws IOException Used by JT to generate a ticket for user for a specific job- Parameters:
userName-expiration- - will be configurable on JToutTicket- - DataOutputStream where ticket will be written- Throws:
IOException
-
CloneAndGenerateTicketFile
public static void CloneAndGenerateTicketFile(DataInputStream fsin, long expiration, DataOutputStream outTicket) throws IOException Given an input stream for ticket file, clone the current cluster ticket with given expiration. It generates a non-renewable ticket. Parameters that will be cloned are uid, gids, canImpersonate- Parameters:
fsin- - DataInputStream for input ticketexpiration- - expiration of the cloned ticket.outTicket- - DataOutputStream where ticket will be written- Throws:
IOException- where input ticket cannot be parsed for current cluster.
-
MergeAndGenerateTicketFile
public static void MergeAndGenerateTicketFile(DataInputStream fsin, String userName, long expiration, DataOutputStream outTicket) throws IOException - Throws:
IOException
-
GenerateTicketAndKeyUsingServerKey
public static com.mapr.fs.proto.Security.TicketAndKey GenerateTicketAndKeyUsingServerKey(com.mapr.fs.proto.Security.ServerKeyType keyType, com.mapr.fs.proto.Security.Key key, String userName, int uid, int[] gids, long expiryTime, long maxRenewalTimeSec, boolean isExternal, long capabilities, MutableInt erri) -
RenewTicketAndKey
public static com.mapr.fs.proto.Security.TicketAndKey RenewTicketAndKey(com.mapr.fs.proto.Security.ServerKeyType keyType, com.mapr.fs.proto.Security.TicketAndKey ticketAndKey, long expiryTime, MutableInt erri) -
DecryptTicket
public static com.mapr.fs.proto.Security.Ticket DecryptTicket(byte[] encryptedTicket, MutableInt erri) -
SetTicketAndKeyFile
-
SetTicketAndKey
public static int SetTicketAndKey(com.mapr.fs.proto.Security.ServerKeyType keyType, String clusterName, com.mapr.fs.proto.Security.TicketAndKey ticketAndKey) -
UseClusterTicketAsServerTicket
public static void UseClusterTicketAsServerTicket() -
GetTicketAndKeyForCluster
public static com.mapr.fs.proto.Security.TicketAndKey GetTicketAndKeyForCluster(com.mapr.fs.proto.Security.ServerKeyType keyType, String clusterName, MutableInt erri) -
GetServerKey
public static com.mapr.fs.proto.Security.Key GetServerKey(com.mapr.fs.proto.Security.Key CldbKey, long time) -
GetClusterKey
public static com.mapr.fs.proto.Security.Key GetClusterKey(com.mapr.fs.proto.Security.Key CldbKey, long time) -
ByteArrayToString
-
UserCredsToString
-
TicketAndKeyToString
-
TicketToString
-
ValidateTicketAndKey
public static com.mapr.fs.proto.Security.Ticket ValidateTicketAndKey(com.mapr.fs.proto.Security.TicketAndKey t, MutableInt err) -
IsTicketAndKeyUsable
public static boolean IsTicketAndKeyUsable(com.mapr.fs.proto.Security.TicketAndKey ticketAndKey) -
BlacklistAndCloseConnections
public static void BlacklistAndCloseConnections(int[] uids, long[] blacklistTimes, boolean reinitList) -
RemoveFromBlacklist
public static void RemoveFromBlacklist(int[] uids) -
TestSecurity
public static void TestSecurity() -
main
-