blob: 73092cb5f0ee829fbde8169051c9ea5557c96e47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
---
title: CredentialsContainer
slug: Web/API/CredentialsContainer
translation_of: Web/API/CredentialsContainer
---
<p>{{SeeCompatTable}}{{APIRef("Credential Management API")}}</p>
<p><a href="/en-US/docs/Web/API/Credential_Management_API">Credential Management API</a> 的 <strong><code>CredentialsContainer</code></strong> 接口提供了请求 credentials 和通知用户代理(当成功登陆或登出事件发生时)的方法。可通过 <code>Navigator.credentials </code>获得该接口。</p>
<h2 id="属性">属性</h2>
<p>None.</p>
<h3 id="事件">事件</h3>
<p>None.</p>
<p> </p>
<p>返回一个带有处理值 <code><a href="https://w3c.github.io/webappsec-credential-management/#credential" id="ref-for-credential-34">Credential</a></code>(若它能够使用提供的选项创建的话)的 <code><a href="https://heycam.github.io/webidl/#idl-promise">Promise</a></code> ,或返回 <code>null</code>(若不能创建 <code><a href="https://w3c.github.io/webappsec-credential-management/#credential" id="ref-for-credential-35">Credential</a></code>)。在特殊情况下,返回的 <code><a href="https://heycam.github.io/webidl/#idl-promise">Promise</a></code> 对象可能 reject。</p>
<h2 id="方法">方法</h2>
<dl>
<dt>{{domxref("CredentialsContainer.create()")}}</dt>
<dd>Returns a {{jsxref("Promise")}} that resolves with a new {{domxref("Credential")}} instance based on the provided options, or <code>null</code> of no <code>Credential</code> object can be created.</dd>
<dt>{{domxref("CredentialsContainer.get()")}}</dt>
<dd>Returns a {{jsxref("Promise")}} that resolves with the {{domxref("Credential")}} instance that matches the provided parameters.</dd>
<dt>{{domxref("CredentialsContainer.preventSilentAccess()")}}</dt>
<dd>Sets a flag that specifies whether automatic log in is allowed for future visits to the current origin, then returns an empty {{jsxref("Promise")}}. For example, you might call this, after a user signs out of a website to ensure that he/she isn't automatically signed in on the next site visit. Earlier versions of the spec called this method <code>requireUserMediation()</code>. See {{anch("Browser compatibility")}} for support details.</dd>
<dt>{{domxref("CredentialsContainer.store()")}}</dt>
<dd>Stores a set of credentials for a user, inside a provided {{domxref("Credential")}} instance and returns that instance in a {{jsxref("Promise")}}.</dd>
</dl>
<h2 id="示例">示例</h2>
<pre class="brush: js">// TBD</pre>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td>{{SpecName('Credential Management')}}</td>
<td>{{Spec2('Credential Management')}}</td>
<td>Initial definition.</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
{{Compat("api.CredentialsContainer")}}
|