KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > security > auth > certs > SubjectDNMapping


1 /*
2 * JBoss, the OpenSource J2EE webOS
3 *
4 * Distributable under LGPL license.
5 * See terms of license at gnu.org.
6 */

7 package org.jboss.security.auth.certs;
8
9 import java.security.Principal JavaDoc;
10 import java.security.cert.X509Certificate JavaDoc;
11 import org.jboss.security.CertificatePrincipal;
12
13 /** A CertificatePrincipal implementation that uses the client cert
14  * SubjectDN as the principal.
15  *
16  * @author Scott.Stark@jboss.org
17  * @version $Revision: 1.1.8.1 $
18  */

19 public class SubjectDNMapping
20    implements CertificatePrincipal
21 {
22    /** Returns the client cert SubjectDN as the principal.
23     *
24     * @param certs Array of client certificates, with the first one in
25     * the array being the certificate of the client itself.
26     */

27    public Principal JavaDoc toPrinicipal(X509Certificate JavaDoc[] certs)
28    {
29       Principal JavaDoc subject = certs[0].getSubjectDN();
30       return subject;
31    }
32 }
33
Popular Tags