Skip to content

Instantly share code, notes, and snippets.

@gpr
Created November 4, 2013 08:30
Show Gist options
  • Save gpr/7299707 to your computer and use it in GitHub Desktop.
Save gpr/7299707 to your computer and use it in GitHub Desktop.
How to get email from X509 certificate used for client authentication. The email could be used for setting the current user in Devise or Omniauth (considering that the user has been authenticated) Common name could be used instead of email by using SSL_CLIENT_S_DN_CN. request.env["SSL_CLIENT_S_DN_Email"] could be used by enabling +StdEnvVars but…
def get_ssl_username
request.env["REMOTE_USER"]
end
SSLVerifyClient require
SSLVerifyDepth 2
<Directory /var/www/html/app1>
RailsEnv development
Options -MultiViews
SSLOptions -StdEnvVars -ExportCertData
SSLUserName SSL_CLIENT_S_DN_Email
</Directory>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment