From aa20ad4fdc05b2bd62b1dfdb9db6b927e3d6ae94 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 30 Mar 2023 12:39:00 -0700 Subject: [PATCH 1/3] updates package versions in gemfiles, readmes and directory sync app --- ruby-directory-sync-example/Gemfile.lock | 12 +- ruby-directory-sync-example/app.rb | 35 +- .../public/images/settings-2.svg | 1 + .../public/images/workos_favicon.png | Bin 0 -> 11003 bytes .../public/styles/styles.css | 395 ++++++++++-------- ruby-directory-sync-example/views/index.erb | 93 ++++- 6 files changed, 322 insertions(+), 214 deletions(-) create mode 100644 ruby-directory-sync-example/public/images/settings-2.svg create mode 100644 ruby-directory-sync-example/public/images/workos_favicon.png diff --git a/ruby-directory-sync-example/Gemfile.lock b/ruby-directory-sync-example/Gemfile.lock index e086104..5a34d6d 100644 --- a/ruby-directory-sync-example/Gemfile.lock +++ b/ruby-directory-sync-example/Gemfile.lock @@ -1,8 +1,8 @@ GEM remote: https://rubygems.org/ specs: - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) daemons (1.4.1) dotenv (2.7.6) em-websocket (0.3.8) @@ -11,8 +11,8 @@ GEM eventmachine (1.2.7) mustermann (1.1.2) ruby2_keywords (~> 0.0.1) - public_suffix (4.0.7) - rack (2.2.4) + public_suffix (5.0.1) + rack (2.2.6.4) rack-protection (2.2.0) rack ruby2_keywords (0.0.5) @@ -25,12 +25,12 @@ GEM em-websocket (~> 0.3.6) eventmachine thin (>= 1.3.1, < 2.0.0) - sorbet-runtime (0.5.10274) + sorbet-runtime (0.5.10741) thin (1.8.1) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) rack (>= 1, < 3) - tilt (2.0.11) + tilt (2.1.0) workos (2.5.0) sorbet-runtime (~> 0.5) diff --git a/ruby-directory-sync-example/app.rb b/ruby-directory-sync-example/app.rb index 67a15d7..ddd706f 100644 --- a/ruby-directory-sync-example/app.rb +++ b/ruby-directory-sync-example/app.rb @@ -6,7 +6,6 @@ require 'workos' require 'json' require 'sinatra-websocket' -require 'pry' set :server, 'thin' set :sockets, [] @@ -14,13 +13,39 @@ # Pull API key from ENV variable WorkOS.key = ENV['WORKOS_API_KEY'] -get '/' do - @directories_list = WorkOS::DirectorySync.list_directories - @directories = @directories_list.data +enable :sessions + +use( + Rack::Session::Cookie, + key: 'rack.session', + domain: 'localhost', + path: '/', + expire_after: 2_592_000, + secret: SecureRandom.hex(16) +) +get '/' do + before = params[:before] + after = params[:after] + puts before + puts after + if !before + @directories = WorkOS::DirectorySync.list_directories( + limit: 5 + ) + else + @directories = WorkOS::DirectorySync.list_directories( + limit: 5, + before: before, + after: after + ) + end + @before = @directories.list_metadata["before"] + @after = @directories.list_metadata["after"] erb :index, :layout => false end + get '/directories/:id' do @groups_list = WorkOS::DirectorySync.list_groups(directory: params[:id]) @groups = @groups_list.data @@ -32,7 +57,7 @@ get '/users/:id' do @user = WorkOS::DirectorySync.get_user(params[:id]) - @user_groups_list = WorkOS::DirectorySync.list_groups(user: params[:id]) + @user_groups_list = WorkOS::DirectorySync.list_groups(user: params[:id], limit: 5) @user_groups = @user_groups_list.data erb :user diff --git a/ruby-directory-sync-example/public/images/settings-2.svg b/ruby-directory-sync-example/public/images/settings-2.svg new file mode 100644 index 0000000..b385fa5 --- /dev/null +++ b/ruby-directory-sync-example/public/images/settings-2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruby-directory-sync-example/public/images/workos_favicon.png b/ruby-directory-sync-example/public/images/workos_favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..b5babc32d2611c474f402517e5b437f78e8c6f36 GIT binary patch literal 11003 zcmZ{KcRZW#*Z-XeVh1&flG-&>ic*zOd&Vj)YP9w&QCnh?sJ*pSrKPGy z?Y(yqV*Jw2_xp_B^Ln2Ab6@v4=Y5@Vook&tF=$;i8cH@w003w-)RheY07Ptp04N#p zVeVOE2LRNrj(6^$HSXMjqdnd299?VyKs_eSg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HVA4|b)+`?6_iuPd7K2c(E@-BC-9l@9}c%fAS z)GnN>KBKpWA(l7SVQ8_onBkR-Z;y*v;Do5MvZk;H;=c`-O{zzHwTY3v4jDkX zub2n>$(Bx#sGrBN6fvo^OGNd^y8YD|3xr>MYV1tl7})~xemd>7+$z`OPh#U~&qjq( z5Iq3EF+1Xqa?COTG&&g<(*MnbAtVYa!guQ1X8^&G_ql>sD5yR9lp)b50jM@j@KX%o zXG5tgiTcH5!k6}my_;Vj%wH#Z;0lLL-#1$BU$R@}M4g0ih@`595tMUjApG0$-5n~w zcBE~>-BSVd#O%(NnKf(6nDwv{T=5BAep6js(rXw2BH4_u@=!HTgZLKgP-p1X~0fiL&i+r?=#6~ z&;L$}P*ine@DFw~0o=kT-cSeyF^6eG4jT!6?wfHyaz+Z2fw!IytOjk*yNF@4Y1{vy z2JM};SbGU1=Y>G?1V{7Z;fmpAAl6hgahJsM!#KtJ;9gW`$YQ4CHC z+6PgXh@amr6Ud=fINRw`8(EUHU|xs9siF;-?h?*W-{c|Jlu4w5W@RTByLVC7S4)0> zN{E4GDxo6!=~A0$f6jL$l{}v=VtwJT_zQMyHDWZ + + > + + - - > - - - - -
-
- " alt="workos logo"> + + +
+
+

