001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)SSLClientPrincipal.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: /**
030: * SSLClientPrincipal.java
031: *
032: * SUN PROPRIETARY/CONFIDENTIAL.
033: * This software is the proprietary information of Sun Microsystems, Inc.
034: * Use is subject to license terms.
035: *
036: * Created on February 11, 2005, 3:12 PM
037: */package com.sun.jbi.security;
038:
039: import javax.security.auth.x500.X500Principal;
040:
041: /**
042: * This is a Principal class created soley to add a SSLClientPrincipal Type.
043: * The name of this Principal is the Subject DN from the SSL Clients Public Key
044: * Certificate, i.e. the certificate used for SSL Client Authentication.
045: *
046: * This is a wrapper around X500 Principal.
047: *
048: * @author Sun Microsystems, Inc.
049: */
050: public class SSLClientPrincipal extends X500PrincipalWrapper implements
051: java.security.Principal, java.io.Serializable {
052:
053: /**
054: *
055: * Creates a new instance of SSLClientPrincipal.
056: *
057: * @param name an X.500 distinguished name in RFC 1779 or RFC 2253 format.
058: * @see javax.security.auth.x500.X500Principal
059: */
060: public SSLClientPrincipal(String name) {
061: super (name);
062: }
063:
064: /**
065: * Creates a new instance of SSLClientPrincipal.
066: *
067: * @param name a byte array containing the distinguished name in ASN.1 DER
068: * encoded form.
069: * @see javax.security.auth.x500.X500Principal
070: */
071: public SSLClientPrincipal(byte[] name) {
072: super (name);
073: }
074:
075: /**
076: * Creates a new instance of SSLClientPrincipal.
077: *
078: * @param fis an InputStream containing the distinguished name in ASN.1 DER
079: * encoded form.
080: *
081: * @see javax.security.auth.x500.X500Principal
082: */
083: public SSLClientPrincipal(java.io.FileInputStream fis) {
084: super (fis);
085: }
086:
087: /**
088: * Creates a new instance of SSLClientPrincipal.
089: *
090: * @param x500Principal is the X500Principal this class
091: * encapsulates.
092: *
093: * @see javax.security.auth.x500.X500Principal
094: */
095: public SSLClientPrincipal(X500Principal x500Principal) {
096: super (x500Principal);
097: }
098:
099: /**
100: * Compares the specified Object with this X500Principal for equality.
101: * Specifically, this method returns true if the Object o is an X500Principal
102: * and if the respective canonical string representations (obtained via the
103: * getName(X500Principal.CANONICAL) method) of this object and o are equal.
104: *
105: * @param o obj to compare with
106: * @return true if the specified Object is equal to this X500Principal,
107: * false otherwise
108: */
109: public boolean equals(Object o) {
110: if (o == null) {
111: return false;
112: }
113:
114: if (o instanceof SSLClientPrincipal) {
115: return getName(X500Principal.CANONICAL).equals(
116: ((SSLClientPrincipal) o)
117: .getName(X500Principal.CANONICAL));
118: }
119:
120: return false;
121: }
122:
123: /**
124: * Return a hash code for this X500Principal.
125: *
126: * The hash code is calculated via: getName(X500Principal.CANONICAL).hashCode()
127: *
128: * @return a hash code for this X500Principal.
129: */
130: public int hashCode() {
131: return super.hashCode();
132: }
133:
134: }
|