private static class ScramSha1Authenticator.ScramSha1SaslClient
extends java.lang.Object
implements javax.security.sasl.SaslClient
| Modifier and Type | Field and Description |
|---|---|
private Base64Codec |
base64Codec |
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 Base64Codec base64Codec
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.SaslClientpublic boolean hasInitialResponse()
hasInitialResponse in interface javax.security.sasl.SaslClientpublic byte[] evaluateChallenge(byte[] challenge)
throws javax.security.sasl.SaslException
evaluateChallenge in interface javax.security.sasl.SaslClientjavax.security.sasl.SaslExceptionpublic boolean isComplete()
isComplete in interface javax.security.sasl.SaslClientpublic byte[] unwrap(byte[] incoming,
int offset,
int len)
throws javax.security.sasl.SaslException
unwrap in interface javax.security.sasl.SaslClientjavax.security.sasl.SaslExceptionpublic byte[] wrap(byte[] outgoing,
int offset,
int len)
throws javax.security.sasl.SaslException
wrap in interface javax.security.sasl.SaslClientjavax.security.sasl.SaslExceptionpublic java.lang.Object getNegotiatedProperty(java.lang.String propName)
getNegotiatedProperty in interface javax.security.sasl.SaslClientpublic void dispose()
throws javax.security.sasl.SaslException
dispose in interface javax.security.sasl.SaslClientjavax.security.sasl.SaslExceptionprivate byte[] computeClientFirstMessage()
throws javax.security.sasl.SaslException
javax.security.sasl.SaslExceptionprivate byte[] computeClientFinalMessage(byte[] challenge)
throws javax.security.sasl.SaslException
javax.security.sasl.SaslExceptionprivate byte[] decodeBase64(java.lang.String str)
private byte[] decodeUTF8(java.lang.String str)
throws javax.security.sasl.SaslException
javax.security.sasl.SaslExceptionprivate java.lang.String encodeBase64(byte[] bytes)
private java.lang.String encodeUTF8(byte[] bytes)
throws javax.security.sasl.SaslException
javax.security.sasl.SaslExceptionprivate byte[] h(byte[] data)
throws javax.security.sasl.SaslException
javax.security.sasl.SaslExceptionprivate byte[] hi(java.lang.String password,
byte[] salt,
int iterations)
throws javax.security.sasl.SaslException
javax.security.sasl.SaslExceptionprivate byte[] hmac(byte[] bytes,
java.lang.String key)
throws javax.security.sasl.SaslException
javax.security.sasl.SaslExceptionprivate 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)