concept principal in category jboss

This is an excerpt from Manning's book JBoss in Action: Configuring the JBoss Application Server.
The value of the dsJndiName module option points to the JNDI name for the data source that contains the security information. The principalsQuery option defines the query that the login module executes when it tries to authenticate a principal based on this password. If this option isn’t set, the login module executes the following default query:
select Password from Principals where PrincipalID=?The rolesQuery option defines the query that the login module executes when it tries to authorize a principal based on her roles. If this option isn’t set, the login module executes the following default query:
Select a strategy for forming the principal from the certificate. Add principals and roles to the security datastore.
With password-based authentication, the user types in a username as a principal and a password as the credential. When implementing client-certificate authentication, it makes sense to use the certificate’s public key as the credential, but what would you use as the principal itself? If you look at the structure of a certificate, you could use several parts of the certificate to represent the principal. In JBoss Web Server, you can choose which part to use by configuring the realm setting in the JBoss Web Server’s server.xml file. We talked about the realm in section 6.1.3, but let’s take another look at it.
<Realm className="org.jboss.web.tomcat.security.JBossWebRealm"
certificatePrincipal="org.jboss.security.auth.certs.SubjectDNMapping"
allRolesMode="authOnly" />The certificatePrincipal attribute configures which part of the client’s certificate should be used as the principal. Out of the box, the certificatePrincipal attribute is set to the SubjectDNMapping option shown. This option uses the certificate’s entire Distinguished Name (DN) record. Table 6.4 shows you what other options you have.
Table 6.4. The different parts of the certificate that can be used for client-certificate authentication
certificatePrincipal option
Part of the certificate used as principal
org.jboss.security.auth.certs.SerialNumberIssuerDNMapping
The serialNumber and issuerDN
org.jboss.security.auth.certs.SubjectCNMapping
The value of the SubjectDN’s CN element
org.jboss.security.auth.certs.SubjectDNMapping
The entire SubjectDN
org.jboss.security.auth.certs.SubjectX500Principal
The SubjectX500Principal
We recommend trying the SubjectCNMapping option because it’s the easiest to set up in your underlying security datastore where you store your principals and credentials. The option you define determines what part of the certificate is parsed and passed in as the principal to the login modules that authenticate and authorize the principal. You must make sure that this part of the certificate is stored in your underlying authorization datastore as well.