omniauth-forge 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +21 -0
- data/examples/sinatra.rb +0 -1
- data/lib/omniauth/strategies/forge.rb +5 -12
- data/lib/omniauth_forge/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72f5c084eacd60348693d77e990423a61d335f62aa6fb9a5f2fb5b4d51e10adf
|
4
|
+
data.tar.gz: 74581f47e1a8549fa1c1a34128b22953da6dc3e5b9dd6e7affb2188d49975449
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cded163a45f1bb8b55944e6522abf7c375c75d6cde908aee2b8ba0ac63ce88f407f1d59cf7caa8e2b4ff4a51e71065a85b82492c72f9737394a3cf13a69754e9
|
7
|
+
data.tar.gz: 04b49a8d6df085f9f8ecfd6a567613bf17572bac2122d9f9fb4a9754cd44f5b7342e4f7573f22124ab10c820cff5cee1ce93a3735288cf58767cd6bccd7381fc
|
data/Gemfile.lock
CHANGED
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
|
data/examples/sinatra.rb
CHANGED
@@ -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
|
-
|
40
|
-
|
38
|
+
# Forge is expecting a callback_url without parameters
|
39
|
+
def callback_url
|
40
|
+
super.gsub(/\?.*$/, '')
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
44
|
-
|
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
|