omniauth-nuwe 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +13 -15
- data/example/Gemfile +4 -0
- data/example/Gemfile.lock +42 -0
- data/example/config.ru +31 -0
- data/lib/omniauth-nuwe/version.rb +1 -1
- data/lib/omniauth/strategies/nuwe.rb +4 -6
- data/omniauth-nuwe.gemspec +1 -1
- data/spec/omniauth/strategies/nuwe_spec.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f72bb8fbc1159d34b63fcabff0c5e4ae3884a952
|
4
|
+
data.tar.gz: 585bdc7a2c0238b41df4fdfaf1c1c645db6a18f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e52dc82b43f7bc9d1c6776f619c8e05d623487ef05e83cb00233af9df37d811236e72ba6fb713ee0351e6e5911e8c1dfd0d8f83b1afd520e4f406bef7ecdf3bb
|
7
|
+
data.tar.gz: a0d841ac37d99ea10c0a3cf45087c4d588a80b98a417cc35e8466808e22c4dd8a17f1337579ee4164841fb4da58c903c579ce5e4cc8a24d9f4d00ecb49c02fb8
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -3,32 +3,30 @@
|
|
3
3
|
|
4
4
|
# OmniAuth Nuwe
|
5
5
|
|
6
|
-
This gem contains the Nuwe
|
6
|
+
This gem contains the Nuwe OAuth2 Strategy for OmniAuth.
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
10
|
-
Add
|
10
|
+
Add to your application's `Gemfile`:
|
11
11
|
|
12
12
|
```ruby
|
13
13
|
gem 'omniauth-nuwe'
|
14
14
|
```
|
15
15
|
|
16
|
-
|
16
|
+
Then `bundle install`.
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
Or install it yourself as:
|
18
|
+
## Usage
|
21
19
|
|
22
|
-
|
20
|
+
`OmniAuth::Strategies::Nuwe` is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.
|
23
21
|
|
24
|
-
|
22
|
+
Nuwe uses the Doorkeeper gem to use NuAPI as an OAuth2 provider. This is necessary to gain access to the V3 endpoints of this API. Developers can sign up for a developer account at https://api.nuapi.co.
|
25
23
|
|
26
|
-
|
24
|
+
Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
|
27
25
|
|
28
|
-
|
26
|
+
```ruby
|
27
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
28
|
+
provider :nuwe, ENV['NUWE_KEY'], ENV['NUWE_SECRET']
|
29
|
+
end
|
30
|
+
```
|
29
31
|
|
30
|
-
|
31
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
32
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
33
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
34
|
-
5. Create a new Pull Request
|
32
|
+
You can now access the OmniAuth Nuwe OAuth2 URL: `/auth/nuwe`.
|
data/example/Gemfile
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
faraday (0.9.1)
|
5
|
+
multipart-post (>= 1.2, < 3)
|
6
|
+
hashie (3.4.1)
|
7
|
+
jwt (1.4.1)
|
8
|
+
multi_json (1.11.0)
|
9
|
+
multi_xml (0.5.5)
|
10
|
+
multipart-post (2.0.0)
|
11
|
+
oauth2 (1.0.0)
|
12
|
+
faraday (>= 0.8, < 0.10)
|
13
|
+
jwt (~> 1.0)
|
14
|
+
multi_json (~> 1.3)
|
15
|
+
multi_xml (~> 0.5)
|
16
|
+
rack (~> 1.2)
|
17
|
+
omniauth (1.2.2)
|
18
|
+
hashie (>= 1.2, < 4)
|
19
|
+
rack (~> 1.0)
|
20
|
+
omniauth-nuwe (0.0.1)
|
21
|
+
omniauth (~> 1.0)
|
22
|
+
omniauth-oauth2 (>= 1.1.1, < 2.0)
|
23
|
+
omniauth-oauth2 (1.2.0)
|
24
|
+
faraday (>= 0.8, < 0.10)
|
25
|
+
multi_json (~> 1.3)
|
26
|
+
oauth2 (~> 1.0)
|
27
|
+
omniauth (~> 1.2)
|
28
|
+
rack (1.6.0)
|
29
|
+
rack-protection (1.5.3)
|
30
|
+
rack
|
31
|
+
sinatra (1.4.6)
|
32
|
+
rack (~> 1.4)
|
33
|
+
rack-protection (~> 1.4)
|
34
|
+
tilt (>= 1.3, < 3)
|
35
|
+
tilt (2.0.1)
|
36
|
+
|
37
|
+
PLATFORMS
|
38
|
+
ruby
|
39
|
+
|
40
|
+
DEPENDENCIES
|
41
|
+
omniauth-nuwe
|
42
|
+
sinatra
|
data/example/config.ru
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Sample app for Nuwe OAuth2 Strategy
|
2
|
+
# Make sure to setup the ENV variables NUWE_KEY and NUWE_SECRET
|
3
|
+
# Run with "bundle exec rackup"
|
4
|
+
|
5
|
+
require 'bundler/setup'
|
6
|
+
require 'sinatra/base'
|
7
|
+
require 'omniauth-nuwe'
|
8
|
+
|
9
|
+
class App < Sinatra::Base
|
10
|
+
get '/' do
|
11
|
+
redirect '/auth/nuwe'
|
12
|
+
end
|
13
|
+
|
14
|
+
get '/auth/:provider/callback' do
|
15
|
+
content_type 'application/json'
|
16
|
+
MultiJson.encode(request.env['omniauth.auth'])
|
17
|
+
end
|
18
|
+
|
19
|
+
get '/auth/failure' do
|
20
|
+
content_type 'application/json'
|
21
|
+
MultiJson.encode(request.env)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
use Rack::Session::Cookie, :secret => 'change_me'
|
26
|
+
|
27
|
+
use OmniAuth::Builder do
|
28
|
+
provider :nuwe, ENV['NUWE_KEY'], ENV['NUWE_SECRET']
|
29
|
+
end
|
30
|
+
|
31
|
+
run App.new
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "omniauth-oauth2"
|
2
2
|
|
3
3
|
module OmniAuth
|
4
4
|
module Strategies
|
@@ -6,15 +6,14 @@ module OmniAuth
|
|
6
6
|
|
7
7
|
option :name, "nuwe"
|
8
8
|
|
9
|
-
# do we need the access_token and request_token paths here as well?
|
10
9
|
option :client_options, {
|
11
10
|
:site => "https://api.nuwe.co",
|
12
|
-
:authorize_url => "https://api.nuapi.co/oauth/authorize"
|
11
|
+
:authorize_url => "https://api.nuapi.co/oauth/authorize",
|
12
|
+
:token_url => "https://api.nuapi.co/oauth/token"
|
13
13
|
}
|
14
14
|
|
15
15
|
uid { raw_info["user"]["id"] }
|
16
16
|
|
17
|
-
# need to decide which user info we want to pass to client initially
|
18
17
|
info do
|
19
18
|
{
|
20
19
|
:last_name => raw_info["profile"]["last_name"],
|
@@ -27,9 +26,8 @@ module OmniAuth
|
|
27
26
|
}
|
28
27
|
end
|
29
28
|
|
30
|
-
# not sure about this. Are getting the raw info from the user's profile?
|
31
29
|
def raw_info
|
32
|
-
@raw_info ||= access_token.get(
|
30
|
+
@raw_info ||= access_token.get("/v3/profile.json").parsed
|
33
31
|
end
|
34
32
|
end
|
35
33
|
end
|
data/omniauth-nuwe.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.email = ["stephanie@spacebabies.nl"]
|
9
9
|
spec.summary = %q{OmniAuth strategy for Nuwe.}
|
10
10
|
spec.description = %q{OmniAuth strategy for Nuwe.}
|
11
|
-
spec.homepage = ""
|
11
|
+
spec.homepage = "https://github.com/nuwehq/omniauth-nuwe/"
|
12
12
|
spec.license = "MIT"
|
13
13
|
|
14
14
|
spec.files = `git ls-files`.split("\n")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-nuwe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephanie Nemeth
|
@@ -98,13 +98,16 @@ files:
|
|
98
98
|
- LICENSE.txt
|
99
99
|
- README.md
|
100
100
|
- Rakefile
|
101
|
+
- example/Gemfile
|
102
|
+
- example/Gemfile.lock
|
103
|
+
- example/config.ru
|
101
104
|
- lib/omniauth-nuwe.rb
|
102
105
|
- lib/omniauth-nuwe/version.rb
|
103
106
|
- lib/omniauth/strategies/nuwe.rb
|
104
107
|
- omniauth-nuwe.gemspec
|
105
108
|
- spec/omniauth/strategies/nuwe_spec.rb
|
106
109
|
- spec/spec_helper.rb
|
107
|
-
homepage:
|
110
|
+
homepage: https://github.com/nuwehq/omniauth-nuwe/
|
108
111
|
licenses:
|
109
112
|
- MIT
|
110
113
|
metadata: {}
|