/** * Get a property negotiated between this participant and the other. * * @param propName the property name * @return the property value or {@code null} if not defined */ public Object getNegotiatedProperty(final String propName) { assertComplete(); return null; }
protected byte[] evaluateMessage(final byte[] message) throws SaslException { boolean ok = false; try { if (state == COMPLETE_STATE) { throw log.mechMessageAfterComplete().toSaslException(); } else if (state == FAILED_STATE) { throw log.mechAuthenticationFailed().toSaslException(); } byte[] result = evaluateMessage(state, message); ok = true; return result; } finally { if (! ok) { state = FAILED_STATE; } } }
/** * A convenience method to throw a {@link IllegalStateException} is authentication is not yet complete. * * To be called by methods that must only be called after authentication is complete. */ protected void assertComplete() { if (isComplete() == false) { throw log.mechAuthenticationNotComplete(); } }
/** * Handle callbacks, wrapping exceptions as needed (including unsupported callbacks). * * @param callbacks the callbacks to handle * @throws SaslException if a callback failed */ protected void handleCallbacks(Callback... callbacks) throws SaslException { try { tryHandleCallbacks(callbacks); } catch (UnsupportedCallbackException e) { throw log.mechCallbackHandlerFailedForUnknownReason(e).toSaslException(); } }
/** * Handle callbacks, wrapping exceptions as needed (including unsupported callbacks). * * @param callbacks the callbacks to handle * @throws SaslException if a callback failed */ protected void handleCallbacks(Callback... callbacks) throws SaslException { try { tryHandleCallbacks(callbacks); } catch (UnsupportedCallbackException e) { throw log.mechCallbackHandlerFailedForUnknownReason(e).toSaslException(); } }
/** * Wraps a byte array to be sent to the other participant. * * @param outgoing a non-{@code null} byte array containing the bytes to encode * @param offset the first byte to encode * @param len the number of bytes to use * @return A non-{@code null} byte array containing the encoded bytes * @exception SaslException if wrapping fails * @exception IllegalStateException if wrapping is not configured */ public byte[] wrap(final byte[] outgoing, final int offset, final int len) throws SaslException { if (isComplete() == false) throw log.mechAuthenticationNotComplete(); SaslWrapper wrapper = this.wrapper; if (wrapper == null) { throw log.wrappingNotConfigured(); } if(len == 0) { return NO_BYTES; } return wrapper.wrap(outgoing, offset, len); }
/** * Handle callbacks, wrapping exceptions as needed (including unsupported callbacks). * * @param callbacks the callbacks to handle * @throws SaslException if a callback failed */ protected void handleCallbacks(Callback... callbacks) throws SaslException { try { tryHandleCallbacks(callbacks); } catch (UnsupportedCallbackException e) { throw log.mechCallbackHandlerFailedForUnknownReason(e).toSaslException(); } }
/** * Get a property negotiated between this participant and the other. * * @param propName the property name * @return the property value or {@code null} if not defined */ public Object getNegotiatedProperty(final String propName) { assertComplete(); return null; }
protected byte[] evaluateMessage(final byte[] message) throws SaslException { boolean ok = false; try { if (state == COMPLETE_STATE) { throw log.mechMessageAfterComplete().toSaslException(); } else if (state == FAILED_STATE) { throw log.mechAuthenticationFailed().toSaslException(); } byte[] result = evaluateMessage(state, message); ok = true; return result; } finally { if (! ok) { state = FAILED_STATE; } } }
/** * Unwraps a byte array received from the other participant. * * @param incoming a non-{@code null} byte array containing the bytes to decode * @param offset the first byte to decode * @param len the number of bytes to use * @return A non-{@code null} byte array containing the decoded bytes * @exception SaslException if wrapping fails * @exception IllegalStateException if wrapping is not configured */ public byte[] unwrap(final byte[] incoming, final int offset, final int len) throws SaslException { if (isComplete() == false) throw log.mechAuthenticationNotComplete(); SaslWrapper wrapper = this.wrapper; if (wrapper == null) { throw log.wrappingNotConfigured(); } if(len == 0) { return NO_BYTES; } return wrapper.unwrap(incoming, offset, len); }
/** * Handle callbacks, wrapping exceptions as needed (including unsupported callbacks). * * @param callbacks the callbacks to handle * @throws SaslException if a callback failed */ protected void handleCallbacks(Callback... callbacks) throws SaslException { try { tryHandleCallbacks(callbacks); } catch (UnsupportedCallbackException e) { throw log != null ? log.mechCallbackHandlerFailedForUnknownReason(e).toSaslException() : legacyLog.mechCallbackHandlerFailedForUnknownReason(e).toSaslException(); } }
/** * Get a property negotiated between this participant and the other. * * @param propName the property name * @return the property value or {@code null} if not defined */ public Object getNegotiatedProperty(final String propName) { assertComplete(); return null; }
protected byte[] evaluateMessage(final byte[] message) throws SaslException { boolean ok = false; try { if (state == COMPLETE_STATE) { throw log.mechMessageAfterComplete().toSaslException(); } else if (state == FAILED_STATE) { throw log.mechAuthenticationFailed().toSaslException(); } byte[] result = evaluateMessage(state, message); ok = true; return result; } finally { if (! ok) { state = FAILED_STATE; } } }
/** * A convenience method to throw a {@link IllegalStateException} is authentication is not yet complete. * * To be called by methods that must only be called after authentication is complete. */ protected void assertComplete() { if (isComplete() == false) { throw log.mechAuthenticationNotComplete(); } }
/** * Get a property negotiated between this participant and the other. * * @param propName the property name * @return the property value or {@code null} if not defined */ public Object getNegotiatedProperty(final String propName) { assertComplete(); return null; }
protected byte[] evaluateMessage(final byte[] message) throws SaslException { boolean ok = false; try { if (state == COMPLETE_STATE) { throw log != null ? log.mechMessageAfterComplete().toSaslException() : legacyLog.mechMessageAfterComplete().toSaslException(); } else if (state == FAILED_STATE) { throw log != null ? log.mechAuthenticationFailed().toSaslException() : legacyLog.mechAuthenticationFailed().toSaslException(); } byte[] result = evaluateMessage(state, message); ok = true; return result; } finally { if (! ok) { state = FAILED_STATE; } } }
/** * A convenience method to throw a {@link IllegalStateException} is authentication is not yet complete. * * To be called by methods that must only be called after authentication is complete. */ protected void assertComplete() { if (isComplete() == false) { throw log.mechAuthenticationNotComplete(); } }
/** * A convenience method to throw a {@link IllegalStateException} is authentication is not yet complete. * * To be called by methods that must only be called after authentication is complete. */ protected void assertComplete() { if (isComplete() == false) { throw log.mechAuthenticationNotComplete(); } }
/** * Unwraps a byte array received from the other participant. * * @param incoming a non-{@code null} byte array containing the bytes to decode * @param offset the first byte to decode * @param len the number of bytes to use * @return A non-{@code null} byte array containing the decoded bytes * @exception SaslException if wrapping fails * @exception IllegalStateException if wrapping is not configured */ public byte[] unwrap(final byte[] incoming, final int offset, final int len) throws SaslException { if (isComplete() == false) throw log.mechAuthenticationNotComplete(); SaslWrapper wrapper = this.wrapper; if (wrapper == null) { throw log.wrappingNotConfigured(); } if(len == 0) { return NO_BYTES; } return wrapper.unwrap(incoming, offset, len); }
/** * Unwraps a byte array received from the other participant. * * @param incoming a non-{@code null} byte array containing the bytes to decode * @param offset the first byte to decode * @param len the number of bytes to use * @return A non-{@code null} byte array containing the decoded bytes * @exception SaslException if wrapping fails * @exception IllegalStateException if wrapping is not configured */ public byte[] unwrap(final byte[] incoming, final int offset, final int len) throws SaslException { if (isComplete() == false) throw log.mechAuthenticationNotComplete(); SaslWrapper wrapper = this.wrapper; if (wrapper == null) { throw log.wrappingNotConfigured(); } if(len == 0) { return NO_BYTES; } return wrapper.unwrap(incoming, offset, len); }