-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Conversation
.identity(server_identity) | ||
.client_ca_root(client_ca_cert) | ||
.clone(); | ||
|
||
Server::builder() | ||
.tls_config(&tls) | ||
.interceptor_fn(|svc, req| { |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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?
tonic/src/transport/server.rs
Outdated
@@ -351,7 +352,7 @@ impl Stream for TcpIncoming { | |||
} | |||
|
|||
#[derive(Debug)] | |||
struct Svc<S>(S); | |||
struct Svc<S>(S, Option<String>); |
There was a problem hiding this comment.
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>>); |
There was a problem hiding this comment.
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?
There was a problem hiding this 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
744ed40
to
24de805
Compare
Closing this in favor of #228 |
This is an initial work in progress of a mechanism to access the TLS identity of the client in a server interceptor.