Skip to content

Commit 1398fa8

Browse files
authored
(ja) Update README.ja.md (#11)
1 parent d4f3096 commit 1398fa8

1 file changed

Lines changed: 67 additions & 47 deletions

File tree

README.ja.md

Lines changed: 67 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
[![FIWARE Banner](https://fiware.github.io/tutorials.Securing-Access/img/fiware.png)](https://www.fiware.org/developers)
1+
[![FIWARE Banner](https://fiware.github.io/tutorials.Securing-Access-OpenID-Connect/img/fiware.png)](https://www.fiware.org/developers)
22

33
[![FIWARE Security](https://nexus.lab.fiware.org/repository/raw/public/badges/chapters/security.svg)](https://github.com/FIWARE/catalogue/blob/master/security/README.md)
44
[![License: MIT](https://img.shields.io/github/license/fiware/tutorials.Securing-Access.svg)](https://opensource.org/licenses/MIT)
55
[![Support badge](https://img.shields.io/badge/tag-fiware-orange.svg?logo=stackoverflow)](https://stackoverflow.com/questions/tagged/fiware)
66
[![OpenID 1.0](https://img.shields.io/badge/OpenID-1.0-ff7059.svg)](https://openid.net/specs/openid-connect-core-1_0.html)
7-
<br/>
8-
[![Documentation](https://img.shields.io/readthedocs/fiware-tutorials.svg)](https://fiware-tutorials.rtfd.io)
7+
<br/> [![Documentation](https://img.shields.io/readthedocs/fiware-tutorials.svg)](https://fiware-tutorials.rtfd.io)
98

109
このチュートリアルは、以前の
1110
[セキュリティで保護されたアクセスのチュートリアル](https://github.com/FIWARE/tutorials.Securing-Access)
@@ -40,6 +39,7 @@ OpenID Connect フローを使用してユーザを認証します。
4039
- [ハイブリッド・フロー](#hybrid-flow)
4140
- [ハイブリッド - サンプル・コード](#authorization-code---sample-code)
4241
- [ハイブリッド - サンプルの実行](#authorization-code---running-the-example)
42+
- [次のステップ](#next-steps)
4343

4444
</details>
4545

@@ -114,20 +114,20 @@ JSON Web Token (JWT) の構造は次のとおりです:
114114

115115
```json
116116
{
117-
"alg": "HS256",
118-
"typ": "JWT"
117+
"alg": "HS256",
118+
"typ": "JWT"
119119
}
120120
```
121121

122122
- ペイロード。トークンが作成された時期と作成者に関する情報だけでなく、ユーザ・データも含まれています。
123123

124124
```json
125125
{
126-
"sub": "1234567890",
127-
"iss": "https://fiware-idm.com",
128-
"iat": 1516239022,
129-
"username": "Alice",
130-
"gravatar": true
126+
"sub": "1234567890",
127+
"iss": "https://fiware-idm.com",
128+
"iat": 1516239022,
129+
"username": "Alice",
130+
"gravatar": true
131131
}
132132
```
133133

@@ -321,21 +321,21 @@ git checkout NGSI-v2
321321
詳細 <b>(クリックして拡大)</b>
322322
</summary>
323323

324-
| 名前 | E メール | パスワード |
325-
| ---------- | ------------------------- | ---------- |
326-
| alice | alice-the-admin@test.com | `test` |
327-
| bob | bob-the-manager@test.com | `test` |
328-
| charlie | charlie-security@test.com | `test` |
329-
| manager1 | manager1@test.com | `test` |
330-
| manager2 | manager2@test.com | `test` |
331-
| detective1 | detective1@test.com | `test` |
332-
| detective2 | detective2@test.com | `test` |
333-
334-
| 名前 | E メール | パスワード |
335-
| ------- | ------------------- | ---------- |
336-
| eve | eve@example.com | `test` |
337-
| mallory | mallory@example.com | `test` |
338-
| rob | rob@example.com | `test` |
324+
| 名前 | E メール | パスワード |
325+
| ---------- | --------------------------- | ---------- |
326+
| alice | `alice-the-admin@test.com` | `test` |
327+
| bob | `bob-the-manager@test.com` | `test` |
328+
| charlie | `charlie-security@test.com` | `test` |
329+
| manager1 | `manager1@test.com` | `test` |
330+
| manager2 | `manager2@test.com` | `test` |
331+
| detective1 | `detective1@test.com` | `test` |
332+
| detective2 | `detective2@test.com` | `test` |
333+
334+
| 名前 | E メール | パスワード |
335+
| ------- | --------------------- | ---------- |
336+
| eve | `eve@example.com` | `test` |
337+
| mallory | `mallory@example.com` | `test` |
338+
| rob | `rob@example.com` | `test` |
339339

340340
</details>
341341

@@ -487,7 +487,7 @@ curl -X PATCH \
487487

488488
```javascript
489489
function authCodeOICGrant(req, res) {
490-
const path = oa.getAuthorizeUrl('code', 'openid', 'oic');
490+
const path = oa.getAuthorizeUrl("code", "openid", "oic");
491491
return res.redirect(path);
492492
}
493493
```
@@ -500,13 +500,13 @@ function authCodeOICGrant(req, res) {
500500
```javascript
501501
function authCodeOICGrantCallback(req, res) {
502502
return oa
503-
.getOAuthAccessToken(req.query.code, 'authorization_code')
504-
.then(results => {
503+
.getOAuthAccessToken(req.query.code, "authorization_code")
504+
.then((results) => {
505505
return getUserFromIdToken(req, results.id_token);
506506
})
507-
.then(user => {
507+
.then((user) => {
508508
// Store user
509-
})
509+
});
510510
}
511511
```
512512

@@ -515,16 +515,23 @@ id_tokenは、環境変数を介してアプリケーションで事前構成し
515515

516516
```javascript
517517
function getUserFromIdToken(req, idToken) {
518-
return new Promise(function(resolve, reject) {
519-
jwt.verify(idToken, jwtSecret, function(error, decoded) {
520-
// Decoded --> JSON with user, token and issuer information
518+
return new Promise(function (resolve, reject) {
519+
jwt.verify(idToken, jwtSecret, function (error, decoded) {
520+
// Decoded --> Json with user, token and issuer information
521+
});
521522
});
522-
});
523523
}
524524
```
525525

526526
デコードされた json は、次のように返されます:
527527

528+
```json
529+
{
530+
"alg": "HS256",
531+
"typ": "JWT"
532+
}
533+
```
534+
528535
```json
529536
{
530537
"organizations": [],
@@ -542,10 +549,22 @@ function getUserFromIdToken(req, idToken) {
542549
"sub": "aaaaaaaa-good-0000-0000-000000000000",
543550
"aud": "tutorial-dckr-site-0000-xpresswebapp",
544551
"exp": 1516238462,
545-
"iat": 1516239022,
552+
"iat": 1516239022
546553
}
547554
```
548555

556+
JWT を自分でデコードするには、トークンを[JWTサイト](https://jwt.io/) に貼り付けることができます -
557+
トークンの署名に使用される署名は `59de900a973fa2e0` であり、サイトに貼り付けて、 エンコードされた
558+
ID は Keyrock から来ました。
559+
560+
```text
561+
HMACSHA256(
562+
base64UrlEncode(header) + "." +
563+
base64UrlEncode(payload),
564+
59de900a973fa2e0
565+
)
566+
```
567+
549568
<a name="authorization-code---running-the-example"/>
550569

551570
### 認可コード - サンプルの実行
@@ -591,7 +610,7 @@ URL を返します。OIDC フローに従う場合、レスポンスのタイ
591610

592611
```javascript
593612
function implicitOICGrant(req, res) {
594-
const path = oa.getAuthorizeUrl('id_token', null, 'oic');
613+
const path = oa.getAuthorizeUrl("id_token", null, "oic");
595614
return res.redirect(path);
596615
}
597616
```
@@ -601,10 +620,9 @@ function implicitOICGrant(req, res) {
601620

602621
```javascript
603622
function implicitOICGrantCallback(req, res) {
604-
return getUserFromIdToken(req, req.query.id_token)
605-
.then(user => {
606-
// Store User and return
607-
})
623+
return getUserFromIdToken(req, req.query.id_token).then((user) => {
624+
// Store User and return
625+
});
608626
}
609627
```
610628

@@ -654,8 +672,8 @@ id_token が生成されます。 スコープ "openid" も含める場合、以
654672

655673
```javascript
656674
function hybridOICGrant(req, res) {
657-
const path = oa.getAuthorizeUrl('code id_token token', 'openid', 'oic');
658-
return res.redirect(path);
675+
const path = oa.getAuthorizeUrl("code id_token token", "openid", "oic");
676+
return res.redirect(path);
659677
}
660678

661679
```
@@ -667,11 +685,11 @@ function hybridOICGrant(req, res) {
667685
```javascript
668686
function authCodeOICGrantCallback(req, res) {
669687
return oa
670-
.getOAuthAccessToken(req.query.code, 'hybrid')
671-
.then(results => {
688+
.getOAuthAccessToken(req.query.code, "hybrid")
689+
.then((results) => {
672690
return getUserFromIdToken(req, results.id_token);
673691
})
674-
.then(user => {
692+
.then((user) => {
675693
// Store User and return
676694
})
677695
}
@@ -703,15 +721,17 @@ id_token は、認可コードのセクションで説明したように、JWT S
703721
> **Keyrock** セッションが後続の認証リクエストに使用されるため、 **Keyrock** ログイン画面が再び表示されることは
704722
> ありません。
705723
724+
<a name="next-steps"></a>
725+
706726
# 次のステップ
707727

708728
高度な機能を追加することで、アプリケーションに複雑さを加える方法を知りたいですか
709729
?このシリーズ
710730
[他のチュートリアル](https://www.letsfiware.jp/fiware-tutorials)を読むことで見
711-
つけることができます :
731+
つけることができます
712732

713733
---
714734

715735
## License
716736

717-
[MIT](LICENSE) © 2018-2020 FIWARE Foundation e.V.
737+
[MIT](LICENSE) © 2018-2022 FIWARE Foundation e.V.

0 commit comments

Comments
 (0)