@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); } }
boolean authorized = authorizeAnonymous(); log.tracef("Handling AnonymousAuthorizationCallback: authorized = %b", authorized); ((AnonymousAuthorizationCallback) callback).setAuthorized(authorized); handleOne(callbacks, idx + 1); } else if (callback instanceof AuthorizeCallback) {
boolean authorized = authorizeAnonymous(); log.tracef("Handling AnonymousAuthorizationCallback: authorized = %b", authorized); ((AnonymousAuthorizationCallback) callback).setAuthorized(authorized); handleOne(callbacks, idx + 1); } else if (callback instanceof AuthorizeCallback) {
@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); } }
boolean authorized = authorizeAnonymous(); log.tracef("Handling AnonymousAuthorizationCallback: authorized = %b", authorized); ((AnonymousAuthorizationCallback) callback).setAuthorized(authorized); handleOne(callbacks, idx + 1); } else if (callback instanceof AuthorizeCallback) {
@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); } }
boolean authorized = authorizeAnonymous(); log.tracef("Handling AnonymousAuthorizationCallback: authorized = %b", authorized); ((AnonymousAuthorizationCallback) callback).setAuthorized(authorized); handleOne(callbacks, idx + 1); } else if (callback instanceof AuthorizeCallback) {
@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); } }