Commit Graph

4 Commits

Author SHA1 Message Date
Dave Cridland 9c772add93 SASL Proxy Auth support
This adds the ability to provide a distinct authorization identifier for use
by SASL mechanisms. Not all SASL mechanisms support this operation, in
particular CRAM-MD5.

Both the javax and provided SASL implementations are extended, and an authzid
parameter added to the authenticate method.

The authorization identifier is passed as a EntityBareJid in order to assure the
correct form.

Resolves SMACK-677.

Minor-Modifications-By: Florian Schmaus <flo@geekplace.eu>
2015-09-21 20:39:23 +02:00
Florian Schmaus 7aa784a494 SCRAM-SHA1: Always calculate serverSignature
Otherwise we may get an NPE if the key was cached:

Connection closed with error java.lang.NullPointerException: Attempt to get length of null array
	at org.jivesoftware.smack.util.stringencoder.Base64.encodeToString(Base64.java:43)
	at org.jivesoftware.smack.sasl.core.SCRAMSHA1Mechanism.evaluateChallenge(SCRAMSHA1Mechanism.java:201)
	at org.jivesoftware.smack.sasl.SASLMechanism.challengeReceived(SASLMechanism.java:230)
 	at org.jivesoftware.smack.SASLAuthentication.challengeReceived(SASLAuthentication.java:328)
 	at org.jivesoftware.smack.SASLAuthentication.authenticated(SASLAuthentication.java:347)
 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:894)
 	at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:909)
 	at java.lang.Thread.run(Thread.java:818)
2015-01-26 07:54:13 +01:00
Florian Schmaus fe3dcba9b2 Fix javadoc warnings and deprecated methods 2014-11-02 12:12:56 +01:00
Florian Schmaus 403ecff2b2 Add SCRAM-SHA1 support
Thanks to Stefan Karlsson for helping with the implementation.

Also add SASLMechanism.checkIfSuccessfulOrThrow(), to increase the
security by verifying the mechanisms state at the end of SASL
authentication.

SASLMechanism now has a SASLPrep StringTransformer.

Refactor SHA1 functions out of StringUtils into SHA1 utility class.

Add MAC utility class.

Make DummyConnection getSentpacket() methods use generics to make unit
testing SCRAM-SHA1 easier.

Fixes SMACK-398
2014-10-21 15:03:48 +02:00