security - Can a rails controller request mutual SSL authentication? -


force_ssl can used on rails controller request ssl. there way controller request mutual authentication, , if yes, how can controller, request context, discover certificate presented client during ssl/tls handshake?

you can access client certificate using request.cgi

certificate = request.cgi.env_table['ssl_client_cert'].gsub(/(\n|-----(begin|end) certificate-----)/, ''); 

now can find user based on certificate.

see http://www.scatmania.org/projects/ssl-client-certificate-authentication-in-ruby-on-rails/ further information.

i not sure if works if using specific server(apache w. passenger e.g.).

edit:

http://www.modssl.org/docs/2.8/ssl_reference.html#toc24 might useful too.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -