Add additional reasons to HandshakeRejection

This commit is contained in:
Kai S. K. Engelbart 2020-06-23 08:23:40 +02:00
parent 434d364d79
commit 416ce21d42

View File

@ -2,8 +2,8 @@ package envoy.event;
/** /**
* Signifies to the client that the handshake failed for the attached * Signifies to the client that the handshake failed for the attached
* reason.<br> * reason.
* <br> * <p>
* Project: <strong>envoy-common</strong><br> * Project: <strong>envoy-common</strong><br>
* File: <strong>HandshakeRejection.java</strong><br> * File: <strong>HandshakeRejection.java</strong><br>
* Created: <strong>28 Jan 2020</strong><br> * Created: <strong>28 Jan 2020</strong><br>
@ -14,23 +14,44 @@ package envoy.event;
public class HandshakeRejection extends Event<String> { public class HandshakeRejection extends Event<String> {
/** /**
* Select this value if a given password hash or user was incorrect. * Select this value if a given password hash or user name was incorrect.
*
* @since Envoy Common v0.3-alpha
*/ */
public static final String WRONG_PASSWORD_OR_USER = "Incorrect user name or password."; public static final String WRONG_PASSWORD_OR_USER = "Incorrect user name or password.";
/** /**
* Select this value if the handshake could not be completed for some reason. * Select this value if a given user name for a registration is already taken.
*
* @since Envoy Common v0.1-beta
*/
public static final String USERNAME_TAKEN = "Incorrect user name or password.";
/**
* Select this value if the version of the client is incompatible with the
* server.
*
* @since Envoy Common v0.1-beta
*/
public static final String WRONG_VERSION = "Incompatible client version";
/**
* Select this value if the handshake could not be completed for some different
* reason.
*
* @since Envoy Common v0.3-alpha
*/ */
public static final String INTERNAL_ERROR = "An internal error occured."; public static final String INTERNAL_ERROR = "An internal error occured.";
private static final long serialVersionUID = 0L; private static final long serialVersionUID = 0L;
/** /**
* Creates an instance of {@link HandshakeRejection} with an empty reason. * Creates an instance of {@link HandshakeRejection} with the generic
* {@link HandshakeRejection#INTERNAL_ERROR} reason.
* *
* @since Envoy Common v0.3-alpha * @since Envoy Common v0.3-alpha
*/ */
public HandshakeRejection() { super(""); } public HandshakeRejection() { super(INTERNAL_ERROR); }
/** /**
* Creates an instance of {@link HandshakeRejection}. * Creates an instance of {@link HandshakeRejection}.