workos 2.16.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/Gemfile.lock +5 -14
  4. data/lib/workos/authentication_factor_and_challenge.rb +31 -0
  5. data/lib/workos/authentication_response.rb +27 -0
  6. data/lib/workos/client.rb +1 -1
  7. data/lib/workos/configuration.rb +1 -1
  8. data/lib/workos/invitation.rb +68 -0
  9. data/lib/workos/organization_membership.rb +50 -0
  10. data/lib/workos/sso.rb +1 -1
  11. data/lib/workos/types/invitation_struct.rb +20 -0
  12. data/lib/workos/types/magic_auth_challenge_struct.rb +12 -0
  13. data/lib/workos/types/organization_membership_struct.rb +15 -0
  14. data/lib/workos/types/provider_enum.rb +1 -0
  15. data/lib/workos/types/user_struct.rb +17 -0
  16. data/lib/workos/types.rb +9 -5
  17. data/lib/workos/user.rb +57 -0
  18. data/lib/workos/user_and_token.rb +29 -0
  19. data/lib/workos/user_management.rb +1008 -0
  20. data/lib/workos/user_response.rb +25 -0
  21. data/lib/workos/version.rb +1 -1
  22. data/lib/workos.rb +35 -28
  23. data/spec/lib/workos/sso_spec.rb +8 -8
  24. data/spec/lib/workos/user_management_spec.rb +1092 -0
  25. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/invalid.yml +84 -0
  26. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid.yml +82 -0
  27. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/invalid.yml +83 -0
  28. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/valid.yml +81 -0
  29. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/invalid.yml +82 -0
  30. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/valid.yml +82 -0
  31. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/invalid.yml +81 -0
  32. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml +82 -0
  33. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/invalid.yml +82 -0
  34. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml +82 -0
  35. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/invalid.yml +83 -0
  36. data/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml +81 -0
  37. data/spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/invalid.yml +82 -0
  38. data/spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/valid.yml +82 -0
  39. data/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/invalid.yml +83 -0
  40. data/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml +82 -0
  41. data/spec/support/fixtures/vcr_cassettes/user_management/create_user_invalid.yml +83 -0
  42. data/spec/support/fixtures/vcr_cassettes/user_management/create_user_valid.yml +82 -0
  43. data/spec/support/fixtures/vcr_cassettes/user_management/delete_organization_membership/invalid.yml +82 -0
  44. data/spec/support/fixtures/vcr_cassettes/user_management/delete_organization_membership/valid.yml +78 -0
  45. data/spec/support/fixtures/vcr_cassettes/user_management/delete_user/invalid.yml +82 -0
  46. data/spec/support/fixtures/vcr_cassettes/user_management/delete_user/valid.yml +78 -0
  47. data/spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/invalid.yml +82 -0
  48. data/spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/valid.yml +82 -0
  49. data/spec/support/fixtures/vcr_cassettes/user_management/get_invitation/invalid.yml +82 -0
  50. data/spec/support/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml +82 -0
  51. data/spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml +82 -0
  52. data/spec/support/fixtures/vcr_cassettes/user_management/get_user.yml +82 -0
  53. data/spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/invalid.yml +82 -0
  54. data/spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/valid.yml +82 -0
  55. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml +83 -0
  56. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml +83 -0
  57. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml +83 -0
  58. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml +83 -0
  59. data/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml +83 -0
  60. data/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml +82 -0
  61. data/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml +82 -0
  62. data/spec/support/fixtures/vcr_cassettes/user_management/list_users/no_options.yml +82 -0
  63. data/spec/support/fixtures/vcr_cassettes/user_management/list_users/with_options.yml +82 -0
  64. data/spec/support/fixtures/vcr_cassettes/user_management/reset_password/invalid.yml +82 -0
  65. data/spec/support/fixtures/vcr_cassettes/user_management/reset_password/valid.yml +82 -0
  66. data/spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/invalid.yml +82 -0
  67. data/spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml +82 -0
  68. data/spec/support/fixtures/vcr_cassettes/user_management/send_invitation/invalid.yml +82 -0
  69. data/spec/support/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml +82 -0
  70. data/spec/support/fixtures/vcr_cassettes/user_management/send_magic_auth_code/valid.yml +82 -0
  71. data/spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/invalid.yml +83 -0
  72. data/spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml +82 -0
  73. data/spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml +82 -0
  74. data/spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml +82 -0
  75. data/spec/support/fixtures/vcr_cassettes/user_management/update_user/invalid.yml +82 -0
  76. data/spec/support/fixtures/vcr_cassettes/user_management/update_user/valid.yml +82 -0
  77. data/spec/support/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml +82 -0
  78. data/spec/support/fixtures/vcr_cassettes/user_management/update_user_password/valid.yml +82 -0
  79. data/spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_code.yml +83 -0
  80. data/spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_magic_auth_challenge.yml +82 -0
  81. data/spec/support/fixtures/vcr_cassettes/user_management/verify_email/valid.yml +82 -0
  82. data/workos.gemspec +0 -2
  83. metadata +132 -55
  84. data/bin/docs +0 -5
  85. data/docs/WorkOS/APIError.html +0 -160
  86. data/docs/WorkOS/AuditLog.html +0 -235
  87. data/docs/WorkOS/AuditTrail.html +0 -235
  88. data/docs/WorkOS/AuthenticationError.html +0 -160
  89. data/docs/WorkOS/Base.html +0 -287
  90. data/docs/WorkOS/Client.html +0 -504
  91. data/docs/WorkOS/InvalidRequestError.html +0 -160
  92. data/docs/WorkOS/Profile.html +0 -788
  93. data/docs/WorkOS/RequestError.html +0 -135
  94. data/docs/WorkOS/SSO.html +0 -691
  95. data/docs/WorkOS/Types/ProfileStruct.html +0 -135
  96. data/docs/WorkOS/Types/Provider.html +0 -135
  97. data/docs/WorkOS/Types.html +0 -128
  98. data/docs/WorkOS/WorkOSError.html +0 -447
  99. data/docs/WorkOS.html +0 -324
  100. data/docs/class_list.html +0 -51
  101. data/docs/css/common.css +0 -1
  102. data/docs/css/full_list.css +0 -58
  103. data/docs/css/style.css +0 -496
  104. data/docs/file.README.html +0 -252
  105. data/docs/file_list.html +0 -56
  106. data/docs/frames.html +0 -17
  107. data/docs/index.html +0 -250
  108. data/docs/js/app.js +0 -314
  109. data/docs/js/full_list.js +0 -216
  110. data/docs/js/jquery.js +0 -4
  111. data/docs/method_list.html +0 -267
  112. data/docs/top-level-namespace.html +0 -110
  113. data/lib/workos/audit_trail.rb +0 -111
  114. data/spec/lib/workos/audit_trail_spec.rb +0 -146
