diff options
Diffstat (limited to 'files/ja/web/api/identitymanager')
| -rw-r--r-- | files/ja/web/api/identitymanager/get/index.html | 48 | ||||
| -rw-r--r-- | files/ja/web/api/identitymanager/getverifiedemail/index.html | 40 | ||||
| -rw-r--r-- | files/ja/web/api/identitymanager/index.html | 45 | ||||
| -rw-r--r-- | files/ja/web/api/identitymanager/logout/index.html | 40 | ||||
| -rw-r--r-- | files/ja/web/api/identitymanager/request/index.html | 75 | ||||
| -rw-r--r-- | files/ja/web/api/identitymanager/watch/index.html | 143 |
6 files changed, 391 insertions, 0 deletions
diff --git a/files/ja/web/api/identitymanager/get/index.html b/files/ja/web/api/identitymanager/get/index.html new file mode 100644 index 0000000000..1d772fd295 --- /dev/null +++ b/files/ja/web/api/identitymanager/get/index.html @@ -0,0 +1,48 @@ +--- +title: navigator.id.get +slug: Web/API/IdentityManager/get +tags: + - BrowserID + - DOM + - Gecko DOM Reference + - Persona + - Security +translation_of: Archive/IdentityManager/get +--- +<div> + {{ ApiRef }} {{ non-standard_header }}</div> +<div class="note"> + <strong>注記:</strong> この機能は、まだどのブラウザでもサポートされていません。Persona を使用する Web サイトは、そのページに <a href="https://login.persona.org/include.js" title="https://login.persona.org/include.js">ポリフィルライブラリ</a> を含めなければなりません。</div> +<h2 id="Summary" name="Summary">要約</h2> +<p>この関数は、Web サイトが <a href="/ja/docs/Persona" title="Persona">Persona</a> を使用してユーザの認証ができるようにします。この関数は、コールバック関数を引数に指定した "log in with Persona" ボタンの click ハンドラから呼び出してください。</p> +<p><code>navigator.id.get()</code> は、サインインに使用するメールアドレスの選択をユーザに求めます。ユーザの証明書が期限切れの場合は、Persona のパスワードも求めます。その後、ユーザのメールアドレスとパスワードを含む署名付きの <strong>アサーション</strong> が生成され、コールバックに渡されます。</p> +<p>何らかの理由で署名付きのアサーションが生成できないとき (例えば、ユーザがログインをキャンセルした場合や間違ったパスワードを入力した場合) は、コールバック関数に <code>NULL</code> が渡されて呼び出されます。</p> +<p>コールバックが署名付きのアサーションを受け取ったら、検証のためにそれをサーバに送信してください。</p> +<h2 id="Syntax" name="Syntax">構文</h2> +<pre class="syntaxbox">navigator.id.get(gotAssertion); +navigator.id.get(gotAssertion, {privacyPolicy: "/privacy.html", termsOfService: "/tos.html"});</pre> +<h3 id="Parameters" name="Parameters">引数</h3> +<dl> + <dt> + <code>gotAssertion</code></dt> + <dd> + 署名付きのアサーションオブジェクトまたは <code>NULL</code> を引数に持つ関数。コールバック関数で、検証のためにアサーションをサーバに送信してください。</dd> + <dt> + <code>privacyPolicy</code> {{ optional_inline() }}</dt> + <dd> + Web サイトのプライバシーポリシーのページへの絶対パスまたは URL。この引数を指定する場合、<code>termsOfService</code> も指定しなければなりません。<code>termsOfService</code> と <code>privacyPolicy</code> の両方を与えた場合、ログインダイアログに "you confirm that you accept this site's Terms of Use and Privacy Policy." というメッセージを表示してサイトの利用規約とプライバシーポリシーを知らせます。これには、それぞれのページへのリンクが含まれます。<code>termsOfService</code> が指定されない場合、この引数は効果がありません。</dd> + <dt> + <code>termsOfService</code> {{ optional_inline() }}</dt> + <dd> + Web サイトの利用規約のページへの絶対パスまたは URL。この引数を指定する場合、<code>privacyPolicy</code> も指定しなければなりません。<code>termsOfService</code> と <code>privacyPolicy</code> の両方を与えた場合、ログインダイアログに "you confirm that you accept this site's Terms of Use and Privacy Policy." というメッセージを表示してサイトの利用規約とプライバシーポリシーを知らせます。これには、それぞれのページへのリンクが含まれます。<code>privacyPolicy</code> が指定されない場合、この引数は効果がありません。</dd> +</dl> +<h2 id="Example" name="Example">コード例</h2> +<p>例が必要。</p> +<h2 id="Specification" name="Specification">仕様</h2> +<p>まだどの仕様書にも含まれていません。</p> +<h2 id="See_also" name="See_also">参照</h2> +<ul> + <li><a href="/ja/docs/Persona" title="Persona">BrowserID</a></li> + <li>{{domxref("navigator.id")}}</li> + <li>{{domxref("navigator.id.logout()")}}</li> +</ul> diff --git a/files/ja/web/api/identitymanager/getverifiedemail/index.html b/files/ja/web/api/identitymanager/getverifiedemail/index.html new file mode 100644 index 0000000000..ba681461a2 --- /dev/null +++ b/files/ja/web/api/identitymanager/getverifiedemail/index.html @@ -0,0 +1,40 @@ +--- +title: navigator.id.getVerifiedEmail +slug: Web/API/IdentityManager/getVerifiedEmail +tags: + - BrowserID + - DOM + - Gecko DOM Reference + - Persona + - Security +translation_of: Archive/IdentityManager/getVerifiedEmail +--- +<div> + {{ ApiRef }} {{ non-standard_header }} {{ deprecated_header }}</div> +<div class="note"> + <strong>注記:</strong> この機能は、まだどのブラウザでもサポートされていません。Persona を使用する Web サイトは、そのページに <a href="https://login.persona.org/include.js" title="https://login.persona.org/include.js">ポリフィルライブラリ</a> を含めなければなりません。</div> +<h2 id="Summary" name="Summary">要約</h2> +<p>この関数は、Web サイトが <a href="/ja/docs/BrowserID" title="BrowserID">BrowserID</a> を使用してユーザの認証ができるようにします。この関数は、コールバック関数を引数に指定した "log in with BrowserID" ボタンの click ハンドラから呼び出してください。</p> +<p><code>navigator.id.getVerifiedEmail()</code> は、サインインに使用するメールアドレスの選択をユーザに求めます。ユーザの証明書が期限切れの場合は、BrowserID のパスワードも求めます。その後、ユーザのメールアドレスとパスワードを含む署名付きの <strong>アサーション</strong> が生成され、コールバックに渡されます。</p> +<p>何らかの理由で署名付きのアサーションが生成できないとき (例えば、ユーザがログインをキャンセルした場合や間違ったパスワードを入力した場合) は、コールバック関数に <code>NULL</code> が渡されて呼び出されます。</p> +<p>コールバックが署名付きのアサーションを受け取ったら、検証のためにそれをサーバに送信してください。</p> +<h2 id="Syntax" name="Syntax">構文</h2> +<pre class="syntaxbox">window.navigator.id.getVerifiedEmail(gotAssertion);</pre> +<h3 id="Parameters" name="Parameters">引数</h3> +<dl> + <dt> + <code>gotAssertion</code></dt> + <dd> + 署名付きのアサーションオブジェクトまたは <code>NULL</code> を引数に持つコールバック関数。コールバック関数では、検証のためにアサーションをサーバに送信してください。</dd> +</dl> +<h2 id="Example" name="Example">コード例</h2> +<p>例が必要。</p> +<h2 id="Specification" name="Specification">仕様</h2> +<p>まだどの仕様書にも含まれていません。</p> +<h2 id="See_also" name="See_also">参照</h2> +<ul> + <li><a href="/ja/docs/BrowserID" title="BrowserID">BrowserID</a></li> + <li>{{domxref("navigator.id")}}</li> + <li>{{domxref("navigator.id.get()")}}</li> + <li>{{domxref("navigator.id.logout()")}}</li> +</ul> diff --git a/files/ja/web/api/identitymanager/index.html b/files/ja/web/api/identitymanager/index.html new file mode 100644 index 0000000000..561c8e450e --- /dev/null +++ b/files/ja/web/api/identitymanager/index.html @@ -0,0 +1,45 @@ +--- +title: IdentityManager +slug: Web/API/IdentityManager +tags: + - API +translation_of: Archive/IdentityManager +--- +<p>{{APIRef("Persona")}}{{non-standard_header}}</p> + +<p>The <strong><code>IdentityManager</code></strong> of the <a href="/en-US/docs/Persona" title="BrowserID">BrowserID protocol</a> exposes the BrowserID API, via {{domxref("navigator.id")}}. This API has gone through several significant revisions. Each generation is listed separately below.</p> + +<h2 id="ObserverMethods" name="ObserverMethods">The "Observer" API (Current)</h2> + +<p>The Observer API introduces much-requested features, such as an improved post-verification experience for first-time users, automatic persistent logins, and easier integration with native applications.</p> + +<dl> + <dt>{{ domxref("IdentityManager.watch()")}}</dt> + <dd>Registers callbacks to be invoked when a user logs into or out of a website.</dd> + <dt>{{ domxref("IdentityManager.request()")}}</dt> + <dd>Requests a signed identity assertion from the user.</dd> + <dt>{{ domxref("IdentityManager.logout()")}}</dt> + <dd>Logs the user out of a website and prevents the <code>onlogin</code> action from automatically firing on their next visit.</dd> +</dl> + +<div class="note"> +<p>Users with third-party cookies disabled may experience problems logging in using the Observer API as detailed in <a href="https://github.com/mozilla/browserid/issues/2999" title="https://github.com/mozilla/browserid/issues/2999">issue 2999</a>.</p> +</div> + +<h2 id="CallbackMethods" name="CallbackMethods">The "Callback" API (Current)</h2> + +<p>The Callback API was introduced in November 2011. It improved upon the initial API by allowing options to be passed to <code>navigator.id.get()</code> and offering experimental support for BrowserID-managed persistent sessions.</p> + +<dl> + <dt>{{ domxref("IdentityManager.get()")}}</dt> + <dd>Gets the user's BrowserID in a signed assertion.</dd> +</dl> + +<h2 id="VerifiedEmailMethods" name="VerifiedEmailMethods">The "VerifiedEmail" API (Deprecated)</h2> + +<p>The VerifiedEmail API was BrowserID's first API. It was deprecated at the end of 2011.</p> + +<dl> + <dt>{{ domxref("IdentityManager.getVerifiedEmail()")}} {{ deprecated_inline() }}</dt> + <dd>Gets the user's BrowserID in a signed assertion. This method is deprecated; {{ domxref("navigator.id.get()")}} is backwards compatible and can be used instead.</dd> +</dl> diff --git a/files/ja/web/api/identitymanager/logout/index.html b/files/ja/web/api/identitymanager/logout/index.html new file mode 100644 index 0000000000..e235472220 --- /dev/null +++ b/files/ja/web/api/identitymanager/logout/index.html @@ -0,0 +1,40 @@ +--- +title: navigator.id.logout +slug: Web/API/IdentityManager/logout +tags: + - BrowserID + - DOM + - Gecko DOM Reference + - Persona + - Security +translation_of: Archive/IdentityManager/logout +--- +<div> + {{ ApiRef() }} {{ non-standard_header() }}</div> +<div class="note"> + <strong>注記:</strong> この機能は、まだどのブラウザでもサポートされていません。Persona を使用する Web サイトは、そのページに <a href="https://login.persona.org/include.js" title="https://login.persona.org/include.js">ポリフィルライブラリ</a> を含めなければなりません。</div> +<h2 id="Summary" name="Summary">要約</h2> +<p>この関数は、<a href="/ja/docs/Persona" title="Persona">Persona</a> で、Web サイトに対する自動的なログインの持続フラグをリセットするために使用します。この関数が呼び出された後、サイトに自動的にサインインされなくなるので、ユーザが明示的にログインしなおす必要があります。</p> +<p>Web サイトは、この関数をサイトの "log out" ボタンの click ハンドラから呼び出さなければなりません。</p> +<p>この関数は、ユーザの証明書や署名キーをブラウザに <strong>消去させません</strong>。そのため、<code>logout()</code> を呼び出した後、ユーザの ID プロバイダが与えた証明書の新しさに依存して、新たなログインの時に新しいパスワードをユーザに求めたり求めなかったりします。しかし、サインインに使用するメールアドレスの選択は求められます。</p> +<h2 id="Syntax" name="Syntax">構文</h2> +<pre class="syntaxbox">navigator.id.logout();</pre> +<h2 id="Example" name="Example">コード例</h2> +<pre class="brush: js">// ユーザが "Sign Out" をクリックした時に navigator.id.logout(); を実行する +var signoutLink = document.getElementById('signout'); + +if (signoutLink) { + signoutLink.onclick = function(event) { + event.preventDefault(); + navigator.id.logout(); + }; +};</pre> +<h2 id="Specification" name="Specification">仕様</h2> +<p>まだどの仕様書にも含まれていません。</p> +<h2 id="See_also" name="See_also">関連情報</h2> +<ul> + <li><a href="/ja/docs/Persona" title="Persona">BrowserID</a></li> + <li>{{domxref("navigator.id")}}</li> + <li>{{domxref("navigator.id.watch()")}}</li> + <li>{{domxref("navigator.id.logout()")}}</li> +</ul> diff --git a/files/ja/web/api/identitymanager/request/index.html b/files/ja/web/api/identitymanager/request/index.html new file mode 100644 index 0000000000..df3d91bdeb --- /dev/null +++ b/files/ja/web/api/identitymanager/request/index.html @@ -0,0 +1,75 @@ +--- +title: navigator.id.request +slug: Web/API/IdentityManager/request +tags: + - BrowserID + - DOM + - Gecko DOM Reference + - Persona + - Security +translation_of: Archive/IdentityManager/request +--- +<div> + {{ ApiRef }} {{ non-standard_header }}</div> +<div class="note"> + <strong>注記:</strong> この機能は、まだどのブラウザでもサポートされていません。Persona を使用する Web サイトは、そのページに <a href="https://login.persona.org/include.js" title="https://login.persona.org/include.js">ポリフィルライブラリ</a> を含めなければなりません。</div> +<h2 id="Summary" name="Summary">概要</h2> +<p>この関数は、Web サイトが <a href="/ja/docs/Persona" title="Persona">Persona</a> を使用してユーザの認証ができるようにします。この関数は click ハンドラから呼び出されなければなりません。例えば、ユーザがページ上の「log in with Persona」ボタンをクリックした時に呼び出します。</p> +<p>呼び出された時、<code>navigator.id.request()</code> がユーザにログインするメールアドレスを選択するように求め、さらにユーザの証明書が期限切れの場合は ID プロバイダで認証するように求めます。これらが完了した後、ユーザのメールアドレスとパスワードを含む署名付きの <strong>アサーション</strong> が生成されます。このアサーションは、{{domxref("navigator.id.watch()")}} で登録された <code>onlogin</code> コールバックに渡されます。</p> +<p>この関数は、{{domxref("navigator.id.watch()")}} と連動して <strong>使用されなければなりません</strong>。</p> +<h2 id="Syntax" name="Syntax">構文</h2> +<pre class="syntaxbox">navigator.id.request(); +navigator.id.request({siteName: 'Example Site', siteLogo: '/logo.png'}); +navigator.id.request({termsOfService: '/tos.html', privacyPolicy: '/privacy.html'}); +</pre> +<h3 id="Parameters" name="Parameters">引数</h3> +<dl> + <dt> + <code>oncancel</code> {{ optional_inline() }}</dt> + <dd> + この関数は、ユーザが ID をサイトと共有することを拒否した場合に呼び出されます。</dd> + <dt> + <code>privacyPolicy</code> {{ optional_inline() }}</dt> + <dd> + Web サイトのプライバシーポリシーのページへの絶対パスまたは URL。この引数を指定する場合、<code>termsOfService</code> も指定しなければなりません。<code>termsOfService</code> と <code>privacyPolicy</code> の両方を与えた場合、ログインダイアログに "you confirm that you accept this site's Terms of Use and Privacy Policy." というメッセージを表示してサイトの利用規約とプライバシーポリシーを知らせます。これには、それぞれのページへのリンクが含まれます。<code>termsOfService</code> が指定されない場合、この引数は効果がありません。</dd> + <dt> + <code>returnTo</code> {{ optional_inline() }}</dt> + <dd> + 新しいユーザが最初にメールアドレスの検証を完了した後に表示されるページへの絶対パス。パスは '<code>/</code>' で始めなければなりません。この引数は、Mozilla のフォールバック ID プロバイダにより証明されたユーザにのみ影響します。</dd> + <dt> + <code>siteLogo</code> {{ optional_inline() }}</dt> + <dd> + ログインダイアログに表示する、画像への絶対パス。パスは '<code>/</code>' で始めなければなりません。また、SSL 経由の読み込みが可能でなければなりません。大きなサイズの画像は 100×100 ピクセルに収まるサイズに縮小されます。</dd> + <dt> + <code>siteName</code> {{ optional_inline() }}</dt> + <dd> + ログインダイアログに表示する、サイトのプレーンテキスト表記。Unicode 文字列とスペースは使えますが、マークアップはできません。</dd> + <dt> + <code>termsOfService</code> {{ optional_inline() }}</dt> + <dd> + Web サイトの利用規約のページへの絶対パスまたは URL。この引数を指定する場合、<code>privacyPolicy</code> も指定しなければなりません。<code>termsOfService</code> と <code>privacyPolicy</code> の両方を与えた場合、ログインダイアログに "you confirm that you accept this site's Terms of Use and Privacy Policy." というメッセージを表示してサイトの利用規約とプライバシーポリシーを知らせます。これには、それぞれのページへのリンクが含まれます。<code>privacyPolicy</code> が指定されない場合、この引数は効果がありません。</dd> +</dl> +<h2 id="Example" name="Example">例</h2> +<pre class="brush:js;">var signinLink = document.getElementById('signin'); +if (signinLink) { + signinLink.onclick = function(evt) { + // ユーザから署名付き ID アサーションを要求する + navigator.id.request({ + siteName: 'My Example Site', + siteLogo: '/logo.png', + termsOfService: '/tos.html', + privacyPolicy: '/privacy.html', + returnTo: '/welcome.html', + oncancel: function() { alert('ユーザが ID の共有を拒否しました。'); } + }); + }; +}</pre> +<h2 id="Specification" name="Specification">仕様</h2> +<p>まだどの仕様書にも含まれていません。</p> +<h2 id="See_also" name="See_also">関連情報</h2> +<ul> + <li><a href="/docs/Persona" title="Persona">BrowserID</a></li> + <li>{{domxref("navigator.id")}}</li> + <li>{{domxref("navigator.id.watch()")}}</li> + <li>{{domxref("navigator.id.logout()")}}</li> +</ul> diff --git a/files/ja/web/api/identitymanager/watch/index.html b/files/ja/web/api/identitymanager/watch/index.html new file mode 100644 index 0000000000..7daf89d3ac --- /dev/null +++ b/files/ja/web/api/identitymanager/watch/index.html @@ -0,0 +1,143 @@ +--- +title: navigator.id.watch +slug: Web/API/IdentityManager/watch +tags: + - BrowserID + - DOM + - Persona +translation_of: Archive/IdentityManager/watch +--- +<div>{{ApiRef}} {{non-standard_header}}</div> + +<div class="note"><strong>注記:</strong> この機能は、まだどのブラウザでもサポートされていません。Persona を使用する Web サイトは、そのページに <a href="https://login.persona.org/include.js" title="https://login.persona.org/include.js">ポリフィルライブラリ</a> を含めなければなりません。</div> + +<h2 id="Summary" name="Summary">概要</h2> + +<p>この関数は、<a href="/docs/Persona" title="Persona">Persona</a> ユーザのログインとログアウトに応答するコールバックを登録します。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="brush:js;">navigator.id.watch({ + loggedInUser: 'bob@example.org', + onlogin: function(assertion) { + // ユーザがログインしました! ここで必要なことは: + // 1. 検証とセッション作成のためのアサーションをバックエンドに送信する。 + // 2. UI を更新する。 + }, + onlogout: function() { + // ユーザがログアウトしました! ここで必要なことは: + // リダイレクトするかバックエンドの呼び出しを行って、ユーザのセッションを破棄する。 + } +}); +</pre> + +<h3 id="Parameters" name="Parameters">引数</h3> + +<dl> + <dt><code>loggedInUser </code>{{optional_inline}}</dt> + <dd>このパラメーターはユーザーの状態がどうなっているはずであるかを Persona に伝えるものです。値は文字列か <code>null</code> あるいは <code>undefined</code> です。</dd> + <dd>文字列はユーザーがサイトに現在ログインしているはずであることを表します。この文字列はそのユーザーの E-mail アドレスであって,大文字/小文字は区別します。null は誰もログインしていないはずであることを表します。このパラメーターを省略するか,あるいは undefined を与えるのは,ユーザーがログインしているか否か不明であることを意味します。</dd> + <dd>Persona は常に,ユーザーはサイトにログインしたいか,あるいはしたくないのだと考えています。Persona は loggedInUser の値を自らの信ずるところ(訳注:Persona が認識しているユーザー)と比較し,この二つの状態を一致させるため,(以下の表のごとくに)適切な関数を呼び出します:</dd> + <dd> + <table> + <thead> + <tr> + <th scope="col">loggedInUser</th> + <th scope="col">Persona's State</th> + <th scope="col">Callback</th> + </tr> + </thead> + <tbody> + <tr> + <td><code>null</code></td> + <td>"foo@example.com"</td> + <td><code>onlogin()</code></td> + </tr> + <tr> + <td><code>undefined</code></td> + <td>"foo@example.com"</td> + <td><code>onlogin()</code></td> + </tr> + <tr> + <td>"bar@example.com"</td> + <td>"foo@example.com"</td> + <td><code>onlogin()</code></td> + </tr> + <tr> + <td>"foo@example.com"</td> + <td>"foo@example.com"</td> + <td style="text-align: center;"><em>none</em></td> + </tr> + <tr> + <td><code>null</code></td> + <td><code>null</code></td> + <td style="text-align: center;"><em>none</em></td> + </tr> + <tr> + <td>"foo@example.com"</td> + <td><code>null</code></td> + <td><code>onlogout()</code></td> + </tr> + <tr> + <td><code>undefined</code></td> + <td><code>null</code></td> + <td><code>onlogout()</code></td> + </tr> + </tbody> + </table> + </dd> + <dd>ページが読み込まれた時に Persona が自動的に呼び出すのは <code>onlogin</code> と <code>onlogout</code> の <em>どちらか</em> であることに注意してください。<em>両方</em> 呼ばれることはありません(訳注:表のとおりどちらも呼ばれないことはある)。<code>loggedInUser</code> に <code>foo@example.com</code> がセットされているのに、Persona が <code>bar@example.com</code> がログインしていると認識している場合、<code>onlogin</code> のみが呼び出されます。この場合、第1引数として <code>bar@example.com</code> のアサーションが渡されます。</dd> + <dt><code>onlogin</code></dt> + <dd>ユーザがログインした時に、1 個の引数としてアサーションが渡され、呼び出される関数。この関数は、検証のためにアサーションをサイトのバックエンドに送信します。検証が成功した場合、バックエンドでユーザのセッションを確立し、この関数内で UI (ログインボタン) を適切なものに更新してください。</dd> + <dt><code>onlogout</code> {{ optional_inline() }}</dt> + <dd>ユーザがログアウトした時に、引数なしで呼び出される関数。この関数で、サイトのバックエンドを呼び出すかユーザをリダイレクトすることにより、ユーザのセッションを破棄してください。</dd> + <dd><code>onlogout</code> が与えられなかったとき <a href="/Persona/The_navigator.id_API#The_Observer_API">Observer API</a> によるセッション管理は無効化されます。<code>onready</code> と <code>onlogin</code> だけが呼び出されます。<code>onlogin</code> は、ユーザーによるログイン操作の反応としてしか呼び出されません(つまりユーザーがログインしていた場合に自動的に呼び出されたりはしません)。</dd> + <dt><code>onready</code> {{ optional_inline() }}</dt> + <dd>A function that will be invoked when the user agent is initialized and able to process calls to <code>id.request</code> and <code>id.logout</code>. The onready callback will be invoked immediately after any automatic invocations of <code>onlogin</code>, <code>onlogout</code>, or <code>onmatch</code>. By waiting to display UI until <code>onready</code> is called, relying parties can avoid UI flicker in cases where the user agent's preferred state is out of sync with the site's session.</dd> + <dd>Note that <code>onready</code> will not be invoked after calls to <code>id.request</code> or <code>id.logout</code>. It is the punctuation mark that concludes the conversation started by <code>watch</code>.</dd> +</dl> + +<h2 id="Example" name="Example">コード例</h2> + +<div class="container"> +<pre class="brush: js">navigator.id.watch({ + loggedInUser: currentUser, // This is email of current user logged into your site + + onlogin: function(assertion) { + + $.ajax({ // This example uses jQuery, but you can use whatever you'd like + type: 'POST', + url: '/auth/login', // This is a URL on your website. + data: {assertion: assertion} + success: function(res, status, xhr) { window.location.reload(); }, + error: function(xhr, status, err) { + navigator.id.logout(); + alert("Login failure: " + err); + } + }); + }, + + onlogout: function() { + $.ajax({ + type: 'POST', + url: '/auth/logout', // This is a URL on your website. + success: function(res, status, xhr) { window.location.reload(); }, + error: function(xhr, status, err) { alert("Logout failure: " + err); } + }); + } + +})<code class="js plain">;</code></pre> +</div> + +<h2 id="Specification" name="Specification">仕様</h2> + +<p>まだどの仕様書にも含まれていません。</p> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/docs/Persona" title="Persona">BrowserID</a></li> + <li>{{domxref("navigator.id")}}</li> + <li>{{domxref("navigator.id.logout()")}}</li> + <li>{{domxref("navigator.id.request()")}}</li> +</ul> |
