Skip to content

Commit 6673dd9

Browse files
committed
update traslate
1 parent dc28518 commit 6673dd9

File tree

1 file changed

+15
-67
lines changed

1 file changed

+15
-67
lines changed

guide/authentication/index.md

+15-67
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,10 @@
22
title: 認証
33
---
44

5-
<<<<<<< HEAD
6-
このAPIにおいては、認証には2つの選択肢があり、基本的に以下のように選びましょう。
5+
このAPIにおいては、認証には幾つかの選択肢があり、基本的に以下のように選びましょう。
76

87
* そのサイトで有効化されたテーマやプラグインから利用するのであれば **クッキー認証**
9-
* デスクトップアプリ、ウェブアプリ、モバイルアプリなどのサイトの外からアクセスするクライアントから API を利用するのであれば **OAuth 認証**
10-
=======
11-
There are several options for authenticating with the API. The basic choice boils
12-
down to:
13-
14-
* Are you a plugin/theme running on the site? Use **cookie authentication**
15-
* Are you a desktop/web/mobile client accessing the site externally? Use
16-
**OAuth authentication**, **application passwords**, or **basic authentication**.
17-
>>>>>>> upstream/gh-pages
8+
* デスクトップアプリ、ウェブアプリ、モバイルアプリなどのサイトの外からアクセスするクライアントから API を利用するのであれば **OAuth 認証**, **アプリケーションパスワード** または **ベーシック認証**
189

1910
クッキー認証
2011
---------------------
@@ -30,8 +21,7 @@ down to:
3021
独自のデータモデルからアクセスする場合には、 `wp.api.models.Base` を継承することで、
3122
あらゆるカスタムリクエストで nonce がきちんと送信されることが保証されます。
3223

33-
<<<<<<< HEAD
34-
マニュアルで Ajax リクエストを送る場合、nonce は各リクエストで毎回送信する必要があります。
24+
マニュアルで Ajax リクエストを送る場合、nonce は各リクエストで毎回送信する必要があります。
3525
送信された nonce は `wp_rest` にセットされたアクションと一緒に利用されます。
3626
API への nonce の受け渡しは、POST のデータや GET のクエリの `_wpnonce` パラメータ、
3727
あるいは`X-WP-Nonce` ヘッダーにセットして行います。
@@ -42,21 +32,6 @@ Note: Until recently, most software had spotty support for `DELETE` requests. Fo
4232
このクッキー認証が利用できるのは、REST API が WordPress の内部から使われていて、
4333
かつ、ユーザーがログインしている時のみであるということです。
4434
さらに、そのログインユーザーが、実行しようとしているアクションに必要な権限を与えられているということも条件となります。
45-
=======
46-
For developers making manual Ajax requests, the nonce will need to be passed
47-
with each request. The API uses nonces with the action set to `wp_rest`. These
48-
can then be passed to the API via the `_wpnonce` data parameter (either POST
49-
data or in the query for GET requests), or via the `X-WP-Nonce` header.
50-
51-
Note: Until recently, most software had spotty support for `DELETE` requests. For
52-
instance, PHP doesn't transform the request body of a `DELETE` request into a super
53-
global. As such, supplying the nonce as a header is the most reliable approach.
54-
55-
It is important to keep in mind that this authentication method relies on WordPress
56-
cookies. As a result this method is only applicable when the REST API is used inside
57-
of WordPress and the current user is logged in. In addition, the current user must
58-
have the appropriate capability to perform the action being performed.
59-
>>>>>>> upstream/gh-pages
6035

6136
以下は、ビルトインの Javascript クライアントが nonce を生成する例です。
6237

@@ -105,14 +80,9 @@ OAuth 認証でも、ユーザーは通常の WordPress ログイン画面を通
10580
その後、自身に代わって処理を行うクライアントを認証します。
10681
クライアントには、OAuth トークンが発行され、API へのアクセスが許可されます。このアクセス権はユーザー側からいつでも取り消すことができます。
10782

108-
<<<<<<< HEAD
10983
OAuth 認証は、[OAuth 1.0a specification][oauth] (published as
11084
RFC5849) を利用しており、[OAuth plugin][oauth-plugin] がサイトで
111-
有効化されていることが必要です(このプラグインは将来的にコアにマージされます)。
112-
=======
113-
OAuth authentication uses the [OAuth 1.0a specification][oauth] (published as
114-
RFC5849) and requires installing the [OAuth plugin][oauth-plugin] on the site.
115-
>>>>>>> upstream/gh-pages
85+
有効化されていることが必要です。
11686