@@ -1,252 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>
7
- File: README
8
-
9
- &mdash; Documentation by YARD 0.9.22
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="css/style.css" type="text/css" />
14
-
15
- <link rel="stylesheet" href="css/common.css" type="text/css" />
16
-
17
- <script type="text/javascript">
18
- pathId = "README";
19
- relpath = '';
20
- </script>
21
-
22
-
23
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
-
25
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
-
27
-
28
- </head>
29
- <body>
30
- <div class="nav_wrap">
31
- <iframe id="nav" src="file_list.html?1"></iframe>
32
- <div id="resizer"></div>
33
- </div>
34
-
35
- <div id="main" tabindex="-1">
36
- <div id="header">
37
- <div id="menu">
38
-
39
- <a href="_index.html">Index</a> &raquo;
40
- <span class="title">File: README</span>
41
-
42
- </div>
43
-
44
- <div id="search">
45
-
46
- <a class="full_list_link" id="class_list_link"
47
- href="class_list.html">
48
-
49
- <svg width="24" height="24">
50
- <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
51
- <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
52
- <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
53
- </svg>
54
- </a>
55
-
56
- </div>
57
- <div class="clear"></div>
58
- </div>
59
-
60
- <div id="content"><div id='filecontents'>
61
- <h1 id="label-workos-ruby+rdoc-image-3Ahttps-3A-2F-2Fcodecov.io-2Fgh-2Fworkos-inc-2Fworkos-ruby-2Fbranch-2Fmaster-2Fgraph-2Fbadge.svg">workos-ruby <a href="https://codecov.io/gh/workos-inc/workos-ruby"><img src="https://codecov.io/gh/workos-inc/workos-ruby/branch/master/graph/badge.svg"></a></h1>
62
-
63
- <p>WorkOS official Ruby gem for interacting with WorkOS APIs</p>
64
-
65
- <h2 id="label-Documentation">Documentation</h2>
66
-
67
- <p>Complete documentation for the latest version of WorkOS Ruby Gem can be found <a href="https://workos-inc.github.io/workos-ruby/">here</a>.</p>
68
-
69
- <h2 id="label-Installation">Installation</h2>
70
-
71
- <p>To get started, you can install the WorkOS gem via RubyGems with:</p>
72
-
73
- <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_workos'>workos</span>
74
- </code></pre>
75
-
76
- <p>If you&#39;re using Bundler to manage your application&#39;s gems, add the WorkOS gem to your Gemfile:</p>
77
-
78
- <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_source'>source</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>https://rubygems.org</span><span class='tstring_end'>&#39;</span></span>
79
-
80
- <span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>workos</span><span class='tstring_end'>&#39;</span></span>
81
- </code></pre>
82
-
83
- <h2 id="label-Configuration">Configuration</h2>
84
-
85
- <p>To use the SDK you must first provide your API key from the <a href="https://dashboard.workos.com/api-keys">WorkOS Developer Dashboard</a>.</p>
86
-
87
- <p>You can do this through the <code>WORKOS_API_KEY</code> environment variable or by calling <code>WorkOS.key = [your API key]</code>.</p>
88
-
89
- <p>The WorkOS Gem will read the environment variable <code>WORKOS_API_KEY</code>:</p>
90
-
91
- <pre class="code ruby"><code class="ruby">$ WORKOS_API_KEY=[your api key] ruby app.rb
92
- </code></pre>
93
-
94
- <p>Alternatively, you may set the key yourself, such as in an initializer in your application load path:</p>
95
-
96
- <pre class="code ruby"><code class="ruby"><span class='comment'># /config/initializers/workos.rb
97
- </span>
98
- <span class='const'><span class='object_link'><a href="WorkOS.html" title="WorkOS (module)">WorkOS</a></span></span><span class='period'>.</span><span class='id identifier rubyid_key'><span class='object_link'><a href="WorkOS.html#key-class_method" title="WorkOS.key (method)">key</a></span></span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>[your api key]</span><span class='tstring_end'>&#39;</span></span>
99
- </code></pre>
100
-
101
- <h2 id="label-The+Audit+Trail+Module">The Audit Trail Module</h2>
102
-
103
- <p>The Audit Trail Module provides methods for creating Audit Trail events on WorkOS.</p>
104
-
105
- <p>See our <a href="https://docs.workos.com/audit-trail/overview">Audit Trail Overview</a> for more information.</p>
106
-
107
- <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_payload'>payload</span> <span class='op'>=</span> <span class='lbrace'>{</span>
108
- <span class='label'>group:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Foo Corp</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
109
- <span class='label'>location:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>127.0.0.1</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
110
- <span class='label'>action:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>user.created</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
111
- <span class='label'>action_type:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>C</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
112
- <span class='label'>actor_name:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Foo</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
113
- <span class='label'>actor_id:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>user_12345</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
114
- <span class='label'>target_name:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Bar</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
115
- <span class='label'>target_id:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>user_67890</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
116
- <span class='label'>occurred_at:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>2020-01-10T15:30:00-05:00</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
117
- <span class='label'>metadata:</span> <span class='lbrace'>{</span>
118
- <span class='label'>source:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Email</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
119
- <span class='rbrace'>}</span>
120
- <span class='rbrace'>}</span>
121
-
122
- <span class='const'><span class='object_link'><a href="WorkOS.html" title="WorkOS (module)">WorkOS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="WorkOS/AuditTrail.html" title="WorkOS::AuditTrail (module)">AuditTrail</a></span></span><span class='period'>.</span><span class='id identifier rubyid_create_event'><span class='object_link'><a href="WorkOS/AuditTrail.html#create_event-class_method" title="WorkOS::AuditTrail.create_event (method)">create_event</a></span></span><span class='lparen'>(</span><span class='label'>event:</span> <span class='id identifier rubyid_payload'>payload</span><span class='rparen'>)</span>
123
- </code></pre>
124
-
125
- <h3 id="label-Idempotency">Idempotency</h3>
126
-
127
- <p>To perform an idempotent request, provide an additional idempotency_key parameter to the <code>create_event</code> options.</p>
128
-
129
- <pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="WorkOS.html" title="WorkOS (module)">WorkOS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="WorkOS/AuditTrail.html" title="WorkOS::AuditTrail (module)">AuditTrail</a></span></span><span class='period'>.</span><span class='id identifier rubyid_create_event'><span class='object_link'><a href="WorkOS/AuditTrail.html#create_event-class_method" title="WorkOS::AuditTrail.create_event (method)">create_event</a></span></span><span class='lparen'>(</span><span class='label'>event:</span> <span class='id identifier rubyid_payload'>payload</span><span class='comma'>,</span> <span class='label'>idempotency_key:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>key123456</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
130
- </code></pre>
131
-
132
- <p>See our <a href="https://docs.workos.com/api-reference#idempotency">API Reference</a> for more information on idempotency keys.</p>
133
-
134
- <h2 id="label-The+SSO+Module">The SSO Module</h2>
135
-
136
- <p>The SSO Module provides convenience methods for authenticating a Single Sign On (SSO) user via WorkOS. WorkOS SSO follows the Oauth 2.0 specification.</p>
137
-
138
- <p>First, you&#39;ll direct your SSO users to an <code>authorization_url</code>. They will sign in to their SSO account with their Identity Provider, and be redirected to a callback URL that you set in your WorkOS Dashboard. The user will be redirected with a <code>code</code> URL parameter, which you can then exchange for a WorkOS::Profile using the <code>WorkOS::SSO.get_profile</code> method.</p>
139
-
140
- <p>See our Ruby SSO example app for a <a href="https://github.com/workos-inc/ruby-sso-example">complete example</a>.</p>
141
-
142
- <pre class="code ruby"><code class="ruby">WorkOS::SSO.authorization_url(domain:, client_id:, redirect_uri:, state: {})
143
- </code></pre>
144
-
145
- <blockquote>
146
- <p>Generate an authorization URL to intitiate the WorkOS OAuth2 workflow.</p>
147
- </blockquote>
148
-
149
- <p><code>WorkOS::SSO.authorization_url</code> accepts four arguments:</p>
150
- <ul><li>
151
- <p><code>domain</code> (string) — the authenticating user&#39;s company domain, without protocol (ex. <code>example.com</code>)</p>
152
- </li><li>
153
- <p><code>client_id</code> (string) — your application&#39;s WorkOS <a href="https://dashboard.workos.com/sso/configuration">Client ID</a> (ex. <code>project_01JG3BCPTRTSTTWQR4VSHXGWCQ</code>)</p>
154
- </li><li>
155
- <p><code>state</code> (optional, hash) — an optional hash used to manage state across authorization transactions (ex. <code>{ next_page: &#39;/docs&#39;}</code>)</p>
156
- </li><li>
157
- <p><code>redirect_uri</code> (string) — a callback URL where your application redirects the user-agent after an authorization code is granted (ex. <code>workos.dev/callback</code>). This must match one of your configured callback URLs for the associated environment on your WorkOS dashboard.</p>
158
- </li></ul>
159
-
160
- <p>This method will return an OAuth2 query string of the form:</p>
161
-
162
- <p><code>https://${domain}/sso/authorize?response_type=code&client_id=${clientID}&redirect_uri=${redirectURI}&state=${state}</code></p>
163
-
164
- <p>For example, when used in a <a href="http://sinatrarb.com/">Sinatra app</a>:</p>
165
-
166
- <pre class="code ruby"><code class="ruby"><span class='const'>DOMAIN</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>example.com</span><span class='tstring_end'>&#39;</span></span>
167
- <span class='const'>CLIENT_ID</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>{clientId}</span><span class='tstring_end'>&#39;</span></span>
168
- <span class='const'>REDIRECT_URI</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>http://localhost:4567/callback</span><span class='tstring_end'>&#39;</span></span>
169
-
170
- <span class='id identifier rubyid_get'>get</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/auth</span><span class='tstring_end'>&#39;</span></span> <span class='kw'>do</span>
171
- <span class='id identifier rubyid_authorization_url'>authorization_url</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="WorkOS.html" title="WorkOS (module)">WorkOS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="WorkOS/SSO.html" title="WorkOS::SSO (module)">SSO</a></span></span><span class='period'>.</span><span class='id identifier rubyid_authorization_url'><span class='object_link'><a href="WorkOS/SSO.html#authorization_url-class_method" title="WorkOS::SSO.authorization_url (method)">authorization_url</a></span></span><span class='lparen'>(</span>
172
- <span class='label'>domain:</span> <span class='const'>DOMAIN</span><span class='comma'>,</span>
173
- <span class='label'>client_id:</span> <span class='const'>CLIENT_ID</span><span class='comma'>,</span>
174
- <span class='label'>redirect_uri:</span> <span class='const'>REDIRECT_URI</span><span class='comma'>,</span>
175
- <span class='rparen'>)</span>
176
-
177
- <span class='id identifier rubyid_redirect'>redirect</span> <span class='id identifier rubyid_authorization_url'>authorization_url</span>
178
- <span class='kw'>end</span>
179
- </code></pre>
180
-
181
- <p>The user would be redirected to:</p>
182
-
183
- <p><code>https://api.workos.com/sso/authorize?response_type=code&client_id={clientID}&redirect_uri=http://localhost:4567/callback</code></p>
184
-
185
- <p>WorkOS takes over from here, sending the user to authenticate with their IDP, and on successful login, returns the user to your callback URL with a <code>code</code> parameter. You&#39;ll use <code>WorkOS::SSO.profile</code> to exchange the code for a <code>WorkOS::Profile</code>.</p>
186
-
187
- <pre class="code ruby"><code class="ruby">WorkOS::SSO.profile(code:, client_id:)&lt;/h4&gt;
188
- </code></pre>
189
-
190
- <blockquote>
191
- <p>Fetch a WorkOS::Profile for an authorized user.</p>
192
- </blockquote>
193
-
194
- <p><code>WorkOS::SSO.profile</code> accepts two arguments:</p>
195
- <ul><li>
196
- <p><code>code</code> (string) — an opaque string provided by the authorization server; will be exchanged for an Access Token when the user&#39;s profile is sent</p>
197
- </li><li>
198
- <p><code>client_id</code> (string) — your application&#39;s WorkOS <a href="https://dashboard.workos.com/sso/configuration">Client ID</a> (ex. <code>project_01JG3BCPTRTSTTWQR4VSHXGWCQ</code>)</p>
199
- </li></ul>
200
-
201
- <p>This method will return an instance of a <code>WorkOS::Profile</code> with the following attributes:</p>
202
-
203
- <pre class="code ruby"><code class="ruby">&lt;WorkOS::Profile:0x00007fb6e4193d20
204
- @id=&quot;prof_01DRA1XNSJDZ19A31F183ECQW5&quot;,
205
- @email=&quot;demo@workos-okta.com&quot;,
206
- @first_name=&quot;WorkOS&quot;,
207
- @connection_type=&quot;OktaSAML&quot;,
208
- @last_name=&quot;Demo&quot;,
209
- @idp_id=&quot;00u1klkowm8EGah2H357&quot;,
210
- &gt;
211
- </code></pre>
212
-
213
- <p>Our Sintatra app can be extended to use this method:</p>
214
-
215
- <pre class="code ruby"><code class="ruby"><span class='const'>DOMAIN</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>example.com</span><span class='tstring_end'>&#39;</span></span>
216
- <span class='const'>CLIENT_ID</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>{clientId}</span><span class='tstring_end'>&#39;</span></span>
217
- <span class='const'>REDIRECT_URI</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>http://localhost:4567/callback</span><span class='tstring_end'>&#39;</span></span>
218
-
219
- <span class='id identifier rubyid_get'>get</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/auth</span><span class='tstring_end'>&#39;</span></span> <span class='kw'>do</span>
220
- <span class='id identifier rubyid_authorization_url'>authorization_url</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="WorkOS.html" title="WorkOS (module)">WorkOS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="WorkOS/SSO.html" title="WorkOS::SSO (module)">SSO</a></span></span><span class='period'>.</span><span class='id identifier rubyid_authorization_url'><span class='object_link'><a href="WorkOS/SSO.html#authorization_url-class_method" title="WorkOS::SSO.authorization_url (method)">authorization_url</a></span></span><span class='lparen'>(</span>
221
- <span class='label'>domain:</span> <span class='const'>DOMAIN</span><span class='comma'>,</span>
222
- <span class='label'>client_id:</span> <span class='const'>CLIENT_ID</span><span class='comma'>,</span>
223
- <span class='label'>redirect_uri:</span> <span class='const'>REDIRECT_URI</span><span class='comma'>,</span>
224
- <span class='rparen'>)</span>
225
-
226
- <span class='id identifier rubyid_redirect'>redirect</span> <span class='id identifier rubyid_authorization_url'>authorization_url</span>
227
- <span class='kw'>end</span>
228
-
229
- <span class='id identifier rubyid_get'>get</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/callback</span><span class='tstring_end'>&#39;</span></span> <span class='kw'>do</span>
230
- <span class='id identifier rubyid_profile'>profile</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="WorkOS.html" title="WorkOS (module)">WorkOS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="WorkOS/SSO.html" title="WorkOS::SSO (module)">SSO</a></span></span><span class='period'>.</span><span class='id identifier rubyid_profile'><span class='object_link'><a href="WorkOS/SSO.html#profile-class_method" title="WorkOS::SSO.profile (method)">profile</a></span></span><span class='lparen'>(</span>
231
- <span class='label'>code:</span> <span class='id identifier rubyid_params'>params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>code</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
232
- <span class='label'>client_id:</span> <span class='const'>CLIENT_ID</span><span class='comma'>,</span>
233
- <span class='rparen'>)</span>
234
-
235
- <span class='id identifier rubyid_session'>session</span><span class='lbracket'>[</span><span class='symbol'>:user</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_profile'>profile</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span>
236
-
237
- <span class='id identifier rubyid_redirect'>redirect</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>/</span><span class='tstring_end'>&#39;</span></span>
238
- <span class='kw'>end</span>
239
- </code></pre>
240
-
241
- <p>Given the <code>WorkOS::Profile</code>, you can now sign the user in according to your own authentication setup.</p>
242
- </div></div>
243
-
244
- <div id="footer">
245
- Generated on Tue Apr 7 22:21:07 2020 by
246
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
247
- 0.9.22 (ruby-2.7.1).
248
- </div>
249
-
250
- </div>
251
- </body>
252
- </html>
data/docs/file_list.html DELETED
@@ -1,56 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
5
- <meta charset="utf-8" />
6
-
7
- <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" />
8
-
9
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" />
10
-
11
-
12
-
13
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
-
15
- <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
-
17
-
18
- <title>File List</title>
19
- <base id="base_target" target="_parent" />
20
- </head>
21
- <body>
22
- <div id="content">
23
- <div class="fixed_header">
24
- <h1 id="full_list_header">File List</h1>
25
- <div id="full_list_nav">
26
-
27
- <span><a target="_self" href="class_list.html">
28
- Classes
29
- </a></span>
30
-
31
- <span><a target="_self" href="method_list.html">
32
- Methods
33
- </a></span>
34
-
35
- <span><a target="_self" href="file_list.html">
36
- Files
37
- </a></span>
38
-
39
- </div>
40
-
41
- <div id="search">Search: <input type="text" /></div>
42
- </div>
43
-
44
- <ul id="full_list" class="file">
45
-
46
-
47
- <li id="object_README" class="odd">
48
- <div class="item"><span class="object_link"><a href="index.html" title="README">README</a></span></div>
49
- </li>
50
-
51
-
52
-
53
- </ul>
54
- </div>
55
- </body>
56
- </html>
data/docs/frames.html DELETED
@@ -1,17 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <title>Documentation by YARD 0.9.22</title>
6
- </head>
7
- <script type="text/javascript">
8
- var match = unescape(window.location.hash).match(/^#!(.+)/);
9
- var name = match ? match[1] : 'index.html';
10
- name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
11
- window.top.location = name;
12
- </script>
13
- <noscript>
14
- <h1>Oops!</h1>
15
- <h2>YARD requires JavaScript!</h2>
16
- </noscript>
17
- </html>
data/docs/index.html DELETED
@@ -1,250 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>
7
- Documentation by YARD 0.9.22
8
-
9
- </title>
10
-
11
- <link rel="stylesheet" href="css/style.css" type="text/css" />
12
-
13
- <link rel="stylesheet" href="css/common.css" type="text/css" />
14
-
15
- <script type="text/javascript">
16
- pathId = null;
17
- relpath = '';
18
- </script>
19
-
20
-
21
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
22
-
23
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
24
-
25
-
26
- </head>
27
- <body>
28
- <div class="nav_wrap">
29
- <iframe id="nav" src="class_list.html?1"></iframe>
30
- <div id="resizer"></div>
31
- </div>
32
-
33
- <div id="main" tabindex="-1">
34
- <div id="header">
35
- <div id="menu">
36
-
37
- </div>
38
-
39
- <div id="search">
40
-
41
- <a class="full_list_link" id="class_list_link"
42
- href="class_list.html">
43
-
44
- <svg width="24" height="24">
45
- <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
46
- <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
47
- <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
48
- </svg>
49
- </a>
50
-
51
- </div>
52
- <div class="clear"></div>
53
- </div>
54
-
55
- <div id="content"><h1 class="noborder title">Documentation by YARD 0.9.22</h1>
56
- <div id="listing">
57
- <h1 class="alphaindex">Alphabetic Index</h1>
58
-
59
- <h2>File Listing</h2>
60
- <ul id="files" class="index_inline_list">
61
-
62
-
63
- <li class="r1"><a href="index.html" title="README">README</a></li>
64
-
65
-
66
- </ul>
67
-
68
- <div class="clear"></div>
69
- <h2>Namespace Listing A-Z</h2>
70
-
71
-
72
-
73
-
74
- <table>
75
- <tr>
76
- <td valign='top' width="33%">
77
-
78
-
79
- <ul id="alpha_A" class="alpha">
80
- <li class="letter">A</li>
81
- <ul>
82
-
83
- <li>
84
- <span class='object_link'><a href="WorkOS/APIError.html" title="WorkOS::APIError (class)">APIError</a></span>
85
-
86
- <small>(WorkOS)</small>
87
-
88
- </li>
89
-
90
- <li>
91
- <span class='object_link'><a href="WorkOS/AuditTrail.html" title="WorkOS::AuditTrail (module)">AuditTrail</a></span>
92
-
93
- <small>(WorkOS)</small>
94
-
95
- </li>
96
-
97
- <li>
98
- <span class='object_link'><a href="WorkOS/AuthenticationError.html" title="WorkOS::AuthenticationError (class)">AuthenticationError</a></span>
99
-
100
- <small>(WorkOS)</small>
101
-
102
- </li>
103
-
104
- </ul>
105
- </ul>
106
-
107
-
108
- <ul id="alpha_B" class="alpha">
109
- <li class="letter">B</li>
110
- <ul>
111
-
112
- <li>
113
- <span class='object_link'><a href="WorkOS/Base.html" title="WorkOS::Base (module)">Base</a></span>
114
-
115
- <small>(WorkOS)</small>
116
-
117
- </li>
118
-
119
- </ul>
120
- </ul>
121
-
122
-
123
- <ul id="alpha_C" class="alpha">
124
- <li class="letter">C</li>
125
- <ul>
126
-
127
- <li>
128
- <span class='object_link'><a href="WorkOS/Client.html" title="WorkOS::Client (module)">Client</a></span>
129
-
130
- <small>(WorkOS)</small>
131
-
132
- </li>
133
-
134
- </ul>
135
- </ul>
136
-
137
-
138
- <ul id="alpha_I" class="alpha">
139
- <li class="letter">I</li>
140
- <ul>
141
-
142
- <li>
143
- <span class='object_link'><a href="WorkOS/InvalidRequestError.html" title="WorkOS::InvalidRequestError (class)">InvalidRequestError</a></span>
144
-
145
- <small>(WorkOS)</small>
146
-
147
- </li>
148
-
149
- </ul>
150
- </ul>
151
-
152
-
153
- <ul id="alpha_P" class="alpha">
154
- <li class="letter">P</li>
155
- <ul>
156
-
157
- <li>
158
- <span class='object_link'><a href="WorkOS/Profile.html" title="WorkOS::Profile (class)">Profile</a></span>
159
-
160
- <small>(WorkOS)</small>
161
-
162
- </li>
163
-
164
- <li>
165
- <span class='object_link'><a href="WorkOS/Types/ProfileStruct.html" title="WorkOS::Types::ProfileStruct (class)">ProfileStruct</a></span>
166
-
167
- <small>(WorkOS::Types)</small>
168
-
169
- </li>
170
-
171
- <li>
172
- <span class='object_link'><a href="WorkOS/Types/Provider.html" title="WorkOS::Types::Provider (class)">Provider</a></span>
173
-
174
- <small>(WorkOS::Types)</small>
175
-
176
- </li>
177
-
178
- </ul>
179
- </ul>
180
-
181
-
182
- <ul id="alpha_S" class="alpha">
183
- <li class="letter">S</li>
184
- <ul>
185
-
186
- <li>
187
- <span class='object_link'><a href="WorkOS/SSO.html" title="WorkOS::SSO (module)">SSO</a></span>
188
-
189
- <small>(WorkOS)</small>
190
-
191
- </li>
192
-
193
- </ul>
194
- </ul>
195
-
196
-
197
- <ul id="alpha_T" class="alpha">
198
- <li class="letter">T</li>
199
- <ul>
200
-
201
- <li>
202
- <span class='object_link'><a href="WorkOS/Types.html" title="WorkOS::Types (module)">Types</a></span>
203
-
204
- <small>(WorkOS)</small>
205
-
206
- </li>
207
-
208
- </ul>
209
- </ul>
210
-
211
-
212
- </td><td valign='top' width="33%">
213
-
214
-
215
- <ul id="alpha_W" class="alpha">
216
- <li class="letter">W</li>
217
- <ul>
218
-
219
- <li>
220
- <span class='object_link'><a href="WorkOS.html" title="WorkOS (module)">WorkOS</a></span>
221
-
222
- </li>
223
-
224
- <li>
225
- <span class='object_link'><a href="WorkOS/WorkOSError.html" title="WorkOS::WorkOSError (class)">WorkOSError</a></span>
226
-
227
- <small>(WorkOS)</small>
228
-
229
- </li>
230
-
231
- </ul>
232
- </ul>
233
-
234
- </td>
235
- </tr>
236
- </table>
237
-
238
- </div>
239
-
240
- </div>
241
-
242
- <div id="footer">
243
- Generated on Tue Apr 7 22:21:07 2020 by
244
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
245
- 0.9.22 (ruby-2.7.1).
246
- </div>
247
-
248
- </div>
249
- </body>
250
- </html>