Skip to content

Commit 5520b3f

Browse files
committed
Format README
1 parent 43d3e75 commit 5520b3f

1 file changed

Lines changed: 27 additions & 27 deletions

File tree

README.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -219,20 +219,20 @@ tutorial:
219219
default:
220220
ipv4_address: 172.18.1.7
221221
expose:
222-
- "3000"
223-
- "3001"
222+
- '3000'
223+
- '3001'
224224
ports:
225-
- "3000:3000"
226-
- "3001:3001"
225+
- '3000:3000'
226+
- '3001:3001'
227227
environment:
228-
- "DEBUG=tutorial:*"
229-
- "WEB_APP_PORT=3000"
230-
- "KEYROCK_URL=http://localhost"
231-
- "KEYROCK_IP_ADDRESS=http://172.18.1.5"
232-
- "KEYROCK_PORT=3005"
233-
- "KEYROCK_CLIENT_ID=tutorial-dckr-site-0000-xpresswebapp"
234-
- "KEYROCK_CLIENT_SECRET=tutorial-dckr-site-0000-clientsecret"
235-
- "CALLBACK_URL=http://localhost:3000/login"
228+
- 'DEBUG=tutorial:*'
229+
- 'WEB_APP_PORT=3000'
230+
- 'KEYROCK_URL=http://localhost'
231+
- 'KEYROCK_IP_ADDRESS=http://172.18.1.5'
232+
- 'KEYROCK_PORT=3005'
233+
- 'KEYROCK_CLIENT_ID=tutorial-dckr-site-0000-xpresswebapp'
234+
- 'KEYROCK_CLIENT_SECRET=tutorial-dckr-site-0000-clientsecret'
235+
- 'CALLBACK_URL=http://localhost:3000/login'
236236
```
237237
238238
The `tutorial` container is listening on two ports:
@@ -491,13 +491,13 @@ function userCredentialGrant(req, res) {
491491
```javascript
492492
function getUserFromAccessToken(req, accessToken) {
493493
return new Promise(function (resolve, reject) {
494-
oa.get(keyrockIPAddress + "/user", accessToken)
494+
oa.get(keyrockIPAddress + '/user', accessToken)
495495
.then((response) => {
496496
const user = JSON.parse(response);
497497
return resolve(user);
498498
})
499499
.catch((error) => {
500-
req.flash("error", "User not found");
500+
req.flash('error', 'User not found');
501501
return reject(error);
502502
});
503503
});
@@ -536,7 +536,7 @@ form `/oauth/authorize?response_type=code&client_id={{client-id}}&state=xyz&redi
536536

537537
```javascript
538538
function authCodeGrant(req, res) {
539-
const path = oa.getAuthorizeUrl("code");
539+
const path = oa.getAuthorizeUrl('code');
540540
return res.redirect(path);
541541
}
542542
```
@@ -591,7 +591,7 @@ form `/oauth/authorize?response_type=token&client_id={{client-id}}&state=xyz&red
591591

592592
```javascript
593593
function implicitGrant(req, res) {
594-
const path = oa.getAuthorizeUrl("token");
594+
const path = oa.getAuthorizeUrl('token');
595595
return res.redirect(path);
596596
}
597597
```
@@ -828,7 +828,7 @@ To check whether a **Keyrock** `access_token` has expired, you can try to retrie
828828
```javascript
829829
function pdpAuthentication(req, res, next) {
830830
const keyrockUserUrl =
831-
keyrockIPAddress + "/user" + "?access_token=" + req.session.access_token + "&app_id=" + clientId;
831+
keyrockIPAddress + '/user' + '?access_token=' + req.session.access_token + '&app_id=' + clientId;
832832
return oa
833833
.get(keyrockUserUrl)
834834
.then((response) => {
@@ -908,20 +908,20 @@ set a flag:
908908
function pdpBasicAuthorization(req, res, next, url = req.url) {
909909
const keyrockUserUrl =
910910
keyrockIPAddress +
911-
"/user" +
912-
"?access_token=" +
911+
'/user' +
912+
'?access_token=' +
913913
req.session.access_token +
914-
"&action=" +
914+
'&action=' +
915915
req.method +
916-
"&resource=" +
916+
'&resource=' +
917917
url +
918-
"&app_id=" +
918+
'&app_id=' +
919919
clientId;
920920
return oa
921921
.get(keyrockUserUrl)
922922
.then((response) => {
923923
const user = JSON.parse(response);
924-
res.locals.authorized = user.authorization_decision === "Permit";
924+
res.locals.authorized = user.authorization_decision === 'Permit';
925925
return next();
926926
})
927927
.catch((error) => {
@@ -938,8 +938,8 @@ example of a Policy Enforcement Point (PEP):
938938
```javascript
939939
function priceChange(req, res) {
940940
if (!res.locals.authorized) {
941-
req.flash("error", "Access Denied");
942-
return res.redirect("/");
941+
req.flash('error', 'Access Denied');
942+
return res.redirect('/');
943943
}
944944
/// Continue with the normal flow of execution...
945945
}
@@ -951,8 +951,8 @@ example of a Policy Enforcement Point (PEP):
951951
```javascript
952952
function sendCommand(req, res) {
953953
if (!res.locals.authorized) {
954-
res.setHeader("Content-Type", "application/json");
955-
return res.status(403).send({ message: "Forbidden" });
954+
res.setHeader('Content-Type', 'application/json');
955+
return res.status(403).send({ message: 'Forbidden' });
956956
}
957957
/// Continue with the normal flow of execution...
958958
}

0 commit comments

Comments
 (0)