uTools-Manuals/docs/java/org/ietf/jgss/GSSCredential.html

703 lines
34 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="header">
<div class="subTitle">
compact3
</div>
<div class="subTitle">
org.ietf.jgss
</div>
<h2 class="title" title="Interface GSSCredential">Interface GSSCredential</h2>
</div><div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>
All Superinterfaces:
</dt>
<dd>
<span><a href="../../../java/lang/Cloneable.html" title="java.lang中的接口">Cloneable</a></span>
</dd>
</dl>
<hr/> <br/> <pre>public interface <span class="typeNameLabel">GSSCredential</span>
extends <a href="../../../java/lang/Cloneable.html" title="interface in java.lang">Cloneable</a></pre>
<div class="block">
<span>该接口封装了实体的GSS-API凭据。</span>
<span>凭证包含所有必要的加密信息,以便能够代表其所代表的实体创建上下文。</span>
<span>它可能包含多个不同的机制特定凭据元素,每个元素都包含特定安全机制的信息,但都指向相同的实体。</span>
<span>可以使用凭证来执行上下文启动,接受或两者。</span>
<p> <span>使用<a href="../../../org/ietf/jgss/GSSManager.html" title="org.ietf.jgss中的类"><code>GSSManager</code></a>类中的<code>createCredential</code>方法之一<a href="../../../org/ietf/jgss/GSSManager.html" title="org.ietf.jgss中的类">实例化凭据</a></span> <span>GSS-API认证创建并不旨在提供“登录到网络”功能因为这样的功能将涉及创建新的凭据而不仅仅是获取现有凭据的句柄。</span> <span><a href="package-summary.html#useSubjectCredsOnly">section on credential acquisition</a>在封装级描述描述凭据如何将现有的在Java平台中获取。</span> <span>GSS-API实现必须对呼叫者强制执行本地访问控制策略以防止未经授权的呼叫者获取他们无权的凭据。</span> </p>
<p> <span>应用程序将创建传递所需参数的凭据对象。</span> <span>然后,应用程序可以使用查询方法来获取有关实例化凭据对象的特定信息。</span> <span>当不再需要凭证时,应用程序应调用<a href="../../../org/ietf/jgss/GSSCredential.html#dispose--"><code>dispose</code></a>方法来释放凭据对象持有的任何资源,并销毁任何加密敏感信息。</span> </p>
<p> <span>此示例代码演示了为特定实体创建GSSCredential实现查询其字段及其不再需要时的发布</span> </p>
<p></p>
<pre> <span>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 &lt; mechs.length; i++)
System.out.println(mechs[i].toString());
}
// release system resources held by the credential
cred.dispose();</span> </pre>
</div>
<dl>
<dt>
<span class="simpleTagLabel">从以下版本开始:</span>
</dt>
<dd>
1.4
</dd>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../org/ietf/jgss/GSSManager.html#createCredential-int-"><code>GSSManager.createCredential(int)</code></a>
<a href="../../../org/ietf/jgss/GSSManager.html#createCredential-org.ietf.jgss.GSSName-int-org.ietf.jgss.Oid-int-"><code>GSSManager.createCredential(GSSName, int, Oid, int)</code></a>
<a href="../../../org/ietf/jgss/GSSManager.html#createCredential-org.ietf.jgss.GSSName-int-org.ietf.jgss.Oid:A-int-"><code>GSSManager.createCredential(GSSName, int, Oid[], int)</code></a>
<a href="../../../org/ietf/jgss/GSSCredential.html#dispose--"><code>dispose()</code></a>
</dd>
</dl> </li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- --> </a> <h3>Field Summary</h3>
<table border="0" cellpadding="3" cellspacing="0" class="memberSummary" summary="Field Summary table, listing fields, and an explanation">
<caption>
<span>Fields</span>
<span class="tabEnd"> </span>
</caption>
<tbody>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/ietf/jgss/GSSCredential.html#ACCEPT_ONLY">ACCEPT_ONLY</a></span></code>
<div class="block">
凭证使用标志,要求仅可用于上下文接受。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/ietf/jgss/GSSCredential.html#DEFAULT_LIFETIME">DEFAULT_LIFETIME</a></span></code>
<div class="block">
表示默认凭证生命周期的生命周期常数。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/ietf/jgss/GSSCredential.html#INDEFINITE_LIFETIME">INDEFINITE_LIFETIME</a></span></code>
<div class="block">
代表无限期凭证寿命的终生常数。
</div> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/ietf/jgss/GSSCredential.html#INITIATE_AND_ACCEPT">INITIATE_AND_ACCEPT</a></span></code>
<div class="block">
凭证使用标志,要求其可用于上下文启动和接受。
</div> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/ietf/jgss/GSSCredential.html#INITIATE_ONLY">INITIATE_ONLY</a></span></code>
<div class="block">
凭证使用标志,要求仅用于上下文启动。
</div> </td>
</tr>
</tbody>
</table> </li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- --> </a> <h3>方法摘要</h3>
<table border="0" cellpadding="3" cellspacing="0" class="memberSummary" summary="Method Summary table, listing methods, and an explanation">
<caption>
<span class="activeTableTab" id="t0"><span>所有方法</span><span class="tabEnd"> </span></span>
<span class="tableTab" id="t2"><span><a href="javascript:show(2);">接口方法</a></span><span class="tabEnd"> </span></span>
<span class="tableTab" id="t3"><span><a href="javascript:show(4);">抽象方法</a></span><span class="tabEnd"> </span></span>
</caption>
<tbody>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor" id="i0">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/ietf/jgss/GSSCredential.html#add-org.ietf.jgss.GSSName-int-int-org.ietf.jgss.Oid-int-">add</a></span>(<a href="../../../org/ietf/jgss/GSSName.html" title="interface in org.ietf.jgss">GSSName</a> name, int initLifetime, int acceptLifetime, <a href="../../../org/ietf/jgss/Oid.html" title="class in org.ietf.jgss">Oid</a> mech, int usage)</code>
<div class="block">
将机制特定凭据元素添加到现有凭据。
</div> </td>
</tr>
<tr class="rowColor" id="i1">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/ietf/jgss/GSSCredential.html#dispose--">dispose</a></span>()</code>
<div class="block">
释放GSSCredential对象可能包含的任何敏感信息。
</div> </td>
</tr>
<tr class="altColor" id="i2">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/ietf/jgss/GSSCredential.html#equals-java.lang.Object-">equals</a></span>(<a href="../../../java/lang/Object.html" title="class in java.lang">Object</a> another)</code>
<div class="block">
测试此GSSCredential是否与提供的对象断言相同的实体。
</div> </td>
</tr>
<tr class="rowColor" id="i3">
<td class="colFirst"><code><a href="../../../org/ietf/jgss/Oid.html" title="class in org.ietf.jgss">Oid</a>[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/ietf/jgss/GSSCredential.html#getMechs--">getMechs</a></span>()</code>
<div class="block">
返回此凭据支持的机制列表。
</div> </td>
</tr>
<tr class="altColor" id="i4">
<td class="colFirst"><code><a href="../../../org/ietf/jgss/GSSName.html" title="interface in org.ietf.jgss">GSSName</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/ietf/jgss/GSSCredential.html#getName--">getName</a></span>()</code>
<div class="block">
检索证书所声明的实体的名称。
</div> </td>
</tr>
<tr class="rowColor" id="i5">
<td class="colFirst"><code><a href="../../../org/ietf/jgss/GSSName.html" title="interface in org.ietf.jgss">GSSName</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/ietf/jgss/GSSCredential.html#getName-org.ietf.jgss.Oid-">getName</a></span>(<a href="../../../org/ietf/jgss/Oid.html" title="class in org.ietf.jgss">Oid</a> mech)</code>
<div class="block">
检索机制凭证声明的实体的名称。
</div> </td>
</tr>
<tr class="altColor" id="i6">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/ietf/jgss/GSSCredential.html#getRemainingAcceptLifetime-org.ietf.jgss.Oid-">getRemainingAcceptLifetime</a></span>(<a href="../../../org/ietf/jgss/Oid.html" title="class in org.ietf.jgss">Oid</a> mech)</code>
<div class="block">
返回凭证使用指定机制继续接受安全上下文的生命周期(以秒为单位)。
</div> </td>
</tr>
<tr class="rowColor" id="i7">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/ietf/jgss/GSSCredential.html#getRemainingInitLifetime-org.ietf.jgss.Oid-">getRemainingInitLifetime</a></span>(<a href="../../../org/ietf/jgss/Oid.html" title="class in org.ietf.jgss">Oid</a> mech)</code>
<div class="block">
返回凭证使用指定机制启动安全上下文的生命周期(以秒为单位)。
</div> </td>
</tr>
<tr class="altColor" id="i8">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/ietf/jgss/GSSCredential.html#getRemainingLifetime--">getRemainingLifetime</a></span>()</code>
<div class="block">
返回凭证的剩余生命周期(以秒为单位)。
</div> </td>
</tr>
<tr class="rowColor" id="i9">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/ietf/jgss/GSSCredential.html#getUsage--">getUsage</a></span>()</code>
<div class="block">
返回凭据使用模式。
</div> </td>
</tr>
<tr class="altColor" id="i10">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/ietf/jgss/GSSCredential.html#getUsage-org.ietf.jgss.Oid-">getUsage</a></span>(<a href="../../../org/ietf/jgss/Oid.html" title="class in org.ietf.jgss">Oid</a> mech)</code>
<div class="block">
返回特定机制的凭据使用模式。
</div> </td>
</tr>
<tr class="rowColor" id="i11">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/ietf/jgss/GSSCredential.html#hashCode--">hashCode</a></span>()</code>
<div class="block">
返回此GSSCredential的哈希码值。
</div> </td>
</tr>
</tbody>
</table> </li>
</ul> </li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- --> </a> <h3>字段详细信息</h3> <a name="INITIATE_AND_ACCEPT">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>INITIATE_AND_ACCEPT</h4> <pre>static final int INITIATE_AND_ACCEPT</pre>
<div class="block">
凭证使用标志,要求其可用于上下文启动和接受。
</div>
<dl>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../constant-values.html#org.ietf.jgss.GSSCredential.INITIATE_AND_ACCEPT">Constant Field Values</a>
</dd>
</dl> </li>
</ul> <a name="INITIATE_ONLY">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>INITIATE_ONLY</h4> <pre>static final int INITIATE_ONLY</pre>
<div class="block">
凭证使用标志,要求仅用于上下文启动。
</div>
<dl>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../constant-values.html#org.ietf.jgss.GSSCredential.INITIATE_ONLY">Constant Field Values</a>
</dd>
</dl> </li>
</ul> <a name="ACCEPT_ONLY">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>ACCEPT_ONLY</h4> <pre>static final int ACCEPT_ONLY</pre>
<div class="block">
凭证使用标志,要求仅可用于上下文接受。
</div>
<dl>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../constant-values.html#org.ietf.jgss.GSSCredential.ACCEPT_ONLY">Constant Field Values</a>
</dd>
</dl> </li>
</ul> <a name="DEFAULT_LIFETIME">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>DEFAULT_LIFETIME</h4> <pre>static final int DEFAULT_LIFETIME</pre>
<div class="block">
<span>表示默认凭证生命周期的生命周期常数。</span>
<span>该值设置为0。</span>
</div>
<dl>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../constant-values.html#org.ietf.jgss.GSSCredential.DEFAULT_LIFETIME">Constant Field Values</a>
</dd>
</dl> </li>
</ul> <a name="INDEFINITE_LIFETIME">
<!-- --> </a>
<ul class="blockListLast">
<li class="blockList"> <h4>INDEFINITE_LIFETIME</h4> <pre>static final int INDEFINITE_LIFETIME</pre>
<div class="block">
<span>代表无限期凭证寿命的终生常数。</span>
<span>此值必须设置为Java中的最大整数值 - <a href="../../../java/lang/Integer.html#MAX_VALUE"><code>Integer.MAX_VALUE</code></a></span>
</div>
<dl>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../constant-values.html#org.ietf.jgss.GSSCredential.INDEFINITE_LIFETIME">Constant Field Values</a>
</dd>
</dl> </li>
</ul> </li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- --> </a> <h3>方法详细信息</h3> <a name="dispose--">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>dispose</h4> <pre>void dispose()
throws <a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></pre>
<div class="block">
<span>释放GSSCredential对象可能包含的任何敏感信息。</span>
<span>一旦不再需要凭证,应用程序就应该调用此方法,以最小化维护任何敏感信息的时间。</span>
</div>
<dl>
<dt>
<span class="throwsLabel">异常</span>
</dt>
<dd>
<code><a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></code> - 包含以下主要错误代码:
<a href="../../../org/ietf/jgss/GSSException.html#FAILURE"><code>GSSException.FAILURE</code></a>
</dd>
</dl> </li>
</ul> <a name="getName--">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>getName</h4> <pre><a href="../../../org/ietf/jgss/GSSName.html" title="interface in org.ietf.jgss">GSSName</a> getName()
throws <a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></pre>
<div class="block">
检索证书所声明的实体的名称。
</div>
<dl>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
表示实体的GSSName
</dd>
<dt>
<span class="throwsLabel">异常</span>
</dt>
<dd>
<code><a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></code> - 包含以下主要错误代码:
<a href="../../../org/ietf/jgss/GSSException.html#FAILURE"><code>GSSException.FAILURE</code></a>
</dd>
</dl> </li>
</ul> <a name="getName-org.ietf.jgss.Oid-">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>getName</h4> <pre><a href="../../../org/ietf/jgss/GSSName.html" title="interface in org.ietf.jgss">GSSName</a> getName(<a href="../../../org/ietf/jgss/Oid.html" title="class in org.ietf.jgss">Oid</a> mech)
throws <a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></pre>
<div class="block">
<span>检索机制凭证声明的实体的名称。</span>
<span>这相当于调用<a href="../../../org/ietf/jgss/GSSName.html#canonicalize-org.ietf.jgss.Oid-"><code>canonicalize</code></a>对另一种形式返回的值为<a href="../../../org/ietf/jgss/GSSCredential.html#getName--"><code>getName</code></a></span>
</div>
<dl>
<dt>
<span class="paramLabel">参数</span>
</dt>
<dd>
<code>mech</code> - 应该返回机制名称的机制的Oid。
</dd>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
表示为所需机制规范化的实体的GSSName
</dd>
<dt>
<span class="throwsLabel">异常</span>
</dt>
<dd>
<code><a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></code> -包含以下主要错误代码:
<a href="../../../org/ietf/jgss/GSSException.html#BAD_MECH"><code>GSSException.BAD_MECH</code></a>
<a href="../../../org/ietf/jgss/GSSException.html#FAILURE"><code>GSSException.FAILURE</code></a>
</dd>
</dl> </li>
</ul> <a name="getRemainingLifetime--">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>getRemainingLifetime</h4> <pre>int getRemainingLifetime()
throws <a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></pre>
<div class="block">
<span>返回凭证的剩余生命周期(以秒为单位)。</span>
<span>剩余生命周期是所有潜在机制特定凭证元素的最短生命周期。</span>
</div>
<dl>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
<span>此凭证的最小剩余生命周期(以秒为单位)。</span>
<span>返回值为<a href="../../../org/ietf/jgss/GSSCredential.html#INDEFINITE_LIFETIME"><code>INDEFINITE_LIFETIME</code></a>表示该凭证不会过期。</span>
<span>返回值为0表示凭证已过期。</span>
</dd>
<dt>
<span class="throwsLabel">异常</span>
</dt>
<dd>
<code><a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></code> - 包含以下主要错误代码:
<a href="../../../org/ietf/jgss/GSSException.html#FAILURE"><code>GSSException.FAILURE</code></a>
</dd>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../org/ietf/jgss/GSSCredential.html#getRemainingInitLifetime-org.ietf.jgss.Oid-"><code>getRemainingInitLifetime(Oid)</code></a>
<a href="../../../org/ietf/jgss/GSSCredential.html#getRemainingAcceptLifetime-org.ietf.jgss.Oid-"><code>getRemainingAcceptLifetime(Oid)</code></a>
</dd>
</dl> </li>
</ul> <a name="getRemainingInitLifetime-org.ietf.jgss.Oid-">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>getRemainingInitLifetime</h4> <pre>int getRemainingInitLifetime(<a href="../../../org/ietf/jgss/Oid.html" title="class in org.ietf.jgss">Oid</a> mech)
throws <a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></pre>
<div class="block">
<span>返回凭证使用指定机制启动安全上下文的生命周期(以秒为单位)。</span>
<span>此方法查询属于指定机制的启动器凭据元素。</span>
</div>
<dl>
<dt>
<span class="paramLabel">参数</span>
</dt>
<dd>
<code>mech</code> - 应查询启动器凭据元素的机制的Oid。
</dd>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
<span>该凭证元素的使用寿命中剩余的秒数。</span>
<span>返回值为<a href="../../../org/ietf/jgss/GSSCredential.html#INDEFINITE_LIFETIME"><code>INDEFINITE_LIFETIME</code></a>表示该凭证元素,不会过期。</span>
<span>返回值为0表示凭证元素已过期。</span>
</dd>
<dt>
<span class="throwsLabel">异常</span>
</dt>
<dd>
<code><a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></code> -包含以下主要错误代码:
<a href="../../../org/ietf/jgss/GSSException.html#BAD_MECH"><code>GSSException.BAD_MECH</code></a>
<a href="../../../org/ietf/jgss/GSSException.html#FAILURE"><code>GSSException.FAILURE</code></a>
</dd>
</dl> </li>
</ul> <a name="getRemainingAcceptLifetime-org.ietf.jgss.Oid-">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>getRemainingAcceptLifetime</h4> <pre>int getRemainingAcceptLifetime(<a href="../../../org/ietf/jgss/Oid.html" title="class in org.ietf.jgss">Oid</a> mech)
throws <a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></pre>
<div class="block">
<span>返回凭证使用指定机制继续接受安全上下文的生命周期(以秒为单位)。</span>
<span>此方法查询属于指定机制的acceptor凭据元素。</span>
</div>
<dl>
<dt>
<span class="paramLabel">参数</span>
</dt>
<dd>
<code>mech</code> - 应该查询其接受者凭据元素的机制的Oid。
</dd>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
<span>该凭证元素的使用寿命中剩余的秒数。</span>
<span>返回值为<a href="../../../org/ietf/jgss/GSSCredential.html#INDEFINITE_LIFETIME"><code>INDEFINITE_LIFETIME</code></a>表示该凭证元素,不会过期。</span>
<span>返回值为0表示凭证元素已过期。</span>
</dd>
<dt>
<span class="throwsLabel">异常</span>
</dt>
<dd>
<code><a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></code> -包含以下主要错误代码:
<a href="../../../org/ietf/jgss/GSSException.html#BAD_MECH"><code>GSSException.BAD_MECH</code></a>
<a href="../../../org/ietf/jgss/GSSException.html#FAILURE"><code>GSSException.FAILURE</code></a>
</dd>
</dl> </li>
</ul> <a name="getUsage--">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>getUsage</h4> <pre>int getUsage()
throws <a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></pre>
<div class="block">
<span>返回凭据使用模式。</span>
<span>换句话说,它告诉我们这个凭据是否可以用于启动或接受安全上下文。</span>
<span>它不告诉我们为了这样做,必须使用哪种机制。</span>
<span>预计应用程序将允许GSS-API在调用此方法后选择默认机制。</span>
</div>
<dl>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
返回值将是一个
<a href="../../../org/ietf/jgss/GSSCredential.html#INITIATE_ONLY"><code>INITIATE_ONLY</code></a>
<a href="../../../org/ietf/jgss/GSSCredential.html#ACCEPT_ONLY"><code>ACCEPT_ONLY</code></a>
<a href="../../../org/ietf/jgss/GSSCredential.html#INITIATE_AND_ACCEPT"><code>INITIATE_AND_ACCEPT</code></a>
</dd>
<dt>
<span class="throwsLabel">异常</span>
</dt>
<dd>
<code><a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></code> - 包含以下主要错误代码:
<a href="../../../org/ietf/jgss/GSSException.html#FAILURE"><code>GSSException.FAILURE</code></a>
</dd>
</dl> </li>
</ul> <a name="getUsage-org.ietf.jgss.Oid-">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>getUsage</h4> <pre>int getUsage(<a href="../../../org/ietf/jgss/Oid.html" title="class in org.ietf.jgss">Oid</a> mech)
throws <a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></pre>
<div class="block">
<span>返回特定机制的凭据使用模式。</span>
<span>换句话说,它告诉我们这个凭证是否可以用于启动或接受具有给定底层机制的安全上下文。</span>
</div>
<dl>
<dt>
<span class="paramLabel">参数</span>
</dt>
<dd>
<code>mech</code> - 要确定凭据使用模式的机制的Oid。
</dd>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
返回值将是一个
<a href="../../../org/ietf/jgss/GSSCredential.html#INITIATE_ONLY"><code>INITIATE_ONLY</code></a>
<a href="../../../org/ietf/jgss/GSSCredential.html#ACCEPT_ONLY"><code>ACCEPT_ONLY</code></a>
<a href="../../../org/ietf/jgss/GSSCredential.html#INITIATE_AND_ACCEPT"><code>INITIATE_AND_ACCEPT</code></a>
</dd>
<dt>
<span class="throwsLabel">异常</span>
</dt>
<dd>
<code><a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></code> -包含以下主要错误代码:
<a href="../../../org/ietf/jgss/GSSException.html#BAD_MECH"><code>GSSException.BAD_MECH</code></a>
<a href="../../../org/ietf/jgss/GSSException.html#FAILURE"><code>GSSException.FAILURE</code></a>
</dd>
</dl> </li>
</ul> <a name="getMechs--">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>getMechs</h4> <pre><a href="../../../org/ietf/jgss/Oid.html" title="class in org.ietf.jgss">Oid</a>[] getMechs()
throws <a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></pre>
<div class="block">
<span>返回此凭据支持的机制列表。</span>
<span>它不告诉我们哪些可以用于启动上下文,哪些可以用于接受上下文。</span>
<span>应用程序必须使用每个返回的Oid来调用<a href="../../../org/ietf/jgss/GSSCredential.html#getUsage-org.ietf.jgss.Oid-"><code>getUsage</code></a>方法来确定可能的使用模式。</span>
</div>
<dl>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
一组Oid对应于支持的机制。
</dd>
<dt>
<span class="throwsLabel">异常</span>
</dt>
<dd>
<code><a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></code> - 包含以下主要错误代码:
<a href="../../../org/ietf/jgss/GSSException.html#FAILURE"><code>GSSException.FAILURE</code></a>
</dd>
</dl> </li>
</ul> <a name="add-org.ietf.jgss.GSSName-int-int-org.ietf.jgss.Oid-int-">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>add</h4> <pre>void add(<a href="../../../org/ietf/jgss/GSSName.html" title="interface in org.ietf.jgss">GSSName</a> name,
int initLifetime,
int acceptLifetime,
<a href="../../../org/ietf/jgss/Oid.html" title="class in org.ietf.jgss">Oid</a> mech,
int usage)
throws <a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></pre>
<div class="block">
<span>将机制特定凭据元素添加到现有凭据。</span>
<span>这种方法允许建立凭证,一次一个机制。</span>
<p> <span>在创建接受者凭据期间,此例程被设想为主要由上下文接受者使用,这些接受者凭证将与使用不同安全机制的各种客户端一起使用。</span> </p>
<p> <span>此例程将添加新的凭据元素“就地”。</span> <span>要将元素添加到新凭据中,首先调用<code>clone</code>获取该凭据的副本,然后调用其<code>add</code>方法。</span> </p>
<p> <span>与往常一样GSS-API实现必须对呼叫者强制执行本地访问控制策略以防止未经授权的呼叫者获取他们无权访问的凭据。</span> <span>initLifetime和acceptLifetime的非默认值不能始终被基础机制所尊重因此调用者应该准备<a href="../../../org/ietf/jgss/GSSCredential.html#getRemainingInitLifetime-org.ietf.jgss.Oid-">好在</a> <a href="../../../org/ietf/jgss/GSSCredential.html#getRemainingAcceptLifetime-org.ietf.jgss.Oid-">凭证</a>上调用<a href="../../../org/ietf/jgss/GSSCredential.html#getRemainingInitLifetime-org.ietf.jgss.Oid-"><code>getRemainingInitLifetime</code></a><code>getRemainingAcceptLifetime</code></span> </p>
</div>
<dl>
<dt>
<span class="paramLabel">参数</span>
</dt>
<dd>
<span><code>name</code> - 要获得该证书的校长的姓名。</span>
<span>使用<code>null</code>指定默认主体。</span>
</dd>
<dd>
<span><code>initLifetime</code> - 证书元素在启动安全上下文时应保持有效的秒数。</span>
<span>使用<a href="../../../org/ietf/jgss/GSSCredential.html#INDEFINITE_LIFETIME"><code>GSSCredential.INDEFINITE_LIFETIME</code></a>请求凭据具有此允许的最大允许生命周期。</span>
<span>请使用<a href="../../../org/ietf/jgss/GSSCredential.html#DEFAULT_LIFETIME"><code>GSSCredential.DEFAULT_LIFETIME</code></a>为此请求默认凭据生存期。</span>
</dd>
<dd>
<span><code>acceptLifetime</code> - 凭证元素应该保持有效接受安全上下文的秒数。</span>
<span>使用<a href="../../../org/ietf/jgss/GSSCredential.html#INDEFINITE_LIFETIME"><code>GSSCredential.INDEFINITE_LIFETIME</code></a>请求凭据具有最大允许的生命周期。</span>
<span>请使用<a href="../../../org/ietf/jgss/GSSCredential.html#DEFAULT_LIFETIME"><code>GSSCredential.DEFAULT_LIFETIME</code></a>为此请求默认凭证生命周期。</span>
</dd>
<dd>
<code>mech</code> - 获取凭证的机制。
</dd>
<dd>
<span><code>usage</code> - 此凭据元素应添加到凭据的使用模式。</span>
<span>此参数的值必须是一个: <a href="../../../org/ietf/jgss/GSSCredential.html#INITIATE_AND_ACCEPT"><code>INITIATE_AND_ACCEPT</code></a> <a href="../../../org/ietf/jgss/GSSCredential.html#ACCEPT_ONLY"><code>ACCEPT_ONLY</code></a><a href="../../../org/ietf/jgss/GSSCredential.html#INITIATE_ONLY"><code>INITIATE_ONLY</code></a></span>
</dd>
<dt>
<span class="throwsLabel">异常</span>
</dt>
<dd>
<code><a href="../../../org/ietf/jgss/GSSException.html" title="class in org.ietf.jgss">GSSException</a></code> -包含以下主要错误代码:
<a href="../../../org/ietf/jgss/GSSException.html#DUPLICATE_ELEMENT"><code>GSSException.DUPLICATE_ELEMENT</code></a>
<a href="../../../org/ietf/jgss/GSSException.html#BAD_MECH"><code>GSSException.BAD_MECH</code></a>
<a href="../../../org/ietf/jgss/GSSException.html#BAD_NAMETYPE"><code>GSSException.BAD_NAMETYPE</code></a>
<a href="../../../org/ietf/jgss/GSSException.html#NO_CRED"><code>GSSException.NO_CRED</code></a>
<a href="../../../org/ietf/jgss/GSSException.html#CREDENTIALS_EXPIRED"><code>GSSException.CREDENTIALS_EXPIRED</code></a>
<a href="../../../org/ietf/jgss/GSSException.html#FAILURE"><code>GSSException.FAILURE</code></a>
</dd>
</dl> </li>
</ul> <a name="equals-java.lang.Object-">
<!-- --> </a>
<ul class="blockList">
<li class="blockList"> <h4>equals</h4> <pre>boolean equals(<a href="../../../java/lang/Object.html" title="class in java.lang">Object</a> another)</pre>
<div class="block">
<span>测试此GSSCredential是否与提供的对象断言相同的实体。</span>
<span>这两个凭证必须通过相同的机制获得,并且必须引用相同的主体。</span>
</div>
<dl>
<dt>
<span class="overrideSpecifyLabel">重写:</span>
</dt>
<dd>
<code><a href="../../../java/lang/Object.html#equals-java.lang.Object-">equals</a></code>
<code><a href="../../../java/lang/Object.html" title="class in java.lang">Object</a></code>
</dd>
<dt>
<span class="paramLabel">参数</span>
</dt>
<dd>
<code>another</code> - 另一个与此相比较的GSSCredential
</dd>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
<span><code>true</code>如果两个GSSCredentials断言同一个实体;</span>
<span><code>false</code>否则。</span>
</dd>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<span><a href="../../../java/lang/Object.html#hashCode--"><code>Object.hashCode()</code></a> <a href="../../../java/util/HashMap.html" title="java.util中的类"><code>HashMap</code></a></span>
</dd>
</dl> </li>
</ul> <a name="hashCode--">
<!-- --> </a>
<ul class="blockListLast">
<li class="blockList"> <h4>hashCode</h4> <pre>int hashCode()</pre>
<div class="block">
返回此GSSCredential的哈希码值。
</div>
<dl>
<dt>
<span class="overrideSpecifyLabel">重写:</span>
</dt>
<dd>
<code><a href="../../../java/lang/Object.html#hashCode--">hashCode</a></code>
<code><a href="../../../java/lang/Object.html" title="class in java.lang">Object</a></code>
</dd>
<dt>
<span class="returnLabel">结果</span>
</dt>
<dd>
一个hashCode值
</dd>
<dt>
<span class="seeLabel">另请参见:</span>
</dt>
<dd>
<a href="../../../java/lang/Object.html#equals-java.lang.Object-"><code>Object.equals(java.lang.Object)</code></a>
<a href="../../../java/lang/System.html#identityHashCode-java.lang.Object-"><code>System.identityHashCode(java.lang.Object)</code></a>
</dd>
</dl> </li>
</ul> </li>
</ul> </li>
</ul>
</div>
</div>