/*
* @(#)GSSCredential.java 1.10 06/06/29
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package org.ietf.jgss;
/**
* This interface encapsulates the GSS-API credentials for an entity. A
* credential contains all the necessary cryptographic information to
* enable the creation of a context on behalf of the entity that it
* represents. It may contain multiple, distinct, mechanism specific
* credential elements, each containing information for a specific
* security mechanism, but all referring to the same entity. A credential
* may be used to perform context initiation, acceptance, or both.<p>
*
* Credentials are instantiated using one of the
* <code>createCredential</code> methods in the {@link GSSManager
* GSSManager} class. GSS-API credential creation is not
* intended to provide a "login to the network" function, as such a
* function would involve the creation of new credentials rather than
* merely acquiring a handle to existing credentials. The
* <a href=package-summary.html#useSubjectCredsOnly>section on credential
* acquisition</a> in the package level description describes
* how existing credentials are acquired in the Java platform. GSS-API
* implementations must impose a local access-control policy on callers to
* prevent unauthorized callers from acquiring credentials to which they
* are not entitled. <p>
*
* Applications will create a credential object passing the desired
* parameters. The application can then use the query methods to obtain
* specific information about the instantiated credential object.
* When the credential is no longer needed, the application should call
* the {@link #dispose() dispose} method to release any resources held by
* the credential object and to destroy any cryptographically sensitive
* information.<p>
*
* This example code demonstrates the creation of a GSSCredential
* implementation for a specific entity, querying of its fields, and its
* release when it is no longer needed:<p>
* <pre>
* GSSManager manager = GSSManager.getInstance();
*
* // start by creating a name object for the entity
* GSSName name = manager.createName("myusername", GSSName.NT_USER_NAME);
*
* // now acquire credentials for the entity
* GSSCredential cred = manager.createCredential(name,
* GSSCredential.ACCEPT_ONLY);
*
* // display credential information - name, remaining lifetime,
* // and the mechanisms it has been acquired over
* System.out.println(cred.getName().toString());
* System.out.println(cred.getRemainingLifetime());
*
* Oid [] mechs = cred.getMechs();
* if (mechs != null) {
* for (int i = 0; i < mechs.length; i++)
* System.out.println(mechs[i].toString());
* }
*
* // release system resources held by the credential
* cred.dispose();
* </pre>
*
* @see GSSManager#createCredential(int)
* @see GSSManager#createCredential(GSSName, int, Oid, int)
* @see GSSManager#createCredential(GSSName, int, Oid[], int)
* @see #dispose()
*
* @author Mayank Upadhyay
* @version 1.10, 06/29/06
* @since 1.4
*/
public interface GSSCredential extends Cloneable{
/**
* Credential usage flag requesting that it be usable
* for both context initiation and acceptance.
*
*/
public static final int INITIATE_AND_ACCEPT = 0;
/**
* Credential usage flag requesting that it be usable
* for context initiation only.
*
*/
public static final int INITIATE_ONLY = 1;
/**
* Credential usage flag requesting that it be usable
* for context acceptance only.
*
*/
public static final int ACCEPT_ONLY = 2;
=1= |