omniauth-forge 0.1.0 → 0.1.1

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: 030c57825f02ede7d28d7b5e0148f4d4f7ad889f4a663e40ad356696b3e0bfda
4
- data.tar.gz: e981ae3f5c43d3453b402800b182f7becefc9d22ca49406f08811a87c37fed3f
3
+ metadata.gz: 72f5c084eacd60348693d77e990423a61d335f62aa6fb9a5f2fb5b4d51e10adf
4
+ data.tar.gz: 74581f47e1a8549fa1c1a34128b22953da6dc3e5b9dd6e7affb2188d49975449
5
5
  SHA512:
6
- metadata.gz: 448329592c1df2d6e731ef6b0e3ef13fa77fa6bb2e35a11bb23d8c67b7d8a5243076fbc5c33276e4ca7686d16c27af594b7412e2dc1a3674502b502e967c5d8b
7
- data.tar.gz: 91cb66df43ddf40cb03e47310aa722c2b85a1d7b806b2ac48812bdc66a8fdee267fdffef9fd1898bffaa7e1b882462b7e7e20a3a49a6cfacd0d2daee5650ab48
6
+ metadata.gz: cded163a45f1bb8b55944e6522abf7c375c75d6cde908aee2b8ba0ac63ce88f407f1d59cf7caa8e2b4ff4a51e71065a85b82492c72f9737394a3cf13a69754e9
7
+ data.tar.gz: 04b49a8d6df085f9f8ecfd6a567613bf17572bac2122d9f9fb4a9754cd44f5b7342e4f7573f22124ab10c820cff5cee1ce93a3735288cf58767cd6bccd7381fc
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-forge (0.1.0)
4
+ omniauth-forge (0.1.1)
5
5
  omniauth
6
6
  omniauth-oauth2
7
7
  omniauth-rails_csrf_protection (~> 0.1)
data/README.md CHANGED
@@ -35,6 +35,27 @@ bundle audit check --ignore CVE-2015-9284
35
35
 
36
36
  ## Usage
37
37
 
38
+ This is a provider for [omniauth](https://github.com/omniauth/omniauth) based on oauth2 [3-legged forge authentication](https://forge.autodesk.com/en/docs/oauth/v2/tutorials/get-3-legged-token/). Basic usage is:
39
+
40
+ ```ruby
41
+ provider(
42
+ :forge,
43
+ 'FORGE_CLIENT_ID',
44
+ 'FORGE_CLIENT_SECRET',
45
+ {
46
+ callback_path: '/forge/callback' # default
47
+ }
48
+ )
49
+ ```
50
+
51
+ ### Configuration options
52
+
53
+ - **callback_path**: This is the path used for the callback from forge. Default will be '/forge/callback' but you can set it to anything defined on the forge side.
54
+
55
+ ### Examples
56
+
57
+ - [Basic Sinatra](./examples/sinatra.rb)
58
+
38
59
  TODO: Write usage instructions here
39
60
 
40
61
  ## Development
@@ -14,7 +14,6 @@ use OmniAuth::Builder do
14
14
  ENV['FORGE_CLIENT_SECRET'],
15
15
  {
16
16
  client_options: { site: ENV['FORGE_API_BASE_URL'] },
17
- root_uri: ENV['ROOT_URI'],
18
17
  }
19
18
  end
20
19
 
@@ -15,7 +15,6 @@ module OmniAuth
15
15
  )
16
16
 
17
17
  option :callback_path, '/forge/callback'
18
- option :root_uri, 'https://localhost'
19
18
 
20
19
  uid do
21
20
  raw_info['userId']
@@ -36,19 +35,13 @@ module OmniAuth
36
35
  }
37
36
  end
38
37
 
39
- def raw_info
40
- @raw_info ||= access_token.get('/userprofile/v1/users/@me').parsed
38
+ # Forge is expecting a callback_url without parameters
39
+ def callback_url
40
+ super.gsub(/\?.*$/, '')
41
41
  end
42
42
 
43
- def initialize(app, *args, &block)
44
- super
45
- if @options&.[](:client_options)&.[](:redirect_uri) &&
46
- @options[:client_options][:redirect_uri] != self.class.default_options[:client_options][:redirect_uri]
47
- return
48
- end
49
-
50
- @options[:client_options][:redirect_uri] =
51
- "#{@options[:root_uri].to_s.gsub(%r{/+$}, '')}/#{options[:callback_path].to_s.gsub(%r{^/+}, '')}"
43
+ def raw_info
44
+ @raw_info ||= access_token.get('/userprofile/v1/users/@me').parsed
52
45
  end
53
46
  end
54
47
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Forge
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-forge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis <Zaratan> Pasin