/** * Process the Sasl's Negotiate request, including the optimization of * accelerating token negotiation. * @return the response to Negotiate request - the list of enabled * authMethods and challenge if the TOKENS are supported. * @throws SaslException - if attempt to generate challenge fails. * @throws IOException - if it fails to create the SASL server for Tokens */ private RpcSaslProto buildSaslNegotiateResponse() throws InterruptedException, SaslException, IOException { RpcSaslProto negotiateMessage = negotiateResponse; // accelerate token negotiation by sending initial challenge // in the negotiation response if (enabledAuthMethods.contains(AuthMethod.TOKEN)) { saslServer = createSaslServer(AuthMethod.TOKEN); byte[] challenge = saslServer.evaluateResponse(new byte[0]); RpcSaslProto.Builder negotiateBuilder = RpcSaslProto.newBuilder(negotiateResponse); negotiateBuilder.getAuthsBuilder(0) // TOKEN is always first .setChallenge(ByteString.copyFrom(challenge)); negotiateMessage = negotiateBuilder.build(); } sentNegotiate = true; return negotiateMessage; }
saslServer = createSaslServer(authMethod);
private RpcSaslProto buildSaslNegotiateResponse() throws IOException, InterruptedException { RpcSaslProto negotiateMessage = negotiateResponse; // accelerate token negotiation by sending initial challenge // in the negotiation response if (enabledAuthMethods.contains(AuthMethod.TOKEN)) { saslServer = createSaslServer(AuthMethod.TOKEN); byte[] challenge = saslServer.evaluateResponse(new byte[0]); RpcSaslProto.Builder negotiateBuilder = RpcSaslProto.newBuilder(negotiateResponse); negotiateBuilder.getAuthsBuilder(0) // TOKEN is always first .setChallenge(ByteString.copyFrom(challenge)); negotiateMessage = negotiateBuilder.build(); } sentNegotiate = true; return negotiateMessage; }
saslServer = createSaslServer(authMethod);
saslServer = createSaslServer(authMethod);
saslServer = createSaslServer(authMethod);
saslServer = createSaslServer(authMethod);
private RpcSaslProto buildSaslNegotiateResponse() throws IOException, InterruptedException { RpcSaslProto negotiateMessage = negotiateResponse; // accelerate token negotiation by sending initial challenge // in the negotiation response if (enabledAuthMethods.contains(AuthMethod.TOKEN)) { saslServer = createSaslServer(AuthMethod.TOKEN); byte[] challenge = saslServer.evaluateResponse(new byte[0]); RpcSaslProto.Builder negotiateBuilder = RpcSaslProto.newBuilder(negotiateResponse); negotiateBuilder.getAuthsBuilder(0) // TOKEN is always first .setChallenge(ByteString.copyFrom(challenge)); negotiateMessage = negotiateBuilder.build(); } sentNegotiate = true; return negotiateMessage; }
private RpcSaslProto buildSaslNegotiateResponse() throws IOException, InterruptedException { RpcSaslProto negotiateMessage = negotiateResponse; // accelerate token negotiation by sending initial challenge // in the negotiation response if (enabledAuthMethods.contains(AuthMethod.TOKEN)) { saslServer = createSaslServer(AuthMethod.TOKEN); byte[] challenge = saslServer.evaluateResponse(new byte[0]); RpcSaslProto.Builder negotiateBuilder = RpcSaslProto.newBuilder(negotiateResponse); negotiateBuilder.getAuthsBuilder(0) // TOKEN is always first .setChallenge(ByteString.copyFrom(challenge)); negotiateMessage = negotiateBuilder.build(); } sentNegotiate = true; return negotiateMessage; }
private RpcSaslProto buildSaslNegotiateResponse() throws IOException, InterruptedException { RpcSaslProto negotiateMessage = negotiateResponse; // accelerate token negotiation by sending initial challenge // in the negotiation response if (enabledAuthMethods.contains(AuthMethod.TOKEN)) { saslServer = createSaslServer(AuthMethod.TOKEN); byte[] challenge = saslServer.evaluateResponse(new byte[0]); RpcSaslProto.Builder negotiateBuilder = RpcSaslProto.newBuilder(negotiateResponse); negotiateBuilder.getAuthsBuilder(0) // TOKEN is always first .setChallenge(ByteString.copyFrom(challenge)); negotiateMessage = negotiateBuilder.build(); } sentNegotiate = true; return negotiateMessage; }