@Override protected byte[] evaluateMessage(int state, final byte[] message) throws SaslException { switch (state) { case INITIAL_STATE: int length = message.length; if (length == 0) { // need initial challenge return NO_BYTES; } else { // sanity check if (length > 1020) { throw saslAnonymous.mechAuthenticationNameTooLong().toSaslException(); } String name = new String(message, StandardCharsets.UTF_8); if (name.length() > 255) { throw saslAnonymous.mechAuthenticationNameTooLong().toSaslException(); } final AnonymousAuthorizationCallback callback = new AnonymousAuthorizationCallback(name); handleCallbacks(callback); if (! callback.isAuthorized()) { throw saslAnonymous.mechAnonymousAuthorizationDenied().toSaslException(); } negotiationComplete(); return null; } } throw Assert.impossibleSwitchCase(state); } }
@Override protected byte[] evaluateMessage(int state, final byte[] message) throws SaslException { switch (state) { case INITIAL_STATE: int length = message.length; if (length == 0) { // need initial challenge return NO_BYTES; } else { // sanity check if (length > 1020) { throw saslAnonymous.mechAuthenticationNameTooLong().toSaslException(); } String name = new String(message, StandardCharsets.UTF_8); if (name.length() > 255) { throw saslAnonymous.mechAuthenticationNameTooLong().toSaslException(); } final AnonymousAuthorizationCallback callback = new AnonymousAuthorizationCallback(name); handleCallbacks(callback); if (! callback.isAuthorized()) { throw saslAnonymous.mechAnonymousAuthorizationDenied().toSaslException(); } negotiationComplete(); return null; } } throw Assert.impossibleSwitchCase(state); } }
@Override protected byte[] evaluateMessage(int state, final byte[] message) throws SaslException { switch (state) { case INITIAL_STATE: int length = message.length; if (length == 0) { // need initial challenge return NO_BYTES; } else { // sanity check if (length > 1020) { throw saslAnonymous.mechAuthenticationNameTooLong().toSaslException(); } String name = new String(message, StandardCharsets.UTF_8); if (name.length() > 255) { throw saslAnonymous.mechAuthenticationNameTooLong().toSaslException(); } final AnonymousAuthorizationCallback callback = new AnonymousAuthorizationCallback(name); handleCallbacks(callback); if (! callback.isAuthorized()) { throw saslAnonymous.mechAnonymousAuthorizationDenied().toSaslException(); } negotiationComplete(); return null; } } throw Assert.impossibleSwitchCase(state); } }
@Override protected byte[] evaluateMessage(int state, final byte[] message) throws SaslException { switch (state) { case INITIAL_STATE: int length = message.length; if (length == 0) { // need initial challenge return NO_BYTES; } else { // sanity check if (length > 1020) { throw saslAnonymous.mechAuthenticationNameTooLong().toSaslException(); } String name = new String(message, StandardCharsets.UTF_8); if (name.length() > 255) { throw saslAnonymous.mechAuthenticationNameTooLong().toSaslException(); } final AnonymousAuthorizationCallback callback = new AnonymousAuthorizationCallback(name); handleCallbacks(callback); if (! callback.isAuthorized()) { throw saslAnonymous.mechAnonymousAuthorizationDenied().toSaslException(); } negotiationComplete(); return null; } } throw Assert.impossibleSwitchCase(state); } }