@Override public byte[] wrap(byte[] data, int offset, int len) throws IOException { return server.wrap(data, offset, len); }
public byte[] wrap(byte[] buf, int off, int len) throws SaslException { return saslServer.wrap(buf, off, len); }
public byte[] wrap(final byte[] outgoing, final int offset, final int len) throws SaslException { return saslServer.wrap(outgoing, offset, len); }
public byte[] wrap(final byte[] bytes, final int off, final int len) throws SaslException { return saslServer.wrap(bytes, off, len); }
@Override public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException { return server.wrap(outgoing, offset, len); }
public byte[] wrap(final byte[] outgoing, final int offset, final int len) throws SaslException { return delegate.wrap(outgoing, offset, len); }
public byte[] wrap(final byte[] outgoing, final int offset, final int len) throws SaslException { try { return doPrivileged((PrivilegedExceptionAction<byte[]>) () -> delegate.wrap(outgoing, offset, len), accessControlContext); } catch (PrivilegedActionException pae) { try { throw pae.getCause(); } catch (SaslException | RuntimeException | Error e) { throw e; } catch (Throwable throwable) { throw new UndeclaredThrowableException(throwable); } } } }
public byte[] wrap(byte[] buf, int start, int len) throws SaslException { if (client != null) return client.wrap(buf, start, len); else return server.wrap(buf, start, len); }
/** * Wrap a message. Wrapping occurs from the source buffer to the destination idea. * <p> * The {@code source} buffer should have its position and remaining length set to encompass exactly one SASL * message (without the length field). The SASL message itself does not encode any length information so it is up * to the protocol implementer to ensure that the message is properly framed. * * @param server the SASL server to wrap with * @param source the buffers from which bytes should be read * @return the wrap result * @throws SaslException if a SASL error occurs * @see SaslServer#wrap(byte[], int, int) */ public static byte[] wrap(final SaslServer server, final ByteBuffer source) throws SaslException { final byte[] result; final int len = source.remaining(); if (len == 0) { result = server.wrap(EMPTY_BYTES, 0, len); } else if (source.hasArray()) { final byte[] array = source.array(); final int offs = source.arrayOffset(); source.position(source.position() + len); result = server.wrap(array, offs, len); } else { result = server.wrap(Buffers.take(source, len), 0, len); } return result; }
saslToken = saslServer.wrap(inBuf, off, len); } else { // using saslClient saslToken = saslClient.wrap(inBuf, off, len);
private void wrapWithSasl(RpcCall call) throws IOException { if (call.connection.saslServer != null) { byte[] token = call.rpcResponse.array(); // synchronization may be needed since there can be multiple Handler // threads using saslServer to wrap responses. synchronized (call.connection.saslServer) { token = call.connection.saslServer.wrap(token, 0, token.length); } if (LOG.isDebugEnabled()) LOG.debug("Adding saslServer wrapped token of size " + token.length + " as call response."); // rebuild with sasl header and payload RpcResponseHeaderProto saslHeader = RpcResponseHeaderProto.newBuilder() .setCallId(AuthProtocol.SASL.callId) .setStatus(RpcStatusProto.SUCCESS) .build(); RpcSaslProto saslMessage = RpcSaslProto.newBuilder() .setState(SaslState.WRAP) .setToken(ByteString.copyFrom(token)) .build(); setupResponse(call, saslHeader, RpcWritable.wrap(saslMessage)); } }
public byte[] wrap(byte[] buf, int off, int len) throws SaslException { if (saslClient != null) return saslClient.wrap(buf, off, len); else return saslServer.wrap(buf, off, len); }
@Override public byte[] run() throws SaslException { return wrapped.wrap(outgoing, offset, len); } });
@Override public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException { return server.wrap(outgoing, offset, len); }
@Override public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException { return server.wrap(outgoing, offset, len); }
public byte[] wrap(byte[] buf, int start, int len) throws SaslException { if (client != null) return client.wrap(buf, start, len); else return server.wrap(buf, start, len); }
public byte[] wrap(byte[] buf, int off, int len) throws SaslException { if (saslClient != null) return saslClient.wrap(buf, off, len); else return saslServer.wrap(buf, off, len); }
public byte[] wrap(byte[] buf, int off, int len) throws SaslException { if (saslClient != null) return saslClient.wrap(buf, off, len); else return saslServer.wrap(buf, off, len); }
@Override public byte[] wrap(byte[] data, int offset, int len) throws SaslException { checkState(saslServer != null); return saslServer.wrap(data, offset, len); }
public byte[] wrap(byte[] buf, int off, int len) throws SaslException { if (saslClient != null) return saslClient.wrap(buf, off, len); else return saslServer.wrap(buf, off, len); }