private static class ScramSha1Authenticator.ScramSha1SaslClient
extends java.lang.Object
implements javax.security.sasl.SaslClient
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
clientFirstMessageBare |
private MongoCredential |
credential |
private static java.lang.String |
GS2_HEADER |
private static int |
RANDOM_LENGTH |
private ScramSha1Authenticator.RandomStringGenerator |
randomStringGenerator |
private java.lang.String |
rPrefix |
private byte[] |
serverSignature |
private int |
step |
Constructor and Description |
---|
ScramSha1SaslClient(MongoCredential credential,
ScramSha1Authenticator.RandomStringGenerator randomStringGenerator) |
Modifier and Type | Method and Description |
---|---|
private byte[] |
computeClientFinalMessage(byte[] challenge) |
private byte[] |
computeClientFirstMessage() |
private byte[] |
decodeBase64(java.lang.String str) |
private byte[] |
decodeUTF8(java.lang.String str) |
void |
dispose() |
private java.lang.String |
encodeBase64(byte[] bytes) |
private java.lang.String |
encodeUTF8(byte[] bytes) |
byte[] |
evaluateChallenge(byte[] challenge) |
java.lang.String |
getMechanismName() |
java.lang.Object |
getNegotiatedProperty(java.lang.String propName) |
private byte[] |
h(byte[] data) |
boolean |
hasInitialResponse() |
private byte[] |
hi(java.lang.String password,
byte[] salt,
int iterations) |
private byte[] |
hmac(byte[] bytes,
java.lang.String key) |
boolean |
isComplete() |
private java.util.HashMap<java.lang.String,java.lang.String> |
parseServerResponse(java.lang.String response)
The server provides back key value pairs using an = sign and delimited
by a command.
|
private java.lang.String |
prepUserName(java.lang.String userName) |
byte[] |
unwrap(byte[] incoming,
int offset,
int len) |
byte[] |
wrap(byte[] outgoing,
int offset,
int len) |
private byte[] |
xor(byte[] a,
byte[] b) |
private static final java.lang.String GS2_HEADER
private static final int RANDOM_LENGTH
private final MongoCredential credential
private java.lang.String clientFirstMessageBare
private final ScramSha1Authenticator.RandomStringGenerator randomStringGenerator
private java.lang.String rPrefix
private byte[] serverSignature
private int step
ScramSha1SaslClient(MongoCredential credential, ScramSha1Authenticator.RandomStringGenerator randomStringGenerator)
public java.lang.String getMechanismName()
getMechanismName
in interface javax.security.sasl.SaslClient
public boolean hasInitialResponse()
hasInitialResponse
in interface javax.security.sasl.SaslClient
public byte[] evaluateChallenge(byte[] challenge) throws javax.security.sasl.SaslException
evaluateChallenge
in interface javax.security.sasl.SaslClient
javax.security.sasl.SaslException
public boolean isComplete()
isComplete
in interface javax.security.sasl.SaslClient
public byte[] unwrap(byte[] incoming, int offset, int len) throws javax.security.sasl.SaslException
unwrap
in interface javax.security.sasl.SaslClient
javax.security.sasl.SaslException
public byte[] wrap(byte[] outgoing, int offset, int len) throws javax.security.sasl.SaslException
wrap
in interface javax.security.sasl.SaslClient
javax.security.sasl.SaslException
public java.lang.Object getNegotiatedProperty(java.lang.String propName)
getNegotiatedProperty
in interface javax.security.sasl.SaslClient
public void dispose() throws javax.security.sasl.SaslException
dispose
in interface javax.security.sasl.SaslClient
javax.security.sasl.SaslException
private byte[] computeClientFirstMessage() throws javax.security.sasl.SaslException
javax.security.sasl.SaslException
private byte[] computeClientFinalMessage(byte[] challenge) throws javax.security.sasl.SaslException
javax.security.sasl.SaslException
private byte[] decodeBase64(java.lang.String str)
private byte[] decodeUTF8(java.lang.String str) throws javax.security.sasl.SaslException
javax.security.sasl.SaslException
private java.lang.String encodeBase64(byte[] bytes)
private java.lang.String encodeUTF8(byte[] bytes) throws javax.security.sasl.SaslException
javax.security.sasl.SaslException
private byte[] h(byte[] data) throws javax.security.sasl.SaslException
javax.security.sasl.SaslException
private byte[] hi(java.lang.String password, byte[] salt, int iterations) throws javax.security.sasl.SaslException
javax.security.sasl.SaslException
private byte[] hmac(byte[] bytes, java.lang.String key) throws javax.security.sasl.SaslException
javax.security.sasl.SaslException
private java.util.HashMap<java.lang.String,java.lang.String> parseServerResponse(java.lang.String response)
private java.lang.String prepUserName(java.lang.String userName)
private byte[] xor(byte[] a, byte[] b)