Ruby Directory Sync Example App

+ + +
+
+
+
+
+

Select a Directory

+
+
-

Ruby Directory Sync Example App

-
-
- - Test Webhooks - <% if @directories.any? %> -
-

Directories

- <% @directories.each do |directory|%> - <%= directory.name %> -
- <% end %> - <% end %> +
+
+ + + + + + + <% @directories.data.each do |i| %> + + + + + + <% end %> +
DirectoryIDView Settings
<%= i.name %><%= i.id %>" class="icon" alt="workos logo">
+
+
+ <% if @after %> +
+ +
+ <% end %> + <% if @before %> +
+ +
+ <% end %> +
+
- + + \ No newline at end of file From fd951c15171b9b8b98938fd44f45457fc62f8e07 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 30 Mar 2023 12:48:17 -0700 Subject: [PATCH 2/3] runs bundle update on all apps --- ruby-admin-portal-example/Gemfile | 2 +- ruby-audit-logs-example/README.md | 17 ++- ruby-audit-logs-example/app.rb | 2 - ruby-audit-logs-example/audit_log_events.rb | 96 -------------- ruby-audit-logs-example/views/login.erb | 7 - ruby-magic-link-example/Gemfile | 2 +- ruby-magic-link-example/Gemfile.lock | 10 +- ruby-mfa-example/Gemfile | 2 +- ruby-mfa-example/Gemfile.lock | 10 +- ruby-rails-sso-example/Gemfile | 3 +- ruby-rails-sso-example/Gemfile.lock | 139 ++++++++++---------- ruby-sso-example/Gemfile | 2 +- ruby-sso-example/Gemfile.lock | 10 +- ruby-sso-example/app.rb | 1 - 14 files changed, 102 insertions(+), 201 deletions(-) delete mode 100644 ruby-audit-logs-example/audit_log_events.rb diff --git a/ruby-admin-portal-example/Gemfile b/ruby-admin-portal-example/Gemfile index 79504ae..ff2fcde 100644 --- a/ruby-admin-portal-example/Gemfile +++ b/ruby-admin-portal-example/Gemfile @@ -4,4 +4,4 @@ source 'https://rubygems.org' gem 'dotenv', '2.7.6' gem 'sinatra', '2.2.0' -gem 'workos', '2.5.0' +gem 'workos', '2.12.0' diff --git a/ruby-audit-logs-example/README.md b/ruby-audit-logs-example/README.md index 4f5a760..d0f949c 100644 --- a/ruby-audit-logs-example/README.md +++ b/ruby-audit-logs-example/README.md @@ -1,6 +1,6 @@ # ruby-audit-logs-example -An example Ruby application demonstrating how to use the [WorkOS Ruby SDK](https://github.com/workos/workos-ruby) to send and retrieve Audit Log events. This example is not meant to show a real-world example of an Audit Logs implementation, but rather to show concrete examples of how events can be sent using the Python SDK. +An example Ruby application demonstrating how to use the [WorkOS Ruby SDK](https://github.com/workos/workos-ruby) to send and retrieve Audit Log events. This example is not meant to show a real-world example of an Audit Logs implementation, but rather to show concrete examples of how events can be sent using the Ruby SDK. ## Clone and Install @@ -10,7 +10,6 @@ An example Ruby application demonstrating how to use the [WorkOS Ruby SDK](https # HTTPS $ git clone https://github.com/workos/ruby-example-applications.git ``` - 2. Navigate to the Audit Logs example app within the cloned repo and install dependencies: @@ -40,10 +39,24 @@ Action title: "user.connection_deleted" | Target type: "team" 4. To obtain a CSV of the Audit Log events that were sent for the last 30 days, click the "Export Events" button. This will bring you to a new page where you can download the events. Downloading the events is a 2 step process. First you need to create the report by clicking the "Generate CSV" button. Then click the "Access CSV" button to download a CSV of the Audit Log events for the selected Organization for the past 30 days. ## Run the app + ```sh ruby app.rb ``` +## Audit Logs Setup with WorkOS + +5. Follow the [Audit Logs configuration steps](https://workos.com/docs/audit-logs/emit-an-audit-log-event/sign-in-to-your-workos-dashboard-account-and-configure-audit-log-event-schemas) to set up the following 2 events that are sent with this example: + +Action title: "user.organization_set" | Target type: "team" +Action title: "user.organization_deleted" | Target type: "team" + +6. Configure the Admin Portal Redirect URI. + +Navigate to the Configuration tab in your WorkOS Dshboard. From there click the Admin Portal tab. Click the Edit Admin Portal Redirect Links button and add "http://localhost:8000" to the "When clicking the back navigation, return users to:" input, then click Save Redirect Links. + +7. To obtain a CSV of the Audit Log events that were sent for the last 30 days, click the "Export Events" tab. This will bring you to a new page where you can download the events. Downloading the events is a 2 step process. First you need to create the report by clicking the "Generate CSV" button. Then click the "Access CSV" button to download a CSV of the Audit Log events for the selected Organization for the past 30 days. You may also adjust the time range using the form inputs. + ## Need help? If you get stuck and aren't able to resolve the issue by reading our API reference or tutorials, you can reach out to us at support@workos.com and we'll lend a hand. diff --git a/ruby-audit-logs-example/app.rb b/ruby-audit-logs-example/app.rb index bb6bbc5..b576013 100644 --- a/ruby-audit-logs-example/app.rb +++ b/ruby-audit-logs-example/app.rb @@ -4,8 +4,6 @@ require 'sinatra' require 'workos' require 'date' -require_relative 'audit_log_events.rb' -require 'pry' # Pull API key and Client ID from ENV variable WorkOS.key = ENV['WORKOS_API_KEY'] diff --git a/ruby-audit-logs-example/audit_log_events.rb b/ruby-audit-logs-example/audit_log_events.rb deleted file mode 100644 index 5672608..0000000 --- a/ruby-audit-logs-example/audit_log_events.rb +++ /dev/null @@ -1,96 +0,0 @@ -require 'date' - -$user_signed_in = { - "action": "user.signed_in", - "occurred_at": DateTime.now, - "actor": { - "type": "user", - "id": "user_01GBNJC3MX9ZZJW1FSTF4C5938", - }, - "targets": [ - { - "type": "team", - "id": "team_01GBNJD4MKHVKJGEWK42JNMBGS", - }, - ], - "context": { - "location": "123.123.123.123", - "user_agent": "Chrome/104.0.0.0", - }, -} - -$user_logged_out = { - "action": "user.logged_out", - "occurred_at": DateTime.now, - "actor": { - "type": "user", - "id": "user_01GBNJC3MX9ZZJW1FSTF4C5938", - }, - "targets": [ - { - "type": "team", - "id": "team_01GBNJD4MKHVKJGEWK42JNMBGS", - }, - ], - "context": { - "location": "123.123.123.123", - "user_agent": "Chrome/104.0.0.0", - }, -} - -$user_organization_set = { - "action": "user.organization_set", - "occurred_at": DateTime.now, - "actor": { - "type": "user", - "id": "user_01GBNJC3MX9ZZJW1FSTF4C5938", - }, - "targets": [ - { - "type": "team", - "id": "team_01GBNJD4MKHVKJGEWK42JNMBGS", - }, - ], - "context": { - "location": "123.123.123.123", - "user_agent": "Chrome/104.0.0.0", - }, -} - -$user_organization_deleted = { - "action": "user.organization_deleted", - "occurred_at": DateTime.now, - "actor": { - "type": "user", - "id": "user_01GBNJC3MX9ZZJW1FSTF4C5938", - }, - "targets": [ - { - "type": "team", - "id": "team_01GBNJD4MKHVKJGEWK42JNMBGS", - }, - ], - "context": { - "location": "123.123.123.123", - "user_agent": "Chrome/104.0.0.0", - }, -} - -$user_connection_deleted = { - "action": "user.connection_deleted", - "occurred_at": DateTime.now, - "actor": { - "type": "user", - "id": "user_01GBNJC3MX9ZZJW1FSTF4C5938", - }, - "targets": [ - { - "type": "team", - "id": "team_01GBNJD4MKHVKJGEWK42JNMBGS", - }, - ], - "context": { - "location": "123.123.123.123", - "user_agent": "Chrome/104.0.0.0", - }, -} diff --git a/ruby-audit-logs-example/views/login.erb b/ruby-audit-logs-example/views/login.erb index 8aeac84..767a75b 100644 --- a/ruby-audit-logs-example/views/login.erb +++ b/ruby-audit-logs-example/views/login.erb @@ -1,10 +1,3 @@ - - - - - - -
diff --git a/ruby-magic-link-example/Gemfile b/ruby-magic-link-example/Gemfile index dfcc602..149711a 100644 --- a/ruby-magic-link-example/Gemfile +++ b/ruby-magic-link-example/Gemfile @@ -4,5 +4,5 @@ source 'https://rubygems.org' gem 'dotenv', '2.7.6' gem 'sinatra', '2.2.0' -gem 'workos', '2.5.0' +gem 'workos', '2.12.0' diff --git a/ruby-magic-link-example/Gemfile.lock b/ruby-magic-link-example/Gemfile.lock index 6208190..882d259 100644 --- a/ruby-magic-link-example/Gemfile.lock +++ b/ruby-magic-link-example/Gemfile.lock @@ -4,7 +4,7 @@ GEM dotenv (2.7.6) mustermann (1.1.2) ruby2_keywords (~> 0.0.1) - rack (2.2.4) + rack (2.2.6.4) rack-protection (2.2.0) rack ruby2_keywords (0.0.5) @@ -13,9 +13,9 @@ GEM rack (~> 2.2) rack-protection (= 2.2.0) tilt (~> 2.0) - sorbet-runtime (0.5.10274) - tilt (2.0.11) - workos (2.5.0) + sorbet-runtime (0.5.10741) + tilt (2.1.0) + workos (2.12.0) sorbet-runtime (~> 0.5) PLATFORMS @@ -24,7 +24,7 @@ PLATFORMS DEPENDENCIES dotenv (= 2.7.6) sinatra (= 2.2.0) - workos (= 2.5.0) + workos (= 2.12.0) BUNDLED WITH 2.1.4 diff --git a/ruby-mfa-example/Gemfile b/ruby-mfa-example/Gemfile index 79504ae..ff2fcde 100644 --- a/ruby-mfa-example/Gemfile +++ b/ruby-mfa-example/Gemfile @@ -4,4 +4,4 @@ source 'https://rubygems.org' gem 'dotenv', '2.7.6' gem 'sinatra', '2.2.0' -gem 'workos', '2.5.0' +gem 'workos', '2.12.0' diff --git a/ruby-mfa-example/Gemfile.lock b/ruby-mfa-example/Gemfile.lock index 9250ace..882d259 100644 --- a/ruby-mfa-example/Gemfile.lock +++ b/ruby-mfa-example/Gemfile.lock @@ -4,7 +4,7 @@ GEM dotenv (2.7.6) mustermann (1.1.2) ruby2_keywords (~> 0.0.1) - rack (2.2.4) + rack (2.2.6.4) rack-protection (2.2.0) rack ruby2_keywords (0.0.5) @@ -13,9 +13,9 @@ GEM rack (~> 2.2) rack-protection (= 2.2.0) tilt (~> 2.0) - sorbet-runtime (0.5.10323) - tilt (2.0.11) - workos (2.5.0) + sorbet-runtime (0.5.10741) + tilt (2.1.0) + workos (2.12.0) sorbet-runtime (~> 0.5) PLATFORMS @@ -24,7 +24,7 @@ PLATFORMS DEPENDENCIES dotenv (= 2.7.6) sinatra (= 2.2.0) - workos (= 2.5.0) + workos (= 2.12.0) BUNDLED WITH 2.1.4 diff --git a/ruby-rails-sso-example/Gemfile b/ruby-rails-sso-example/Gemfile index 821fc4b..81798f7 100644 --- a/ruby-rails-sso-example/Gemfile +++ b/ruby-rails-sso-example/Gemfile @@ -32,10 +32,9 @@ gem 'bootstrap', '~> 5.1.1' # Use Devise for general authentication gem 'devise' # Use WorkOS to authenticate users via SSO -gem 'workos', '2.5.0' +gem 'workos', '2.12.0' # Use JSON to generate user information in JSON format gem "json", ">= 2.3.0" -gem 'pry' # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', '>= 1.4.2', require: false diff --git a/ruby-rails-sso-example/Gemfile.lock b/ruby-rails-sso-example/Gemfile.lock index b81ffb2..e3456cf 100644 --- a/ruby-rails-sso-example/Gemfile.lock +++ b/ruby-rails-sso-example/Gemfile.lock @@ -1,74 +1,74 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.0.4.2) - actionpack (= 7.0.4.2) - activesupport (= 7.0.4.2) + actioncable (7.0.4.3) + actionpack (= 7.0.4.3) + activesupport (= 7.0.4.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.4.2) - actionpack (= 7.0.4.2) - activejob (= 7.0.4.2) - activerecord (= 7.0.4.2) - activestorage (= 7.0.4.2) - activesupport (= 7.0.4.2) + actionmailbox (7.0.4.3) + actionpack (= 7.0.4.3) + activejob (= 7.0.4.3) + activerecord (= 7.0.4.3) + activestorage (= 7.0.4.3) + activesupport (= 7.0.4.3) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.4.2) - actionpack (= 7.0.4.2) - actionview (= 7.0.4.2) - activejob (= 7.0.4.2) - activesupport (= 7.0.4.2) + actionmailer (7.0.4.3) + actionpack (= 7.0.4.3) + actionview (= 7.0.4.3) + activejob (= 7.0.4.3) + activesupport (= 7.0.4.3) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.4.2) - actionview (= 7.0.4.2) - activesupport (= 7.0.4.2) + actionpack (7.0.4.3) + actionview (= 7.0.4.3) + activesupport (= 7.0.4.3) rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.4.2) - actionpack (= 7.0.4.2) - activerecord (= 7.0.4.2) - activestorage (= 7.0.4.2) - activesupport (= 7.0.4.2) + actiontext (7.0.4.3) + actionpack (= 7.0.4.3) + activerecord (= 7.0.4.3) + activestorage (= 7.0.4.3) + activesupport (= 7.0.4.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.4.2) - activesupport (= 7.0.4.2) + actionview (7.0.4.3) + activesupport (= 7.0.4.3) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.4.2) - activesupport (= 7.0.4.2) + activejob (7.0.4.3) + activesupport (= 7.0.4.3) globalid (>= 0.3.6) - activemodel (7.0.4.2) - activesupport (= 7.0.4.2) - activerecord (7.0.4.2) - activemodel (= 7.0.4.2) - activesupport (= 7.0.4.2) - activestorage (7.0.4.2) - actionpack (= 7.0.4.2) - activejob (= 7.0.4.2) - activerecord (= 7.0.4.2) - activesupport (= 7.0.4.2) + activemodel (7.0.4.3) + activesupport (= 7.0.4.3) + activerecord (7.0.4.3) + activemodel (= 7.0.4.3) + activesupport (= 7.0.4.3) + activestorage (7.0.4.3) + actionpack (= 7.0.4.3) + activejob (= 7.0.4.3) + activerecord (= 7.0.4.3) + activesupport (= 7.0.4.3) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.4.2) + activesupport (7.0.4.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) addressable (2.8.1) public_suffix (>= 2.0.2, < 6.0) - autoprefixer-rails (10.4.7.0) + autoprefixer-rails (10.4.13.0) execjs (~> 2) bcrypt (3.1.18) bindex (0.8.1) @@ -89,11 +89,10 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - coderay (1.1.3) - concurrent-ruby (1.2.0) + concurrent-ruby (1.2.2) crass (1.0.6) date (3.3.3) - devise (4.8.1) + devise (4.9.0) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) @@ -127,8 +126,8 @@ GEM method_source (1.0.0) mini_mime (1.1.2) mini_portile2 (2.8.1) - minitest (5.17.0) - msgpack (1.6.0) + minitest (5.18.0) + msgpack (1.7.0) net-http (0.3.2) uri net-imap (0.3.4) @@ -146,40 +145,37 @@ GEM racc (~> 1.4) orm_adapter (0.5.0) popper_js (2.11.6) - pry (0.14.2) - coderay (~> 1.1) - method_source (~> 1.0) public_suffix (5.0.1) puma (4.3.12) nio4r (~> 2.0) racc (1.6.2) - rack (2.2.6.2) + rack (2.2.6.4) rack-proxy (0.7.6) rack - rack-test (2.0.2) + rack-test (2.1.0) rack (>= 1.3) - rails (7.0.4.2) - actioncable (= 7.0.4.2) - actionmailbox (= 7.0.4.2) - actionmailer (= 7.0.4.2) - actionpack (= 7.0.4.2) - actiontext (= 7.0.4.2) - actionview (= 7.0.4.2) - activejob (= 7.0.4.2) - activemodel (= 7.0.4.2) - activerecord (= 7.0.4.2) - activestorage (= 7.0.4.2) - activesupport (= 7.0.4.2) + rails (7.0.4.3) + actioncable (= 7.0.4.3) + actionmailbox (= 7.0.4.3) + actionmailer (= 7.0.4.3) + actionpack (= 7.0.4.3) + actiontext (= 7.0.4.3) + actionview (= 7.0.4.3) + activejob (= 7.0.4.3) + activemodel (= 7.0.4.3) + activerecord (= 7.0.4.3) + activestorage (= 7.0.4.3) + activesupport (= 7.0.4.3) bundler (>= 1.15.0) - railties (= 7.0.4.2) + railties (= 7.0.4.3) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.5.0) loofah (~> 2.19, >= 2.19.1) - railties (7.0.4.2) - actionpack (= 7.0.4.2) - activesupport (= 7.0.4.2) + railties (7.0.4.3) + actionpack (= 7.0.4.3) + activesupport (= 7.0.4.3) method_source rake (>= 12.2) thor (~> 1.0) @@ -204,11 +200,11 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (4.8.0) + selenium-webdriver (4.8.6) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) - sorbet-runtime (0.5.10667) + sorbet-runtime (0.5.10741) spring (2.1.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) @@ -220,17 +216,17 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.6.0) + sqlite3 (1.6.2) mini_portile2 (~> 2.8.0) thor (1.2.1) - tilt (2.0.11) + tilt (2.1.0) timeout (0.3.2) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - uri (0.12.0) + uri (0.12.1) warden (1.2.9) rack (>= 2.0.9) web-console (4.2.0) @@ -250,7 +246,7 @@ GEM websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - workos (2.5.0) + workos (2.12.0) sorbet-runtime (~> 0.5) xpath (3.2.0) nokogiri (~> 1.8) @@ -271,7 +267,6 @@ DEPENDENCIES json (>= 2.3.0) listen (~> 3.2) net-http - pry puma (~> 4.3) rails (~> 7.0.1) sass-rails (>= 6) @@ -285,7 +280,7 @@ DEPENDENCIES web-console (>= 3.3.0) webdrivers webpacker (~> 4.0) - workos (= 2.5.0) + workos (= 2.12.0) RUBY VERSION ruby 2.7.2p137 diff --git a/ruby-sso-example/Gemfile b/ruby-sso-example/Gemfile index dfcc602..149711a 100644 --- a/ruby-sso-example/Gemfile +++ b/ruby-sso-example/Gemfile @@ -4,5 +4,5 @@ source 'https://rubygems.org' gem 'dotenv', '2.7.6' gem 'sinatra', '2.2.0' -gem 'workos', '2.5.0' +gem 'workos', '2.12.0' diff --git a/ruby-sso-example/Gemfile.lock b/ruby-sso-example/Gemfile.lock index dac717b..882d259 100644 --- a/ruby-sso-example/Gemfile.lock +++ b/ruby-sso-example/Gemfile.lock @@ -4,7 +4,7 @@ GEM dotenv (2.7.6) mustermann (1.1.2) ruby2_keywords (~> 0.0.1) - rack (2.2.4) + rack (2.2.6.4) rack-protection (2.2.0) rack ruby2_keywords (0.0.5) @@ -13,9 +13,9 @@ GEM rack (~> 2.2) rack-protection (= 2.2.0) tilt (~> 2.0) - sorbet-runtime (0.5.10262) - tilt (2.0.11) - workos (2.5.0) + sorbet-runtime (0.5.10741) + tilt (2.1.0) + workos (2.12.0) sorbet-runtime (~> 0.5) PLATFORMS @@ -24,7 +24,7 @@ PLATFORMS DEPENDENCIES dotenv (= 2.7.6) sinatra (= 2.2.0) - workos (= 2.5.0) + workos (= 2.12.0) BUNDLED WITH 2.1.4 diff --git a/ruby-sso-example/app.rb b/ruby-sso-example/app.rb index 3fcc2c6..ed650b1 100644 --- a/ruby-sso-example/app.rb +++ b/ruby-sso-example/app.rb @@ -36,7 +36,6 @@ # in place of the connection parameter # https://workos.com/docs/reference/sso/authorize/get get '/auth' do - puts CONNECTION_ID authorization_url = WorkOS::SSO.authorization_url( client_id: CLIENT_ID, connection: CONNECTION_ID, From a978c135f20676c9433d8b9fad5b1b7417570216 Mon Sep 17 00:00:00 2001 From: Adam Wolfman Date: Fri, 7 Apr 2023 16:52:43 -0600 Subject: [PATCH 3/3] Update CSS --- ruby-sso-example/public/styles.css | 32 ++++++++++++++++++------------ ruby-sso-example/views/index.erb | 18 +++++------------ 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/ruby-sso-example/public/styles.css b/ruby-sso-example/public/styles.css index e6f0e22..b25e26f 100644 --- a/ruby-sso-example/public/styles.css +++ b/ruby-sso-example/public/styles.css @@ -1,7 +1,6 @@ body { font-family: Inter, sans-serif; background-color: #f9f9fb; - } .container_login { @@ -152,11 +151,18 @@ h1 { text-align: left; margin-bottom: 0px; font-weight: normal; - letter-spacing: -.05em; + letter-spacing: -0.05em; } .home-hero-gradient { - background-image: linear-gradient(45deg, #a163f1, #6363f1 22%, #3498ea 40%, #40dfa3 67%, rgba(64, 223, 163, 0)); + background-image: linear-gradient( + 45deg, + #a163f1, + #6363f1 22%, + #3498ea 40%, + #40dfa3 67%, + rgba(64, 223, 163, 0) + ); background-size: 150% 100%; background-repeat: no-repeat; -webkit-background-clip: text; @@ -168,7 +174,7 @@ h1 { animation-delay: 0.4s; text-align: left; font-size: 75px; - letter-spacing: -.05em; + letter-spacing: -0.05em; font-weight: normal; margin-top: 0px; } @@ -198,8 +204,14 @@ div.text_box { overflow: scroll; border-width: 3px; border-style: solid; - border-image: - linear-gradient(#a163f1, #6363f1 22%, #3498ea 40%, #40dfa3 67%, rgba(64, 223, 163, 0)) 0 100%; + border-image: linear-gradient( + #a163f1, + #6363f1 22%, + #3498ea 40%, + #40dfa3 67%, + rgba(64, 223, 163, 0) + ) + 0 100%; } .logged_in_nav { @@ -220,12 +232,6 @@ div.text_box { .logged_in_nav img { height: 50px; - border-radius: 50%; - border: 2px solid #2f2e2e; -} - -.logged_in_nav img:hover { - border: 2px solid #555555; } .nav-item { @@ -250,4 +256,4 @@ div.text_box { pre.prettyprint { border: none !important; -} \ No newline at end of file +} diff --git a/ruby-sso-example/views/index.erb b/ruby-sso-example/views/index.erb index 748e5f1..08ce69c 100644 --- a/ruby-sso-example/views/index.erb +++ b/ruby-sso-example/views/index.erb @@ -1,13 +1,10 @@ <% if @current_user %> - -
+
" alt="workos logo"> -
-
-

You're logged in <%= @first_name %>, welcome!

+
@@ -25,10 +22,7 @@

Your app,

Enterprise Ready

-
-

Start selling to enterprise customers with just a few lines of code.

-

Implement features like single sign-on in minutes instead of months.

-
+