11787
WP API と OAuth サーバー用のプラグインを有効化したら、コンシューマを作成しましょう。
11888
コンシューマは、アプリケーションの識別子であり、サイトとリンクするために必要な key と secret からなります。
@@ -137,47 +107,25 @@ Secret: LnUdIsyhPFnURkatekRIAUfYV7nmP4iF3AVxkS5PRHPXxgOW
137107
[client-cli]: https://github.com/WP-API/client-cli
138108
[api-console]: https://github.com/WP-API/api-console
139109

140-
<<<<<<< HEAD
141110

142-
ベーシック認証
111+
アプリケーションパスワードまたはベーシック認証
143112
--------------------
144113
ベーシック認証は、外部クライアントから利用できる認証の代替的な方法です。
145114
OAuth 認証は複雑なので、開発段階ではベーシック認証が便利でしょう。
146115
ただし、ベーシック認証ではすべてのリクエストにおいてユーザー名とパスワードを送る必要があり、
147-
本番の環境で利用することは超非推奨です。
148-
149-
ベーシック認証は、 [HTTP Basic Authentication][http-basic] (published as RFC2617) を利用しており [Basic Auth plugin][basic-auth-plugin] プラグインの有効化が必要です。
116+
本番の環境で利用することは断じて非推奨です。
150117

151-
ベーシック認証の利用時、ユーザー名とパスワードは各リクエストの `Authorization` ヘッダーを通じて渡します。
152-
この値は、HTTP Basic 認証の仕様に従い、base64 でエンコードされるべきです。
118+
アプリケーションパスワードも似たような用途で使用されます。しかしながらこれは、あなたの通常のWordPressパスワードに代わるもので、ユニークであり破棄することが簡単で、WordPressのプロフィール画面で変更することができるものです。これらのアプリケーションパスワードは、REST-APIや旧来のXML-RPCで使用されるもので、WordPressの管理画面にログインするために使用されるものではありません。
153119

154-
以下は、ベーシック認証による、WordPress のHTTP API を使った投稿の更新の例です。
155-
=======
156-
Application Passwords or Basic Authentication
157-
---------------------------------------------
158-
Basic authentication is an optional authentication handler for external clients.
159-
Due to the complexity of OAuth authentication, basic authentication can be
160-
useful during development. However, Basic authentication requires passing your
161-
username and password on every request, as well as giving your credentials to
162-
clients, so it is heavily discouraged for production use.
120+
ベーシック認証とアプリケーションパスワードは、[HTTP Basic Authentication][http-basic]
121+
(published as RFC2617) を利用しており、[Basic Auth plugin][basic-auth-plugin] または
122+
[Application Passwords plugin][application-passwords] のどちらかを有効化する必要があります。
163123

164-
Application passwords are used similarly, however instead of providing your normal
165-
account password, unique and easily revokable passwords are generated from your
166-
edit profile screen in the WordPress admin. These application passwords are valid
167-
exclusively for the REST API and the legacy XML-RPC API and may not be used to log
168-
in to WordPress.
124+
ベーシック認証を使用するには、ユーザー名とパスワードをリクエストごとに`Authentication`ヘッダーで送信するだけです。この値は認証のたびにBase64エンドコードでエンコードされるべきです。
169125

170-
Both basic authentication and application passwords use [HTTP Basic Authentication][http-basic]
171-
(published as RFC2617) and requires installing either the [Basic Auth plugin][basic-auth-plugin] or
172-
[Application Passwords plugin][application-passwords] respectively.
173126

174-
To use Basic authentication, simply pass the username and password with each
175-
request through the `Authorization` header. This value should be encoded (using
176-
base64 encoding) as per the HTTP Basic specification.
127+
これは、投稿をアップデートするためのサンプルで、WordPress HTTP APIを用いて認証を行っています。
177128

178-
This is an example of how to update a post, using these authentications, via the
179-
WordPress HTTP API:
180-
>>>>>>> upstream/gh-pages
181129

182130
```php
183131
$headers = array (
@@ -186,7 +134,7 @@ $headers = array (
186134
$url = rest_url( 'wp/v2/posts/1' );
187135

188136
$body = array(
189-
'title' => 'Hello Gaia'
137+
'title' => 'Hello Gaia'
190138
);
191139

192140
$response = wp_remote_post( $url, array (
@@ -195,8 +143,8 @@ $response = wp_remote_post( $url, array (
195143
'body' => $data
196144
) );
197145
```
198-
146+
199147

200148
[http-basic]: https://tools.ietf.org/html/rfc2617
201149
[basic-auth-plugin]: https://github.com/WP-API/Basic-Auth
202-
[application-passwords]: https://github.com/georgestephanis/application-passwords
150+
[application-passwords]: https://github.com/georgestephanis/application-passwords

0 commit comments

Comments
 (0)