Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Revert "Switching from UNAUTHENTICATED to UNAVAILABLE for auth metadata failure"" #13363

Merged
merged 2 commits into from
Jan 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/lib/security/transport/client_auth_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static void on_credentials_metadata(void* arg, grpc_error* input_error) {
grpc_call_next_op(elem, batch);
} else {
error = grpc_error_set_int(error, GRPC_ERROR_INT_GRPC_STATUS,
GRPC_STATUS_UNAUTHENTICATED);
GRPC_STATUS_UNAVAILABLE);
grpc_transport_stream_op_batch_finish_with_failure(batch, error,
calld->call_combiner);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public void MetadataCredentials_InterceptorThrows()
client = new TestService.TestServiceClient(channel);

var ex = Assert.Throws<RpcException>(() => client.UnaryCall(new SimpleRequest { }));
Assert.AreEqual(StatusCode.Unauthenticated, ex.Status.StatusCode);
Assert.AreEqual(StatusCode.Unavailable, ex.Status.StatusCode);
}

private class FakeTestService : TestService.TestServiceBase
Expand Down
4 changes: 2 additions & 2 deletions src/php/tests/unit_tests/CallCredentials2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function testCallbackWithInvalidKey()

$this->assertTrue($event->send_metadata);
$this->assertTrue($event->send_close);
$this->assertTrue($event->status->code == Grpc\STATUS_UNAUTHENTICATED);
$this->assertTrue($event->status->code == Grpc\STATUS_UNAVAILABLE);
}

public function invalidReturnCallbackFunc($context)
Expand Down Expand Up @@ -179,6 +179,6 @@ public function testCallbackWithInvalidReturnValue()

$this->assertTrue($event->send_metadata);
$this->assertTrue($event->send_close);
$this->assertTrue($event->status->code == Grpc\STATUS_UNAUTHENTICATED);
$this->assertTrue($event->status->code == Grpc\STATUS_UNAVAILABLE);
}
}
4 changes: 2 additions & 2 deletions src/ruby/spec/generic/client_stub_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def metadata_test(md)
th.join
end

it 'should receive UNAUTHENTICATED if call credentials plugin fails' do
it 'should receive UNAVAILABLE if call credentials plugin fails' do
server_port = create_secure_test_server
th = run_request_response(@sent_msg, @resp, @pass)

Expand All @@ -252,7 +252,7 @@ def metadata_test(md)
unauth_error_occured = false
begin
get_response(stub, credentials: creds)
rescue GRPC::Unauthenticated => e
rescue GRPC::Unavailable => e
unauth_error_occured = true
expect(e.details.include?(error_message)).to be true
end
Expand Down
8 changes: 4 additions & 4 deletions test/cpp/end2end/end2end_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,7 @@ TEST_P(SecureEnd2endTest, AuthMetadataPluginKeyFailure) {

Status s = stub_->Echo(&context, request, &response);
EXPECT_FALSE(s.ok());
EXPECT_EQ(s.error_code(), StatusCode::UNAUTHENTICATED);
EXPECT_EQ(s.error_code(), StatusCode::UNAVAILABLE);
}

TEST_P(SecureEnd2endTest, AuthMetadataPluginValueFailure) {
Expand All @@ -1626,7 +1626,7 @@ TEST_P(SecureEnd2endTest, AuthMetadataPluginValueFailure) {

Status s = stub_->Echo(&context, request, &response);
EXPECT_FALSE(s.ok());
EXPECT_EQ(s.error_code(), StatusCode::UNAUTHENTICATED);
EXPECT_EQ(s.error_code(), StatusCode::UNAVAILABLE);
}

TEST_P(SecureEnd2endTest, NonBlockingAuthMetadataPluginFailure) {
Expand All @@ -1644,7 +1644,7 @@ TEST_P(SecureEnd2endTest, NonBlockingAuthMetadataPluginFailure) {

Status s = stub_->Echo(&context, request, &response);
EXPECT_FALSE(s.ok());
EXPECT_EQ(s.error_code(), StatusCode::UNAUTHENTICATED);
EXPECT_EQ(s.error_code(), StatusCode::UNAVAILABLE);
EXPECT_EQ(s.error_message(),
grpc::string("Getting metadata from plugin failed with error: ") +
kTestCredsPluginErrorMsg);
Expand Down Expand Up @@ -1705,7 +1705,7 @@ TEST_P(SecureEnd2endTest, BlockingAuthMetadataPluginFailure) {

Status s = stub_->Echo(&context, request, &response);
EXPECT_FALSE(s.ok());
EXPECT_EQ(s.error_code(), StatusCode::UNAUTHENTICATED);
EXPECT_EQ(s.error_code(), StatusCode::UNAVAILABLE);
EXPECT_EQ(s.error_message(),
grpc::string("Getting metadata from plugin failed with error: ") +
kTestCredsPluginErrorMsg);
Expand Down