duo_universal_ruby 0.1.0 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d8b04367166707ba3036e2f31abe79fe59e1ae37e9e804d6494d5399d92a98f
4
- data.tar.gz: 7d71a751b484f66f29d62226c9807217aa8287408ca2a4645a8aca58e9611b84
3
+ metadata.gz: f55b56ad695ff78ddadb49c27c10a9184dd62e68101221cb8eee2474226b1ec0
4
+ data.tar.gz: 4db1b2d803e2692fbcf32da757e101335db542caf3fd7d78e9296e4c3452e7b7
5
5
  SHA512:
6
- metadata.gz: 015ed26f061ce08c4d2265bf192bfc79e196d8804bd6a3893845ca87c483605da0738117cfb2bf44d09c0eaa425615e2dadc3e5c6cebff6a64cb8f11ba3c6497
7
- data.tar.gz: 5c24588c3626c91923dbbec002fdbb72786bcac43ba2674856ec29a486a1b9458f69a18a2f8f65c1055e98bda3061cb3c5f1056bc22f3e5d3e0d96681cc40a22
6
+ metadata.gz: e79206db4e70a6bd9944ce4799bbc661a7580d8a96855c2bfb8f069f9081d79d21b8c71854c074d044034f29a67bb6b9628f3dad4a8cb80aa439287356b6ba6f
7
+ data.tar.gz: 560c28117ec3a588ec77f0a10cf5397813ab4af5159d62afc05e584457c1e18cd113b8fd6caa1b1bfa27c0ee843ed9c272b6c4d0675d1014606f6a274936ddfd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
- ## [Unreleased]
2
-
3
- ## [0.1.0] - 2025-07-28
1
+ ## [0.1.0] - 2025-08-14
4
2
 
5
3
  - Initial release
4
+
5
+ ## [0.1.1] - 2025-08-15
6
+
7
+ - minor changes to gemfile, gemspec dependencies and documentation.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # DuoUniversalRuby
2
2
 
3
- ## A Ruby implementation of the Duo WebSDKv4 with Universal Prompt
3
+ ## A Ruby implementation of the 2FA API to Duo WebSDKv4 apps using the Universal Prompt
4
4
  - https://duo.com/docs/duoweb
5
5
  - https://duo.com/docs/oauthapi
6
6
 
@@ -19,7 +19,13 @@ If bundler is not being used to manage dependencies, install the gem by executin
19
19
  ## Usage
20
20
 
21
21
  ```ruby
22
- client = DuoUniversalRails::Client.new(
22
+ # Replace fake DUO constant values with real values obtained from DUO
23
+ DUO_CLIENT_ID = "X" * 20
24
+ DUO_CLIENT_SECRET = "x" * 40
25
+ DUO_HOST = "api-xxxxxxxx.duosecurity.com"
26
+ DUO_REDIRECT_URI = "https://localhost/duo-callback"
27
+
28
+ client = DuoUniversalRuby::Client.new(
23
29
  client_id: DUO_CLIENT_ID,
24
30
  client_secret: DUO_CLIENT_SECRET,
25
31
  api_host: DUO_HOST,
@@ -46,8 +52,11 @@ client.health_check
46
52
 
47
53
  state = client.generate_state
48
54
  # Random value that is checked after interactions to protect against CSRF attacks
49
-
50
- client.create_auth_url(username, state)
55
+
56
+ username = "test@example.com"
57
+ # user authenticating with Duo
58
+
59
+ client.create_auth_url(username: username, state: state)
51
60
  # Generate uri to Duo's prompt
52
61
  # GET /oauth/v1/authorize
53
62
 
@@ -59,31 +68,30 @@ client.create_auth_url(username, state)
59
68
  # Returns:
60
69
  # Authorization uri to redirect to for the Duo prompt
61
70
 
62
- # After a successful Duo login, Duo redirect the user to the redirect_uri, e.g. /duo_callback with a duoCode and state
71
+ # After a successful Duo authentication, Duo redirects the user to the redirect_uri, e.g. /duo_callback with the params: duo_code and state
72
+
73
+ decoded_token = client.exchange_authorization_code_for_2fa_result(duo_code: duo_code, username: username)
74
+ # Exchange the duo_code for a token with Duo to determine
75
+ # if the auth was successful.
63
76
 
64
- decoded_token = client.exchange_authorization_code_for_2fa_result(duoCode, username)
65
- # Exchange the duo_code for a token with Duo to determine
66
- # if the auth was successful.
77
+ # POST /oauth/v1/token
67
78
 
68
- # POST /oauth/v1/token
69
-
70
- # Arguments:
71
- # duoCode -- Authentication session transaction id
72
- # returned by Duo
73
- # username -- Name of the user authenticating with Duo
79
+ # Arguments:
80
+ # duo_code -- Authentication session transaction id returned by Duo
81
+ # username -- Name of the user authenticating with Duo
74
82
 
75
- # Return:
76
- # A token with meta-data about the auth
83
+ # Return:
84
+ # A token with meta-data about the auth
77
85
 
78
- # Raises:
79
- # DuoException on error for invalid duo_codes, invalid credentials,
80
- # or problems connecting to Duo
86
+ # Raises:
87
+ # DuoException on error for invalid duo_codes, invalid credentials,
88
+ # or problems connecting to Duo
81
89
 
82
90
  ```
