From 0165eec11196fd8f33022e2f9b4f99bd45b75185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mr=C3=B3z?= Date: Sat, 25 Nov 2023 12:37:41 +0100 Subject: [PATCH 1/4] removed invalid token from JSON in ./class/snippets/3-token-request.js --- class/snippets/3-token-request.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/snippets/3-token-request.js b/class/snippets/3-token-request.js index a832c2a0..6d0b1133 100644 --- a/class/snippets/3-token-request.js +++ b/class/snippets/3-token-request.js @@ -114,7 +114,7 @@ app.post("/token", function(req, res){ var token_response = { access_token: access_token, token_type: 'Bearer', - scope: code.scope ? code.scope.join(' ') : null; + scope: code.scope ? code.scope.join(' ') : null }; res.status(200).json(token_response); From 9b59cf410e1390faf5dbdb9cb2bf341b6f9b543f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mr=C3=B3z?= Date: Sat, 25 Nov 2023 12:39:04 +0100 Subject: [PATCH 2/4] added 'How to Install and Run the Project' section --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 6221782d..617a018a 100644 --- a/README.md +++ b/README.md @@ -13,3 +13,24 @@ OAuth 2 in Action teaches you practical use and deployment of this protocol from ## About the authors Justin Richer is a systems architect, software engineer, standards editor, and service designer working as an independent consultant. [Antonio Sanso](http://blog.intothesymmetry.com/) works as Security Software Engineer, he is a vulnerability security researcher and an active open source contributor. + +## How to Install and Run the Project + +### Clone Repository + +Using terminal go to directory of your choosing and execute ```git clone https://github.com/oauthinaction/oauth-in-action-code.git``` + +### Install Dependencies + +Repository contains multiple project, each requiring to install it's dependencies before executing any code. You can go to each directory containing ```package.json``` file and then run ```npm i``` or you can run ```find . -type d -name node_modules -prune -o -name package.json -print -execdir npm i \;``` from the project's root to install all dependencies for all ```package.json``` files in repository at once. + +### Run Project + +To execute any file written in JavaScript using node simply run ```node [file_name]``` in terminal for eg. ```node client.js```. + +Some examples require to run multiple files concurrently to work properly, to achive this you can install "concurrently" package globaly using ```npm i -g concurrently```. After that you can run multiple files using ```concurrently "node [file_name1]" "node [file_name2]" "node [file_name3]" ...``` for eg. ```concurrently "node client.js" "node authorizationServer.js" "node protectedResource.js"```. To stop running those files in terminal use ```CTRL + C``` shortcut to abort execution. + +Generally each running file will be available on your ```localhost```. To access them simple use your web browser and type ```localhost:[port]``` in search bar. To check for correct port refer to each file you want to run, but most of times those ports are: ```9000```, ```9001``` and ```9002``` for eg. +* client.js - ```localhost:9000``` +* authorizationServer.js - ```localhost:9001``` +* protectedResource.js - ```localhost:9002``` \ No newline at end of file From a36775ddd2ce52d1487bf8b1f38703f2efbf4378 Mon Sep 17 00:00:00 2001 From: Justin Richer Date: Thu, 7 Dec 2023 11:11:14 -0500 Subject: [PATCH 3/4] Update README.md --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 617a018a..4c9883ec 100644 --- a/README.md +++ b/README.md @@ -22,15 +22,17 @@ Using terminal go to directory of your choosing and execute ```git clone https:/ ### Install Dependencies -Repository contains multiple project, each requiring to install it's dependencies before executing any code. You can go to each directory containing ```package.json``` file and then run ```npm i``` or you can run ```find . -type d -name node_modules -prune -o -name package.json -print -execdir npm i \;``` from the project's root to install all dependencies for all ```package.json``` files in repository at once. +Repository contains multiple project, each requiring to install its dependencies before executing any code. For each exercise, enter the directory and run ```npm install``` to install dependencies before executing the code. ### Run Project To execute any file written in JavaScript using node simply run ```node [file_name]``` in terminal for eg. ```node client.js```. -Some examples require to run multiple files concurrently to work properly, to achive this you can install "concurrently" package globaly using ```npm i -g concurrently```. After that you can run multiple files using ```concurrently "node [file_name1]" "node [file_name2]" "node [file_name3]" ...``` for eg. ```concurrently "node client.js" "node authorizationServer.js" "node protectedResource.js"```. To stop running those files in terminal use ```CTRL + C``` shortcut to abort execution. - -Generally each running file will be available on your ```localhost```. To access them simple use your web browser and type ```localhost:[port]``` in search bar. To check for correct port refer to each file you want to run, but most of times those ports are: ```9000```, ```9001``` and ```9002``` for eg. -* client.js - ```localhost:9000``` -* authorizationServer.js - ```localhost:9001``` -* protectedResource.js - ```localhost:9002``` \ No newline at end of file +Some examples require to run multiple files concurrently to work properly (for example, the authorization server, client, and resource server components), and it is recommended that each file be executed in its own separate environment, such as in separate terminal windows. + +Each service runs on ```localhost``` and is usually available over HTTP. + +The usual ports for items is: +* client.js - ```http://localhost:9000/``` +* authorizationServer.js - ```http://localhost:9001/``` +* protectedResource.js - ```http://localhost:9002/``` \ No newline at end of file From a0512426cd0929235e4f28f984cbff9d21046b2d Mon Sep 17 00:00:00 2001 From: task4233 <29667656+task4233@users.noreply.github.com> Date: Sun, 7 Jan 2024 20:58:03 +0900 Subject: [PATCH 4/4] change(ch-12-ex-2): fix the deletion part for a dynamic registration --- exercises/ch-12-ex-2/completed/authorizationServer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/ch-12-ex-2/completed/authorizationServer.js b/exercises/ch-12-ex-2/completed/authorizationServer.js index 5815a070..263a8f9a 100644 --- a/exercises/ch-12-ex-2/completed/authorizationServer.js +++ b/exercises/ch-12-ex-2/completed/authorizationServer.js @@ -401,7 +401,7 @@ app.delete('/register/:clientId', authorizeConfigurationEndpointRequest, functio clients = __.reject(clients, __.matches({client_id: req.client.client_id})); nosql.remove().make(function(builder) { - builder.where('client_id', clientId); + builder.where('client_id', req.client.clientId); builder.callback(function(err, count) { console.log("Removed %s tokens", count); });