From c3a10d379dd210b3fb92589e7ffa60b626c01391 Mon Sep 17 00:00:00 2001 From: Erez Sharim Date: Wed, 22 Mar 2023 11:20:11 +0200 Subject: [PATCH] updates example - add region to issuer url - correct redirect_uri --- Gemfile.lock | 100 +++++++++++++++++++++++++++++++-------------------- README.md | 20 ++++++++--- 2 files changed, 77 insertions(+), 43 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e13af87..9ad46ce 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,80 +1,104 @@ GEM remote: https://rubygems.org/ specs: - activemodel (6.1.4.1) - activesupport (= 6.1.4.1) - activesupport (6.1.4.1) + activemodel (7.0.4.3) + activesupport (= 7.0.4.3) + activesupport (7.0.4.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - zeitwerk (~> 2.3) aes_key_wrap (1.1.0) attr_required (1.0.1) - bindata (2.4.10) - concurrent-ruby (1.1.9) - httpclient (2.8.3) - i18n (1.8.10) + bindata (2.4.15) + concurrent-ruby (1.2.2) + date (3.3.3) + faraday (2.7.4) + faraday-net_http (>= 2.0, < 3.1) + ruby2_keywords (>= 0.0.4) + faraday-follow_redirects (0.3.0) + faraday (>= 1, < 3) + faraday-net_http (3.0.2) + i18n (1.12.0) concurrent-ruby (~> 1.0) - json-jwt (1.13.0) + json-jwt (1.16.3) activesupport (>= 4.2) aes_key_wrap bindata - mail (2.7.1) + faraday (~> 2.0) + faraday-follow_redirects + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp mini_mime (1.1.2) - minitest (5.14.4) - mustermann (1.1.1) + minitest (5.18.0) + mustermann (3.0.0) ruby2_keywords (~> 0.0.1) + net-imap (0.3.4) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout + net-smtp (0.3.3) + net-protocol nio4r (2.5.8) - openid_connect (1.3.0) + openid_connect (2.2.0) activemodel attr_required (>= 1.0.0) - json-jwt (>= 1.5.0) - rack-oauth2 (>= 1.6.1) - swd (>= 1.0.0) + faraday (~> 2.0) + faraday-follow_redirects + json-jwt (>= 1.16) + net-smtp + rack-oauth2 (~> 2.2) + swd (~> 2.0) tzinfo validate_email validate_url - webfinger (>= 1.0.1) - public_suffix (4.0.6) - puma (5.5.2) + webfinger (~> 2.0) + public_suffix (5.0.1) + puma (6.1.1) nio4r (~> 2.0) - rack (2.2.3) - rack-oauth2 (1.19.0) + rack (2.2.6.4) + rack-oauth2 (2.2.0) activesupport attr_required - httpclient + faraday (~> 2.0) + faraday-follow_redirects json-jwt (>= 1.11.0) rack (>= 2.1.0) - rack-protection (2.1.0) + rack-protection (3.0.5) rack ruby2_keywords (0.0.5) - sinatra (2.1.0) - mustermann (~> 1.0) - rack (~> 2.2) - rack-protection (= 2.1.0) + sinatra (3.0.5) + mustermann (~> 3.0) + rack (~> 2.2, >= 2.2.4) + rack-protection (= 3.0.5) tilt (~> 2.0) - swd (1.3.0) + swd (2.0.2) activesupport (>= 3) attr_required (>= 0.0.5) - httpclient (>= 2.4) - tilt (2.0.10) - tzinfo (2.0.4) + faraday (~> 2.0) + faraday-follow_redirects + tilt (2.1.0) + timeout (0.3.2) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) validate_email (0.1.6) activemodel (>= 3.0) mail (>= 2.2.5) - validate_url (1.0.13) + validate_url (1.0.15) activemodel (>= 3.0.0) public_suffix - webfinger (1.2.0) + webfinger (2.1.2) activesupport - httpclient (>= 2.4) - zeitwerk (2.4.2) + faraday (~> 2.0) + faraday-follow_redirects PLATFORMS - x86_64-darwin-20 x86_64-linux DEPENDENCIES @@ -83,7 +107,7 @@ DEPENDENCIES sinatra RUBY VERSION - ruby 3.0.2p107 + ruby 3.1.3p185 BUNDLED WITH - 2.2.22 + 2.3.26 diff --git a/README.md b/README.md index ca79bff..e022f10 100644 --- a/README.md +++ b/README.md @@ -9,22 +9,32 @@ A Ruby project that demonstrates how to perform authentication and authorization ## Running locally -First, install dependencies: +First, install dependencies (if up to date dependencies are crucial, you should remove Gemfile.lock): ```bash bundler ``` +Depending or your env, you'll might need to install ruby-development, for example (depending on distro): + +```bash +sudo apt-get install ruby-dev +sudo yum install ruby-devel +sudo zypper install ruby-devel +``` + Then you can run the server with rackup: ```bash CLIENT_ID=\ CLIENT_SECRET= \ -REDIRECT_URI=https://localhost/callback \ -ISSUER_BASE_URL=https://.crossid.io/oauth2/ \ +REDIRECT_URI=http://localhost:9292/callback \ +ISSUER_BASE_URL=https://..crossid.io/oauth2/ \ rackup ``` +Depending on your "rack" version, you might need to run "bundle exec rackup" + ## Deploying on Digital Ocean Click this button to deploy the app to the DigitalOcean App Platform. @@ -33,13 +43,13 @@ Click this button to deploy the app to the DigitalOcean App Platform. Note: when creating the web app, put a temporary URLs in _Redirect URI_ and _Logout URI_ until the app is deployed. -Fill the needed enviroment variables: `ISSUER_BASE_URL`, `CLIENT_ID` and `CLIENT_SECRET`. +Fill the needed environment variables: `ISSUER_BASE_URL`, `CLIENT_ID` and `CLIENT_SECRET`. Or if you have `doctl` installed then run: `doctl apps create --spec .do/app.yaml` -Then go to the DigitalOcean admin screen and update the enviroment variables as stated above. +Then go to the DigitalOcean admin screen and update the environment variables as stated above. Take note of the public url of your new app. (replace _{public_url}_ below with the public url)