I am reading the ngnix client certificate and storing it in a local variable.
local client_cert = openssl_x509.new(ngx.var.ssl_client_raw_cert)
local subject = client_cert:getSubject()
I need to get the common name from the subject, how can I get it?
openssl_x509.new? What's the functionality ofgetSubject()?client_cert:getSubject()? I can't figure it out, only by reading the doc. If you get a table object, you can simply usesubject.CN. In case of string (for instance aftersubject:text()), following lua pattern should workstring.match(urvar, 'CN=(.*),').