aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/credentialscontainer/index.html
blob: 13b25b9a44f273cc6b65bf7e4f4a887a69af3886 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
---
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>

<div>{{CompatibilityTable}}</div>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>
    <p>{{CompatChrome(51)}}</p>
   </td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td><code>create()</code></td>
   <td>{{CompatChrome(60)}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td><code>requireUserMediation()</code> renamed <code>preventSilentAccess()</code></td>
   <td>{{CompatChrome(60)}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android Webview</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>Firefox OS</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>
    <p>{{CompatChrome(51)}}</p>
   </td>
   <td>
    <p>{{CompatChrome(51)}}</p>
   </td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td><code>create()</code></td>
   <td>{{CompatChrome(60)}}</td>
   <td>{{CompatChrome(60)}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td><code>requireUserMediation()</code> renamed <code>preventSilentAccess()</code></td>
   <td>{{CompatChrome(60)}}</td>
   <td>{{CompatChrome(60)}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>