public class AccessKeyGenerator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static Logger |
logger |
Constructor and Description |
---|
AccessKeyGenerator(int validTimeInSeconds,
java.util.Map<java.lang.String,java.lang.String> allowMap) |
Modifier and Type | Method and Description |
---|---|
static byte[] |
asByte(java.lang.String buf)
Turns string into array of bytes
|
static java.lang.String |
asHex(byte[] buf)
Turns array of bytes into string
|
java.lang.String |
getAccessKey(int userId,
java.lang.String ip) |
int |
getUserId(java.lang.String ip,
java.lang.String accessKey) |
static void |
main(java.lang.String[] args) |
public AccessKeyGenerator(int validTimeInSeconds, java.util.Map<java.lang.String,java.lang.String> allowMap)
public java.lang.String getAccessKey(int userId, java.lang.String ip)
public int getUserId(java.lang.String ip, java.lang.String accessKey)
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
public static java.lang.String asHex(byte[] buf)
buf
- Array of bytes to convert to hex stringpublic static byte[] asByte(java.lang.String buf)
buf
- String of hex-encoded bytes to convert to byte array