KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > resource > spi > security > GenericCredential


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package javax.resource.spi.security;
25
26 import java.security.Principal JavaDoc; // to fix javadoc warning
27
import javax.resource.spi.SecurityException JavaDoc;
28
29 /** The interface <code>javax.resource.spi.security.GenericCredential</code>
30  * defines a security mechanism independent interface for accessing
31  * security credential of a resource principal.
32  *
33  * <p>The <code>GenericCredential</code> interface provides a Java
34  * wrapper over an underlying mechanism specific representation of
35  * a security credential. For example, the <code>GenericCredential</code>
36  * interface can be used to wrap Kerberos credentials.
37  *
38  * <p>The connector architecture does not define any standard format
39  * and requirements for security mechanism specific credentials. For
40  * example, a security credential wrapped by a GenericCredential
41  * interface can have a native representation specific to an operating
42  * system.
43  *
44  * <p>The GenericCredential interface enables a resource adapter to
45  * extract information about a security credential. The resource adapter
46  * can then manage EIS sign-on for a resource principal by either:
47  * <UL>
48  * <LI>using the credentials in an EIS specific manner if the underlying
49  * EIS supports the security mechanism type represented by the
50  * GenericCredential instance, or,
51  * <LI>using GSS-API if the resource adapter and underlying EIS
52  * instance support GSS-API.
53  * </UL>
54  *
55  * @author Rahul Sharma
56  * @version 0.7
57  * @since 0.7
58  * @see javax.security.auth.Subject
59  * @see java.security.Principal
60  * @deprecated The preferred way to represent generic credential information
61  * is via the <code>org.ietf.jgss.GSSCredential</code> interface in
62  * J2SE Version 1.4, which provides similar functionality.
63  */

64
65 public interface GenericCredential {
66
67   /** Returns the name of the resource principal associated
68    * with a GenericCredential instance.
69    *
70    * @return Name of the principal
71   **/

72   public
73   String JavaDoc getName();
74
75   /** Returns the mechanism type for the GenericCredential instance.
76    * The mechanism type definition for GenericCredential should be
77    * consistent with the Object Identifier (OID) based representation
78    * specified in the GSS specification. In the GenericCredential
79    * interface, the mechanism type is returned as a stringified
80    * representation of the OID specification.
81    *
82    * @return mechanism type
83   **/

84   public
85   String JavaDoc getMechType();
86
87   /** Gets security data for a specific security mechanism represented
88    * by the GenericCredential. An example is authentication data required
89    * for establishing a secure association with an EIS instance on
90    * behalf of the associated resource principal.
91    *
92    * <p>The getCredentialData method returns the credential
93    * representation as an array of bytes. Note that the connector
94    * architecture does not define any standard format for the returned
95    * credential data.
96    *
97    * @return credential representation as an array of bytes.
98    * @throws SecurityException
99    * Failed operation due to security related
100    * error condition
101    **/

102   public
103   byte[] getCredentialData() throws SecurityException JavaDoc;
104
105   /** Tests if this GenericCredential instance refers to the same entity
106    * as the supplied object. The two credentials must be acquired over
107    * the same mechanisms and must refer to the same principal.
108    *
109    * Returns true if the two GenericCredentials refer to the same entity;
110    * false otherwise.
111   **/

112   public
113   boolean equals(Object JavaDoc another);
114
115   /** Returns the hash code for this GenericCredential
116    *
117    * @return hash code for this GenericCredential
118    **/

119   public
120   int hashCode();
121
122 }
123
Popular Tags