diff options
Diffstat (limited to 'src/main/java/eu/siacs/conversations/crypto/sasl/SaslMechanism.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/sasl/SaslMechanism.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/sasl/SaslMechanism.java b/src/main/java/eu/siacs/conversations/crypto/sasl/SaslMechanism.java index 38a03c187..7dd5e99c3 100644 --- a/src/main/java/eu/siacs/conversations/crypto/sasl/SaslMechanism.java +++ b/src/main/java/eu/siacs/conversations/crypto/sasl/SaslMechanism.java @@ -11,6 +11,33 @@ public abstract class SaslMechanism { final protected Account account; final protected SecureRandom rng; + protected static enum State { + INITIAL, + AUTH_TEXT_SENT, + RESPONSE_SENT, + VALID_SERVER_RESPONSE, + } + + public static class AuthenticationException extends Exception { + public AuthenticationException(final String message) { + super(message); + } + + public AuthenticationException(final Exception inner) { + super(inner); + } + } + + public static class InvalidStateException extends AuthenticationException { + public InvalidStateException(final String message) { + super(message); + } + + public InvalidStateException(final State state) { + this("Invalid state: " + state.toString()); + } + } + public SaslMechanism(final TagWriter tagWriter, final Account account, final SecureRandom rng) { this.tagWriter = tagWriter; this.account = account; |