83
91
 
84
92
  ## Development
85
93
 
86
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
94
+ Run `bin/console` for an interactive prompt that will allow you to experiment.
87
95
 
88
96
  To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
89
97
 
@@ -119,7 +119,7 @@ module DuoUniversalRuby
119
119
  # if the auth was successful.
120
120
 
121
121
  # Arguments:
122
- # duoCode -- Authentication session transaction id
122
+ # duo_code -- Authentication session transaction id
123
123
  # returned by Duo
124
124
  # username -- Name of the user authenticating with Duo
125
125
  # nonce -- (Optional) Random 36B string used to associate
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DuoUniversalRuby
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duo_universal_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Parsnick
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '0'
18
+ version: 2.2.2
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: '0'
25
+ version: 2.2.2
26
26
  description: Easily add two-factor authentication to any Ruby web authentication flow
27
27
  using a Web SDKv4 app with the universal prompt in Duo.
28
28
  email:
@@ -36,7 +36,6 @@ files:
36
36
  - LICENSE.txt
37
37
  - README.md
38
38
  - Rakefile
39
- - duo_universal_ruby.gemspec
40
39
  - lib/duo_universal_ruby.rb
41
40
  - lib/duo_universal_ruby/ca_certs.pem
42
41
  - lib/duo_universal_ruby/client.rb
@@ -50,7 +49,8 @@ licenses:
50
49
  metadata:
51
50
  homepage_uri: https://github.com/tparsnick/duo_universal_ruby
52
51
  source_code_uri: https://github.com/tparsnick/duo_universal_ruby
53
- changelog_uri: https://github.com/tparsnick/duo_universal_ruby/CHANGELOG.md
52
+ changelog_uri: https://github.com/tparsnick/duo_universal_ruby/blob/main/CHANGELOG.md
53
+ allowed_push_host: https://rubygems.org
54
54
  rdoc_options: []
55
55
  require_paths:
56
56
  - lib
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/duo_universal_ruby/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "duo_universal_ruby"
7
- spec.version = DuoUniversalRuby::VERSION
8
- spec.authors = ["Todd Parsnick"]
9
- spec.email = ["tparsnick@gmail.com"]
10
-
11
- spec.summary = "Easily add two-factor authentication to any Ruby web authentication flow using a Web SDKv4 app with the universal prompt in Duo."
12
- spec.description = "Easily add two-factor authentication to any Ruby web authentication flow using a Web SDKv4 app with the universal prompt in Duo."
13
- spec.homepage = 'https://github.com/tparsnick/duo_universal_ruby'
14
- spec.license = "MIT"
15
- spec.required_ruby_version = ">= 3.2.2"
16
-
17
- # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
18
-
19
- spec.metadata["homepage_uri"] = spec.homepage
20
- spec.metadata["source_code_uri"] = 'https://github.com/tparsnick/duo_universal_ruby'
21
- spec.metadata["changelog_uri"] = 'https://github.com/tparsnick/duo_universal_ruby/CHANGELOG.md'
22
-
23
- # Specify which files should be added to the gem when it is released.
24
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
- spec.files = Dir.chdir(__dir__) do
26
- `git ls-files -z`.split("\x0").reject do |f|
27
- (File.expand_path(f) == __FILE__) ||
28
- f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
29
- end
30
- end
31
- spec.bindir = "exe"
32
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
33
- spec.require_paths = ["lib"]
34
-
35
- # Runtime dependencies
36
- spec.add_runtime_dependency 'jwt'
37
-
38
- # For more information and examples about making a new gem, check out our
39
- # guide at: https://bundler.io/guides/creating_gem.html
40
- end