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 SSLCert/Context from within handler #627

Closed
gnunicorn opened this issue Aug 10, 2015 · 3 comments · Fixed by #631
Closed

Allow access to SSLCert/Context from within handler #627

gnunicorn opened this issue Aug 10, 2015 · 3 comments · Fixed by #631
Assignees

Comments

@gnunicorn
Copy link

I am currently trying to implement a basic SSL mutual authentication mechanism using hyper. Through using openssl and making my own SSLContext I am already able to require the client to send a certificate and reject as the server seems appropriate. But within the SSL-verify callback I can't alter the context of request. So, in order to be able to not only have a yes-no but an actual "this certificate belongs to that user", I'd need support to access the ssl certificate/context from within the handler so the application code can decide based on that, but that seems impossible at the moment as they are encapsulated away.

I can provide my code if anyone cares and if someone tells me, what changes would be accepted as a PR would also be willing to make the changes myself. Unless I have missed some way to make that happen.

@seanmonstar
Copy link
Member

To be sure, you need to check the SslContext from within Handler::handle?

@gnunicorn
Copy link
Author

@seanmonstar, Unless you have any other idea, how I could figure out from the handler, what the SSLCert send by the client is... Yes.

@seanmonstar
Copy link
Member

I'm guessing you want to access http://sfackler.github.io/rust-openssl/doc/v0.6.4/openssl/ssl/struct.SslStream.html#method.get_peer_certificate

Perhaps adding a downcast_ref sort of function to Request, so that you could get a &SslStream (assuming you're using openssl).

pub fn downcast_ref<T: NetworkStream>(&self) -> Option<&T> {

}

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 a pull request may close this issue.

2 participants