public class ChallengeResponseToken extends AuthToken implements AUTH.UpHandler
encrypt(byte[])
.
Note that challenge-response authentication does not prevent MIM attacks, see
Wikipedia.Modifier and Type | Class and Description |
---|---|
protected static class |
ChallengeResponseToken.Entry |
Modifier and Type | Field and Description |
---|---|
protected long |
block_time |
protected static java.util.function.BiPredicate<Message,java.lang.Boolean> |
BYPASSER_FUNCTION |
protected int |
challenge_size |
protected static short |
ID |
protected java.util.Map<Address,ChallengeResponseToken.Entry> |
pending_requests |
Constructor and Description |
---|
ChallengeResponseToken() |
Modifier and Type | Method and Description |
---|---|
boolean |
authenticate(AuthToken token,
Message msg)
This method should be implemented to perform the actual authentication of joining members.
|
void |
destroy() |
protected static byte[] |
encrypt(byte[] buf)
Simplistic example of a transformation by incrementing each byte in the array.
|
protected static byte[] |
generateRandomBytes(int size) |
java.lang.String |
getName()
Used to return the full package and class name of the implementation.
|
boolean |
handleUpMessage(Message msg)
Called when a message has been received
|
protected static long |
hash(byte[] buf) |
void |
init() |
void |
readFrom(java.io.DataInput in)
Read the state of the current object (including superclasses) from instream
Note that the input stream must not be closed
|
protected static void |
registerBypasser(AUTH auth) |
int |
size()
The size of the marshalled AuthToken
|
protected static void |
unregisterBypasser(AUTH auth) |
void |
writeTo(java.io.DataOutput out)
Write the entire state of the current object (including superclasses) to outstream.
|
protected static final short ID
protected long block_time
protected int challenge_size
protected final java.util.Map<Address,ChallengeResponseToken.Entry> pending_requests
protected static final java.util.function.BiPredicate<Message,java.lang.Boolean> BYPASSER_FUNCTION
public java.lang.String getName()
AuthToken
public boolean authenticate(AuthToken token, Message msg)
AuthToken
authenticate
in class AuthToken
token
- the token sent by the joinermsg
- the Message object containing the actual JOIN_REQpublic void writeTo(java.io.DataOutput out) throws java.lang.Exception
Streamable
writeTo
in interface Streamable
java.lang.Exception
public void readFrom(java.io.DataInput in) throws java.lang.Exception
Streamable
readFrom
in interface Streamable
java.lang.Exception
public int size()
AuthToken
public boolean handleUpMessage(Message msg)
AUTH.UpHandler
handleUpMessage
in interface AUTH.UpHandler
msg
- the messageprotected static void registerBypasser(AUTH auth)
protected static void unregisterBypasser(AUTH auth)
protected static byte[] generateRandomBytes(int size)
protected static byte[] encrypt(byte[] buf)
protected static long hash(byte[] buf)
Copyright © 1998-2020 Red Hat. All Rights Reserved.