descope 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yaml +15 -27
- data/.github/workflows/publish-gem.yaml +36 -0
- data/Gemfile +12 -14
- data/Gemfile.lock +40 -87
- data/README.md +39 -17
- data/examples/ruby/access_key_app.rb +4 -2
- data/examples/ruby/management/Gemfile.lock +2 -2
- data/examples/ruby/management/role_app.rb +8 -3
- data/examples/ruby-on-rails-api/descope/.gitignore +58 -28
- data/examples/ruby-on-rails-api/descope/Gemfile.lock +3 -3
- data/examples/ruby-on-rails-api/descope/app/assets/builds/App.css +62 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/App.css.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/application.css +62 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/application.css.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/application.js +40369 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/application.js.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/App.css +62 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/App.css.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/App.js +27979 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/App.js.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/Dashboard.css +62 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/Dashboard.css.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/Dashboard.js +27118 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/Dashboard.js.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/Home.css +62 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/Home.css.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/Home.js +27113 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/Home.js.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/Login.css +62 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/Login.css.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/Login.js +27131 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/Login.js.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/Profile.css +62 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/Profile.css.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/Profile.js +27168 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/Profile.js.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/index.css +62 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/index.css.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/index.js +28250 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/components/index.js.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/controllers/application.js +2456 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/controllers/application.js.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/controllers/index.js +2453 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/controllers/index.js.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/reportWebVitals.js +211 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/reportWebVitals.js.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/routes/index.css +62 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/routes/index.css.map +7 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/routes/index.js +27973 -0
- data/examples/ruby-on-rails-api/descope/app/assets/builds/routes/index.js.map +7 -0
- data/examples/ruby-on-rails-api/descope/package-lock.json +7 -8
- data/examples/ruby-on-rails-api/descope/yarn.lock +3 -3
- data/lib/descope/api/v1/auth.rb +21 -6
- data/lib/descope/api/v1/management/access_key.rb +5 -4
- data/lib/descope/api/v1/management/common.rb +4 -1
- data/lib/descope/api/v1/management/role.rb +22 -6
- data/lib/descope/api/v1/management/user.rb +17 -0
- data/lib/descope/mixins/common.rb +2 -12
- data/lib/descope/mixins/http.rb +1 -1
- data/lib/descope/version.rb +1 -1
- data/spec/integration/lib.descope/api/v1/auth/enchantedlink_spec.rb +81 -0
- data/spec/integration/lib.descope/api/v1/auth/magiclink_spec.rb +49 -0
- data/spec/integration/lib.descope/api/v1/auth/otp_spec.rb +38 -0
- data/spec/integration/lib.descope/api/v1/auth/password_spec.rb +41 -0
- data/spec/integration/lib.descope/api/v1/auth/totp_spec.rb +76 -0
- data/spec/integration/lib.descope/api/v1/management/access_key_spec.rb +62 -0
- data/spec/integration/lib.descope/api/v1/management/audit_spec.rb +16 -0
- data/spec/integration/lib.descope/api/v1/management/authz_spec.rb +187 -0
- data/spec/integration/lib.descope/api/v1/management/flow_spec.rb +44 -0
- data/spec/integration/lib.descope/api/v1/management/permissions_spec.rb +27 -0
- data/spec/integration/lib.descope/api/v1/management/project_spec.rb +29 -0
- data/spec/integration/lib.descope/api/v1/management/roles_spec.rb +116 -0
- data/spec/integration/lib.descope/api/v1/management/user_spec.rb +262 -0
- data/spec/lib.descope/api/v1/auth_spec.rb +50 -1
- data/spec/lib.descope/api/v1/management/access_key_spec.rb +4 -2
- data/spec/lib.descope/api/v1/management/role_spec.rb +35 -6
- data/spec/lib.descope/api/v1/management/user_spec.rb +40 -0
- data/spec/spec_helper.rb +9 -38
- data/spec/support/client_config.rb +5 -1
- data/spec/support/dummy_class.rb +15 -1
- data/spec/support/utils.rb +1 -1
- metadata +56 -4
- data/examples/ruby-on-rails-api/descope/tmp/pids/.keep +0 -0
- data/examples/ruby-on-rails-api/descope/tmp/storage/.keep +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cec3cb315d2015591a727a55440f878d49df010ad72f31522eb93bf927bc1cf8
|
|
4
|
+
data.tar.gz: e207e1b64908011868e269257d2879d2ebc112025e56cea97a15aed0eefc8dbc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 46585ad1d53f2383c9458d310ae8e41a13bb3da9c72479b5ebd4e91f73544f8d4cb7dca8e3e2b4704e87f4532046a014bb4b5f3c7206d53a1a37da1634e152e9
|
|
7
|
+
data.tar.gz: 47383953f8613b0ae07e3ced035d5f06392faeec4b7cb0756bdc2dc7793c75c607f99b54bd46ea292cfb62ce55767e0b364ba04c39a46718e3507693262e0599
|
data/.github/workflows/ci.yaml
CHANGED
|
@@ -7,10 +7,18 @@ on:
|
|
|
7
7
|
pull_request:
|
|
8
8
|
branches:
|
|
9
9
|
- main
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
inputs:
|
|
12
|
+
DESCOPE_LOG_LEVEL:
|
|
13
|
+
description: "Descope Log Level"
|
|
14
|
+
default: "info"
|
|
15
|
+
|
|
16
|
+
env:
|
|
17
|
+
DESCOPE_LOG_LEVEL: ${{ github.event.inputs.DESCOPE_LOG_LEVEL || 'info' }}
|
|
10
18
|
|
|
11
19
|
jobs:
|
|
12
|
-
|
|
13
|
-
name:
|
|
20
|
+
ci:
|
|
21
|
+
name: Descope Ruby SDK CI
|
|
14
22
|
runs-on: ubuntu-latest
|
|
15
23
|
steps:
|
|
16
24
|
- name: Checkout Code
|
|
@@ -25,30 +33,10 @@ jobs:
|
|
|
25
33
|
run: bundle install
|
|
26
34
|
|
|
27
35
|
- name: Run RSpec Test
|
|
28
|
-
run: bundle exec rspec
|
|
29
|
-
|
|
30
|
-
# in order to release use conventional commits
|
|
31
|
-
# $ git commit --allow-empty -m "chore: release 1.0.0" -m "Release-As: 1.0.0" && git push
|
|
32
|
-
# this will open a new PR with the changelog and bump the version
|
|
33
|
-
# Release Please assumes you are using Conventional Commit messages.
|
|
34
|
-
#
|
|
35
|
-
# The most important prefixes you should have in mind are:
|
|
36
|
-
#
|
|
37
|
-
# fix: which represents bug fixes, and correlates to a SemVer patch.
|
|
38
|
-
# feat: which represents a new feature, and correlates to a SemVer minor.
|
|
39
|
-
# feat!:, or fix!:, refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a SemVer major.
|
|
40
|
-
- uses: google-github-actions/release-please-action@v4
|
|
41
|
-
id: release
|
|
42
|
-
if: github.ref == 'refs/heads/main'
|
|
36
|
+
run: bundle exec rspec spec/lib.descope
|
|
43
37
|
|
|
44
|
-
- name:
|
|
45
|
-
run: |
|
|
46
|
-
mkdir -p $HOME/.gem
|
|
47
|
-
touch $HOME/.gem/credentials
|
|
48
|
-
chmod 0600 $HOME/.gem/credentials
|
|
49
|
-
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
|
50
|
-
gem build *.gemspec
|
|
51
|
-
gem push *.gem
|
|
38
|
+
- name: Run RSpec Integration Tests
|
|
52
39
|
env:
|
|
53
|
-
|
|
54
|
-
|
|
40
|
+
DESCOPE_MANAGEMENT_KEY: ${{ secrets.DESCOPE_MANAGEMENT_KEY }}
|
|
41
|
+
DESCOPE_PROJECT_ID: ${{ secrets.DESCOPE_PROJECT_ID }}
|
|
42
|
+
run: bundle exec rspec spec/integration
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Publish Ruby Gem
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
pull-requests: read # to detect changes files
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish-gem:
|
|
13
|
+
name: Publish Ruby Gem
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout Code
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- uses: ruby/setup-ruby@v1
|
|
20
|
+
with:
|
|
21
|
+
# We are not letting this step to run bundle install, we will do it later
|
|
22
|
+
bundler-cache: false
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: bundle install
|
|
26
|
+
|
|
27
|
+
- name: Publish to RubyGems
|
|
28
|
+
run: |
|
|
29
|
+
mkdir -p $HOME/.gem
|
|
30
|
+
touch $HOME/.gem/credentials
|
|
31
|
+
chmod 0600 $HOME/.gem/credentials
|
|
32
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
|
33
|
+
gem build *.gemspec
|
|
34
|
+
gem push *.gem
|
|
35
|
+
env:
|
|
36
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"
|
data/Gemfile
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
source 'https://rubygems.org'
|
|
2
4
|
gemspec
|
|
3
5
|
|
|
4
6
|
group :development do
|
|
5
|
-
gem '
|
|
6
|
-
gem '
|
|
7
|
-
gem 'rubocop', require: false
|
|
8
|
-
gem 'rubocop-rails', require: false
|
|
9
|
-
gem 'irb', require: false
|
|
7
|
+
gem 'rubocop', '1.60.2', require: false
|
|
8
|
+
gem 'rubocop-rails', '2.23.1', require: false
|
|
10
9
|
end
|
|
11
10
|
|
|
12
11
|
group :test do
|
|
13
|
-
gem '
|
|
14
|
-
gem '
|
|
15
|
-
gem '
|
|
16
|
-
gem '
|
|
17
|
-
gem '
|
|
18
|
-
gem '
|
|
19
|
-
gem '
|
|
20
|
-
gem '
|
|
21
|
-
gem 'rotp', require: false
|
|
12
|
+
gem 'factory_bot', '6.4.6', require: false
|
|
13
|
+
gem 'faker', require: false
|
|
14
|
+
gem 'rack-test', '2.1.0', require: false
|
|
15
|
+
gem 'rotp', '6.3.0', require: false
|
|
16
|
+
gem 'rspec', '3.13.0', require: false
|
|
17
|
+
gem 'selenium-webdriver', '4.17.0', require: false
|
|
18
|
+
gem 'simplecov', '0.22.0', require: false
|
|
19
|
+
gem 'super_diff', '0.11.0', require: false
|
|
22
20
|
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
descope (1.0.
|
|
4
|
+
descope (1.0.5)
|
|
5
5
|
addressable (~> 2.8)
|
|
6
6
|
jwt (~> 2.7)
|
|
7
7
|
rest-client (~> 2.1)
|
|
@@ -11,7 +11,7 @@ PATH
|
|
|
11
11
|
GEM
|
|
12
12
|
remote: https://rubygems.org/
|
|
13
13
|
specs:
|
|
14
|
-
activesupport (7.1.3)
|
|
14
|
+
activesupport (7.1.3.2)
|
|
15
15
|
base64
|
|
16
16
|
bigdecimal
|
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
@@ -26,71 +26,50 @@ GEM
|
|
|
26
26
|
ast (2.4.2)
|
|
27
27
|
attr_extras (7.1.0)
|
|
28
28
|
base64 (0.2.0)
|
|
29
|
-
bigdecimal (3.1.
|
|
29
|
+
bigdecimal (3.1.7)
|
|
30
30
|
concurrent-ruby (1.2.3)
|
|
31
31
|
connection_pool (2.4.1)
|
|
32
|
-
|
|
33
|
-
multi_json (~> 1.3)
|
|
34
|
-
rest-client
|
|
35
|
-
simplecov (>= 0.7)
|
|
36
|
-
term-ansicolor
|
|
37
|
-
thor
|
|
38
|
-
crack (0.4.5)
|
|
39
|
-
rexml
|
|
40
|
-
diff-lcs (1.5.0)
|
|
32
|
+
diff-lcs (1.5.1)
|
|
41
33
|
docile (1.4.0)
|
|
42
34
|
domain_name (0.6.20240107)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
ruby2_keywords
|
|
46
|
-
factory_bot (6.4.5)
|
|
35
|
+
drb (2.2.1)
|
|
36
|
+
factory_bot (6.4.6)
|
|
47
37
|
activesupport (>= 5.0.0)
|
|
48
|
-
faker (2.
|
|
38
|
+
faker (3.2.3)
|
|
49
39
|
i18n (>= 1.8.11, < 2)
|
|
50
40
|
fuubar (2.5.1)
|
|
51
41
|
rspec-core (~> 3.0)
|
|
52
42
|
ruby-progressbar (~> 1.4)
|
|
53
|
-
hashdiff (1.1.0)
|
|
54
43
|
http-accept (1.7.0)
|
|
55
44
|
http-cookie (1.0.5)
|
|
56
45
|
domain_name (~> 0.5)
|
|
57
|
-
i18n (1.14.
|
|
46
|
+
i18n (1.14.4)
|
|
58
47
|
concurrent-ruby (~> 1.0)
|
|
59
|
-
io-console (0.7.2)
|
|
60
|
-
irb (1.11.1)
|
|
61
|
-
rdoc
|
|
62
|
-
reline (>= 0.4.2)
|
|
63
48
|
json (2.7.1)
|
|
64
|
-
jwt (2.
|
|
49
|
+
jwt (2.8.1)
|
|
50
|
+
base64
|
|
65
51
|
language_server-protocol (3.17.0.3)
|
|
66
52
|
mime-types (3.5.2)
|
|
67
53
|
mime-types-data (~> 3.2015)
|
|
68
|
-
mime-types-data (3.
|
|
69
|
-
minitest (5.
|
|
70
|
-
multi_json (1.15.0)
|
|
54
|
+
mime-types-data (3.2024.0305)
|
|
55
|
+
minitest (5.22.3)
|
|
71
56
|
mutex_m (0.2.0)
|
|
72
57
|
netrc (0.11.0)
|
|
73
58
|
optimist (3.1.0)
|
|
74
59
|
parallel (1.24.0)
|
|
75
|
-
parser (3.3.0.
|
|
60
|
+
parser (3.3.0.5)
|
|
76
61
|
ast (~> 2.4.1)
|
|
77
62
|
racc
|
|
78
63
|
patience_diff (1.2.0)
|
|
79
64
|
optimist (~> 3.0)
|
|
80
|
-
psych (5.1.2)
|
|
81
|
-
stringio
|
|
82
65
|
public_suffix (5.0.4)
|
|
83
66
|
racc (1.7.3)
|
|
84
|
-
rack (3.0.
|
|
67
|
+
rack (3.0.9.1)
|
|
85
68
|
rack-test (2.1.0)
|
|
86
69
|
rack (>= 1.3)
|
|
87
70
|
rainbow (3.1.1)
|
|
88
71
|
rake (13.1.0)
|
|
89
|
-
rdoc (6.6.2)
|
|
90
|
-
psych (>= 4.0.0)
|
|
91
72
|
regexp_parser (2.9.0)
|
|
92
|
-
reline (0.4.2)
|
|
93
|
-
io-console (~> 0.5)
|
|
94
73
|
rest-client (2.1.0)
|
|
95
74
|
http-accept (>= 1.7.0, < 2.0)
|
|
96
75
|
http-cookie (>= 1.0.2, < 2.0)
|
|
@@ -99,20 +78,20 @@ GEM
|
|
|
99
78
|
retryable (3.0.5)
|
|
100
79
|
rexml (3.2.6)
|
|
101
80
|
rotp (6.3.0)
|
|
102
|
-
rspec (3.
|
|
103
|
-
rspec-core (~> 3.
|
|
104
|
-
rspec-expectations (~> 3.
|
|
105
|
-
rspec-mocks (~> 3.
|
|
106
|
-
rspec-core (3.
|
|
107
|
-
rspec-support (~> 3.
|
|
108
|
-
rspec-expectations (3.
|
|
81
|
+
rspec (3.13.0)
|
|
82
|
+
rspec-core (~> 3.13.0)
|
|
83
|
+
rspec-expectations (~> 3.13.0)
|
|
84
|
+
rspec-mocks (~> 3.13.0)
|
|
85
|
+
rspec-core (3.13.0)
|
|
86
|
+
rspec-support (~> 3.13.0)
|
|
87
|
+
rspec-expectations (3.13.0)
|
|
109
88
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
110
|
-
rspec-support (~> 3.
|
|
111
|
-
rspec-mocks (3.
|
|
89
|
+
rspec-support (~> 3.13.0)
|
|
90
|
+
rspec-mocks (3.13.0)
|
|
112
91
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
113
|
-
rspec-support (~> 3.
|
|
114
|
-
rspec-support (3.
|
|
115
|
-
rubocop (1.60.
|
|
92
|
+
rspec-support (~> 3.13.0)
|
|
93
|
+
rspec-support (3.13.1)
|
|
94
|
+
rubocop (1.60.2)
|
|
116
95
|
json (~> 2.3)
|
|
117
96
|
language_server-protocol (>= 3.17.0)
|
|
118
97
|
parallel (~> 1.10)
|
|
@@ -123,15 +102,14 @@ GEM
|
|
|
123
102
|
rubocop-ast (>= 1.30.0, < 2.0)
|
|
124
103
|
ruby-progressbar (~> 1.7)
|
|
125
104
|
unicode-display_width (>= 2.4.0, < 3.0)
|
|
126
|
-
rubocop-ast (1.
|
|
127
|
-
parser (>= 3.
|
|
105
|
+
rubocop-ast (1.31.2)
|
|
106
|
+
parser (>= 3.3.0.4)
|
|
128
107
|
rubocop-rails (2.23.1)
|
|
129
108
|
activesupport (>= 4.2.0)
|
|
130
109
|
rack (>= 1.1)
|
|
131
110
|
rubocop (>= 1.33.0, < 2.0)
|
|
132
111
|
rubocop-ast (>= 1.30.0, < 2.0)
|
|
133
112
|
ruby-progressbar (1.13.0)
|
|
134
|
-
ruby2_keywords (0.0.5)
|
|
135
113
|
rubyzip (2.3.2)
|
|
136
114
|
selenium-webdriver (4.17.0)
|
|
137
115
|
base64 (~> 0.2)
|
|
@@ -142,63 +120,38 @@ GEM
|
|
|
142
120
|
docile (~> 1.1)
|
|
143
121
|
simplecov-html (~> 0.11)
|
|
144
122
|
simplecov_json_formatter (~> 0.1)
|
|
145
|
-
simplecov-cobertura (2.1.0)
|
|
146
|
-
rexml
|
|
147
|
-
simplecov (~> 0.19)
|
|
148
123
|
simplecov-html (0.12.3)
|
|
149
124
|
simplecov_json_formatter (0.1.4)
|
|
150
|
-
|
|
151
|
-
super_diff (0.10.0)
|
|
125
|
+
super_diff (0.11.0)
|
|
152
126
|
attr_extras (>= 6.2.4)
|
|
153
127
|
diff-lcs
|
|
154
128
|
patience_diff
|
|
155
|
-
sync (0.5.0)
|
|
156
|
-
term-ansicolor (1.7.1)
|
|
157
|
-
tins (~> 1.0)
|
|
158
|
-
terminal-notifier-guard (1.7.0)
|
|
159
|
-
thor (1.3.0)
|
|
160
|
-
timecop (0.9.8)
|
|
161
|
-
tins (1.32.1)
|
|
162
|
-
sync
|
|
163
129
|
tzinfo (2.0.6)
|
|
164
130
|
concurrent-ruby (~> 1.0)
|
|
165
131
|
unicode-display_width (2.5.0)
|
|
166
|
-
webmock (3.19.1)
|
|
167
|
-
addressable (>= 2.8.0)
|
|
168
|
-
crack (>= 0.3.2)
|
|
169
|
-
hashdiff (>= 0.4.0, < 2.0.0)
|
|
170
132
|
websocket (1.2.10)
|
|
171
133
|
zache (0.13.1)
|
|
172
134
|
|
|
173
135
|
PLATFORMS
|
|
174
|
-
arm64-darwin-22
|
|
175
136
|
arm64-darwin-23
|
|
176
|
-
x86_64-darwin-23
|
|
177
137
|
x86_64-linux
|
|
178
138
|
|
|
179
139
|
DEPENDENCIES
|
|
180
140
|
bundler
|
|
181
141
|
concurrent-ruby (~> 1.1)
|
|
182
|
-
coveralls
|
|
183
142
|
descope!
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
faker (~> 2.0)
|
|
143
|
+
factory_bot (= 6.4.6)
|
|
144
|
+
faker
|
|
187
145
|
fuubar (~> 2.0)
|
|
188
|
-
|
|
189
|
-
rack-test
|
|
146
|
+
rack-test (= 2.1.0)
|
|
190
147
|
rake (~> 13.0)
|
|
191
|
-
rotp
|
|
192
|
-
rspec (
|
|
193
|
-
rubocop
|
|
194
|
-
rubocop-rails
|
|
195
|
-
selenium-webdriver
|
|
196
|
-
simplecov (
|
|
197
|
-
|
|
198
|
-
super_diff
|
|
199
|
-
terminal-notifier-guard
|
|
200
|
-
timecop
|
|
201
|
-
webmock
|
|
148
|
+
rotp (= 6.3.0)
|
|
149
|
+
rspec (= 3.13.0)
|
|
150
|
+
rubocop (= 1.60.2)
|
|
151
|
+
rubocop-rails (= 2.23.1)
|
|
152
|
+
selenium-webdriver (= 4.17.0)
|
|
153
|
+
simplecov (= 0.22.0)
|
|
154
|
+
super_diff (= 0.11.0)
|
|
202
155
|
|
|
203
156
|
BUNDLED WITH
|
|
204
|
-
2.
|
|
157
|
+
2.5.6
|
data/README.md
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
Descope SDK for Ruby
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
The Descope SDK for Ruby provides convenient access to the Descope user management and authentication API for a backend written in Ruby. You can read more on the Descope Website.
|
|
5
|
-
|
|
6
1
|
# Descope SDK for Ruby
|
|
7
2
|
|
|
8
3
|
The Descope SDK for Ruby provides convenient access to the Descope user management and authentication API
|
|
@@ -36,6 +31,13 @@ descope_client = Descope::Client.new(
|
|
|
36
31
|
)
|
|
37
32
|
```
|
|
38
33
|
|
|
34
|
+
### Important Logging note
|
|
35
|
+
You may pass `log_level: 'debug'` to the client config or use `DESCOPE_LOG_LEVEL` env var.
|
|
36
|
+
Be aware that only the management key is truncated, and the JWT responses are printed on debug
|
|
37
|
+
|
|
38
|
+
Do not run with log level debug on Production!
|
|
39
|
+
|
|
40
|
+
|
|
39
41
|
## Authentication Methods
|
|
40
42
|
These sections show how to use the SDK to perform various authentication/authorization functions:
|
|
41
43
|
|
|
@@ -77,7 +79,7 @@ For rate limiting information, please confer to the [API Rate Limits](#api-rate-
|
|
|
77
79
|
|
|
78
80
|
### OTP Authentication
|
|
79
81
|
|
|
80
|
-
Send a user a one-time password (OTP) using your preferred delivery method (
|
|
82
|
+
Send a user a one-time password (OTP) using your preferred delivery method (email/SMS). An email address or phone number must be provided accordingly.
|
|
81
83
|
|
|
82
84
|
The user can either `sign up`, `sign in` or `sign up or in`
|
|
83
85
|
|
|
@@ -385,7 +387,7 @@ containing the session and refresh tokens, as well as all of the JWT claims.
|
|
|
385
387
|
Make sure to return the tokens from the response to the client, or updated the cookie if you're using it.
|
|
386
388
|
|
|
387
389
|
Usually, the tokens can be passed in and out via HTTP headers or via a cookie.
|
|
388
|
-
The implementation can defer according to your framework of choice. See our [
|
|
390
|
+
The implementation can defer according to your framework of choice. See our [examples](#code-examples) for a few examples.
|
|
389
391
|
|
|
390
392
|
If Roles & Permissions are used, validate them immediately after validating the session. See the [next section](#roles--permission-validation)
|
|
391
393
|
for more information.
|
|
@@ -614,13 +616,15 @@ end
|
|
|
614
616
|
|
|
615
617
|
#### Set or Expire User Password
|
|
616
618
|
|
|
617
|
-
You can set
|
|
618
|
-
|
|
619
|
-
The user will not be able log-in using an expired password, and will be required replace it on next login.
|
|
619
|
+
You can set a new active password for a user, which they can then use to sign in. You can also set a temporary
|
|
620
|
+
password that the user will be forced to change on the next login.
|
|
620
621
|
|
|
621
622
|
```ruby
|
|
623
|
+
# Set a user's temporary password
|
|
624
|
+
descope_client.set_temporary_password(login_id: '<login-id>', password: '<some-password>');
|
|
625
|
+
|
|
622
626
|
# Set a user's password
|
|
623
|
-
descope_client.
|
|
627
|
+
descope_client.set_active_password(login_id: '<login-id>', password: '<some-password>');
|
|
624
628
|
|
|
625
629
|
# Or alternatively, expire a user password
|
|
626
630
|
descope_client.expire_password('<login-id>')
|
|
@@ -633,12 +637,14 @@ You can create, update, delete or load access keys, as well as search according
|
|
|
633
637
|
```ruby
|
|
634
638
|
# An access key must have a name and expiration, other fields are optional.
|
|
635
639
|
# Roles should be set directly if no tenants exist, otherwise set
|
|
636
|
-
# on a per-tenant basis.
|
|
640
|
+
# on a per-tenant basis. If custom_claims supplied they will be presented on the jwt.
|
|
641
|
+
# If customClaims is supplied, then those claims will be present in the JWT returned by calls to ExchangeAccessKey.
|
|
637
642
|
associated_tenants = [{ tenant_id: 'tenant_id1', role_names: %w[role_name1 role_name2] }]
|
|
638
643
|
create_resp = descope_client.create_access_key(
|
|
639
644
|
name: 'name',
|
|
640
645
|
expire_time: 1677844931,
|
|
641
|
-
key_tenants: associated_tenants
|
|
646
|
+
key_tenants: associated_tenants,
|
|
647
|
+
custom_claims: {'k1': 'v1'}
|
|
642
648
|
)
|
|
643
649
|
key = create_resp['key']
|
|
644
650
|
cleartext = create_resp['cleartext'] # make sure to save the returned cleartext securely. It will not be returned again.
|
|
@@ -738,6 +744,7 @@ descope_client.create_role(
|
|
|
738
744
|
name: 'My Role',
|
|
739
745
|
description: 'Optional description to briefly explain what this role allows.',
|
|
740
746
|
permission_names: ['My Updated Permission'],
|
|
747
|
+
tenant_id: 'Optionally scope this role for this specific tenant. If left empty, the role will be available to all tenants.'
|
|
741
748
|
)
|
|
742
749
|
|
|
743
750
|
# Update will override all fields as is. Use carefully.
|
|
@@ -745,11 +752,12 @@ descope_client.update_role(
|
|
|
745
752
|
name: 'My Role',
|
|
746
753
|
new_name: 'My Updated Role',
|
|
747
754
|
description: 'A revised description',
|
|
748
|
-
permission_names: ['My Updated Permission', 'Another Permission']
|
|
755
|
+
permission_names: ['My Updated Permission', 'Another Permission'],
|
|
756
|
+
tenant_id: 'The tenant ID to which this role is associated, leave empty, if role is a global one'
|
|
749
757
|
)
|
|
750
758
|
|
|
751
759
|
# Role deletion cannot be undone. Use carefully.
|
|
752
|
-
descope_client.delete_role('My Updated Role')
|
|
760
|
+
descope_client.delete_role(name: 'My Updated Role', tenant_id: 'The tenant ID to which this role is associated, leave empty, if role is a global one')
|
|
753
761
|
|
|
754
762
|
# Load all roles
|
|
755
763
|
roles_resp = descope_client.load_all_roles()
|
|
@@ -760,6 +768,20 @@ roles = roles_resp['roles']
|
|
|
760
768
|
#
|
|
761
769
|
```
|
|
762
770
|
|
|
771
|
+
# Search roles
|
|
772
|
+
roles_resp = descope_client.search_roles(
|
|
773
|
+
names: ['role1', 'role2'], # Search for roles with the names 'role1' and 'role2'
|
|
774
|
+
role_name_like: 'role', # Search for roles that contain the string 'role'
|
|
775
|
+
tenant_ids: ['tenant1', 'tenant2'], # Search for roles that are associated with the tenants 'tenant1' and 'tenant2'
|
|
776
|
+
permission_names: ['permission1', 'permission2'] # Search for roles that have the permissions 'permission1' and 'permission2'
|
|
777
|
+
)
|
|
778
|
+
|
|
779
|
+
roles = roles_resp['roles']
|
|
780
|
+
roles.each do |role|
|
|
781
|
+
# Do something
|
|
782
|
+
end
|
|
783
|
+
```
|
|
784
|
+
|
|
763
785
|
### Manage Flows and Theme
|
|
764
786
|
|
|
765
787
|
You can list your flows and also import and export flows and screens, or the project theme:
|
|
@@ -1132,9 +1154,9 @@ end
|
|
|
1132
1154
|
# This variable indicates how many seconds until the next valid API call can take place.
|
|
1133
1155
|
```
|
|
1134
1156
|
|
|
1135
|
-
## Code
|
|
1157
|
+
## Code Examples
|
|
1136
1158
|
|
|
1137
|
-
You can find various usage
|
|
1159
|
+
You can find various usage examples in the [examples folder](https://github.com/descope/ruby-sdk/blob/main/examples).
|
|
1138
1160
|
|
|
1139
1161
|
## Run Locally
|
|
1140
1162
|
|
|
@@ -11,7 +11,6 @@ require 'descope'
|
|
|
11
11
|
@logger.info("Initializing Descope API with project_id: #{@project_id} and base_uri: #{@base_uri}")
|
|
12
12
|
|
|
13
13
|
@client = Descope::Client.new({ project_id: @project_id, management_key: @management_key })
|
|
14
|
-
|
|
15
14
|
access_key = nil
|
|
16
15
|
|
|
17
16
|
begin
|
|
@@ -23,7 +22,10 @@ begin
|
|
|
23
22
|
end
|
|
24
23
|
|
|
25
24
|
begin
|
|
26
|
-
|
|
25
|
+
login_options = {
|
|
26
|
+
customClaims: { "k1": 'v1' }
|
|
27
|
+
}
|
|
28
|
+
jwt_response = @client.exchange_access_key(access_key:, login_options:)
|
|
27
29
|
@logger.info('exchange access key successfully')
|
|
28
30
|
@logger.info("jwt_response: #{jwt_response}")
|
|
29
31
|
|
|
@@ -3,7 +3,7 @@ GEM
|
|
|
3
3
|
specs:
|
|
4
4
|
addressable (2.8.6)
|
|
5
5
|
public_suffix (>= 2.0.2, < 6.0)
|
|
6
|
-
descope (1.0.
|
|
6
|
+
descope (1.0.4)
|
|
7
7
|
addressable (~> 2.8)
|
|
8
8
|
jwt (~> 2.7)
|
|
9
9
|
rest-client (~> 2.1)
|
|
@@ -16,7 +16,7 @@ GEM
|
|
|
16
16
|
jwt (2.7.1)
|
|
17
17
|
mime-types (3.5.2)
|
|
18
18
|
mime-types-data (~> 3.2015)
|
|
19
|
-
mime-types-data (3.
|
|
19
|
+
mime-types-data (3.2024.0206)
|
|
20
20
|
netrc (0.11.0)
|
|
21
21
|
public_suffix (5.0.4)
|
|
22
22
|
rest-client (2.1.0)
|
|
@@ -15,9 +15,13 @@ require 'descope'
|
|
|
15
15
|
name = 'My Role'
|
|
16
16
|
|
|
17
17
|
begin
|
|
18
|
+
@logger.info('Creating a new tenant')
|
|
19
|
+
puts 'Please insert a new tenant name'
|
|
20
|
+
tenant_name = gets.chomp
|
|
21
|
+
tenant = @client.create_tenant(name: tenant_name)
|
|
18
22
|
@logger.info('Going to create a new role')
|
|
19
23
|
@client.create_role(
|
|
20
|
-
name:, description: 'Allowed to test :)', permission_names: ['SSO Admin']
|
|
24
|
+
name:, description: 'Allowed to test :)', permission_names: ['SSO Admin'], tenant_id: tenant['id']
|
|
21
25
|
)
|
|
22
26
|
rescue Descope::AuthException => e
|
|
23
27
|
@logger.info("Role creation failed #{e}")
|
|
@@ -41,7 +45,8 @@ begin
|
|
|
41
45
|
name:,
|
|
42
46
|
new_name: 'My Updated Role',
|
|
43
47
|
description: 'New Description',
|
|
44
|
-
permission_names: ['User Admin']
|
|
48
|
+
permission_names: ['User Admin'],
|
|
49
|
+
tenant_id: tenant['id']
|
|
45
50
|
)
|
|
46
51
|
|
|
47
52
|
rescue Descope::AuthException => e
|
|
@@ -50,7 +55,7 @@ end
|
|
|
50
55
|
|
|
51
56
|
begin
|
|
52
57
|
@logger.info('Deleting newly created role')
|
|
53
|
-
@client.delete_role('My Updated Role')
|
|
58
|
+
@client.delete_role(name: 'My Updated Role', tenant_id: tenant['id'])
|
|
54
59
|
|
|
55
60
|
rescue Descope::AuthException => e
|
|
56
61
|
@logger.error("Role deletion failed #{e}")
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
*.rbc
|
|
2
|
+
capybara-*.html
|
|
3
|
+
.rspec
|
|
4
|
+
/db/*.sqlite3
|
|
5
|
+
/db/*.sqlite3-journal
|
|
6
|
+
/db/*.sqlite3-[0-9]*
|
|
7
|
+
/public/system
|
|
8
|
+
/coverage/
|
|
9
|
+
/spec/tmp
|
|
10
|
+
*.orig
|
|
11
|
+
rerun.txt
|
|
12
|
+
pickle-email-*.html
|
|
13
13
|
|
|
14
14
|
# Ignore all logfiles and tempfiles.
|
|
15
15
|
/log/*
|
|
@@ -17,24 +17,54 @@
|
|
|
17
17
|
!/log/.keep
|
|
18
18
|
!/tmp/.keep
|
|
19
19
|
|
|
20
|
-
#
|
|
21
|
-
/
|
|
22
|
-
|
|
23
|
-
!/tmp/pids/.keep
|
|
20
|
+
# TODO Comment out this rule if you are OK with secrets being uploaded to the repo
|
|
21
|
+
config/initializers/secret_token.rb
|
|
22
|
+
config/master.key
|
|
24
23
|
|
|
25
|
-
#
|
|
26
|
-
/
|
|
27
|
-
!/storage/.keep
|
|
28
|
-
/tmp/storage/*
|
|
29
|
-
!/tmp/storage/
|
|
30
|
-
!/tmp/storage/.keep
|
|
24
|
+
# Only include if you have production secrets in this file, which is no longer a Rails default
|
|
25
|
+
# config/secrets.yml
|
|
31
26
|
|
|
32
|
-
|
|
27
|
+
# dotenv, dotenv-rails
|
|
28
|
+
# TODO Comment out these rules if environment variables can be committed
|
|
29
|
+
.env
|
|
30
|
+
.env*.local
|
|
31
|
+
|
|
32
|
+
## Environment normalization:
|
|
33
|
+
/.bundle
|
|
34
|
+
/vendor/bundle
|
|
35
|
+
|
|
36
|
+
# these should all be checked in to normalize the environment:
|
|
37
|
+
# Gemfile.lock, .ruby-version, .ruby-gemset
|
|
33
38
|
|
|
34
|
-
#
|
|
35
|
-
|
|
39
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
40
|
+
.rvmrc
|
|
36
41
|
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
# if using bower-rails ignore default bower_components path bower.json files
|
|
43
|
+
/vendor/assets/bower_components
|
|
44
|
+
*.bowerrc
|
|
45
|
+
bower.json
|
|
39
46
|
|
|
40
|
-
|
|
47
|
+
# Ignore pow environment settings
|
|
48
|
+
.powenv
|
|
49
|
+
|
|
50
|
+
# Ignore Byebug command history file.
|
|
51
|
+
.byebug_history
|
|
52
|
+
|
|
53
|
+
# Ignore node_modules
|
|
54
|
+
node_modules/
|
|
55
|
+
|
|
56
|
+
# Ignore precompiled javascript packs
|
|
57
|
+
/public/packs
|
|
58
|
+
/public/packs-test
|
|
59
|
+
/public/assets
|
|
60
|
+
|
|
61
|
+
# Ignore yarn files
|
|
62
|
+
/yarn-error.log
|
|
63
|
+
yarn-debug.log*
|
|
64
|
+
.yarn-integrity
|
|
65
|
+
|
|
66
|
+
# Ignore uploaded files in development
|
|
67
|
+
/storage/*
|
|
68
|
+
!/storage/.keep
|
|
69
|
+
/public/uploads
|
|
70
|
+
/node_modules/
|