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

Allow access to peer identity in a gRPC Server Interceptor #85

Closed
wants to merge 1 commit into from

Conversation

jen20
Copy link
Contributor

@jen20 jen20 commented Oct 22, 2019

This is an initial work in progress of a mechanism to access the TLS identity of the client in a server interceptor.

.identity(server_identity)
.client_ca_root(client_ca_cert)
.clone();

Server::builder()
.tls_config(&tls)
.interceptor_fn(|svc, req| {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really wonder if it makes sense to change this to wrap request

intercetptor_req_fn(|req| {
	// do something to req
	Some(req)
	// or to cancel the request
	None
})

tonic/Cargo.toml Outdated
@@ -75,6 +75,9 @@ openssl1 = { package = "openssl", version = "0.10", optional = true }
# rustls
tokio-rustls = { version = "=0.12.0-alpha.4", optional = true }

# tls (general)
x509-parser = "0.6"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably want to make this optional?

@@ -351,7 +352,7 @@ impl Stream for TcpIncoming {
}

#[derive(Debug)]
struct Svc<S>(S);
struct Svc<S>(S, Option<String>);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets make this a real struct with like names for things 😄

}

/// IO structure used by GRPC clients
pub(crate) struct ClientIo(Pin<Box<dyn Io>>);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use a general IO type so we don't have to add this?

Copy link
Member

@LucioFranco LucioFranco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've got the right idea here! Looking great

@jen20 jen20 force-pushed the jen20/tls-identity-in-request branch from 744ed40 to 24de805 Compare November 10, 2019 16:39
@LucioFranco LucioFranco added this to the 0.1 milestone Jan 11, 2020
@LucioFranco
Copy link
Member

Closing this in favor of #228

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants