• JBoss and PHP

  • OpenKM has many interesting features, but requires some configuration process to show its full potential.
OpenKM has many interesting features, but requires some configuration process to show its full potential.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #6816  by qu3ll0
 
Hello folks,

Apache stores information about the certificate used for authenticating a client into the $_SERVER array and I can use such vars by e.g. $_SERVER['SSL_CLIENT_S_DN_CN']

Somebody knows where jboss stores such info and how I can use such variables into jsp or php pages?

Cheers,

Qu3!
 #6821  by jllort
 
I'm not sure if it could be usefult to you ?
Code: Select all
request.isUserInRole("Role name") // is a method to know is a user has some role
take a look at request methods
 #6860  by qu3ll0
 
Thanks jllort.

I found the answer to my question. Posting here hoping it can be helpful.
Code: Select all
<%@ page import="java.security.cert.Certificate"%>
<%@ page import="java.security.cert.X509Certificate"%>

String CliCertCN = "";
if (request.isSecure()) {
     X509Certificate[] certs = (X509Certificate[]) request.getAttribute("javax.servlet.request.X509Certificate");
         // certs[0] is the user's certificate while certs[1]..[n] are CA's certificates chained into the user's cert
         // Printing some attribute
	 out.print("SubjectDN = " + certs[0].getSubjectDN().getName()+"<BR>");
	 out.print("Start Validity Date = " + certs[0].getNotBefore()+"<BR>");
	 out.print("End Validity Date = " + certs[0].getNotAfter()+"<BR>");
	 out.print("Issuer = " + certs[0].getIssuerDN().getName()+"<BR>");
         // Extracting Subject CN from Subject DN
	 X509Certificate cert1 = certs[0];
	 String CliCertDN = null;
	 CliCertDN = cert1.getSubjectDN().getName();
	 String attributeName = "CN=";
	 int i = CliCertDN.indexOf(attributeName);
		if (i < 0) {
			return;
		}
	 i += attributeName.length();
	 int j = CliCertDN.indexOf(",", i);
		if (j - 1 <= 0) {
			return;
		}
	 CliCertCN = CliCertDN.substring(i, j).trim();
	 out.print("Subject CN = " +CliCertCN+"<BR>");
}
Qu3!

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.