omniauth-nuwe 0.0.1 → 1.0.0

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
  SHA1:
3
- metadata.gz: 3a8715c8bdc1cb19f8d592f72ad42c1bf9ef2d55
4
- data.tar.gz: 377c0b223e155f219a95abb3ea2fa9394fdf5ee5
3
+ metadata.gz: f72bb8fbc1159d34b63fcabff0c5e4ae3884a952
4
+ data.tar.gz: 585bdc7a2c0238b41df4fdfaf1c1c645db6a18f7
5
5
  SHA512:
6
- metadata.gz: ffc69d283d8c82343ddc0b935b2f5c97c1d019591aa77d30da22f8cb2fc85f21e32f65c9c81c7c9e6c31e1b190dafd5f09815f2a42d7ab72aeead2e49c305204
7
- data.tar.gz: f0b62bc10fd1ab306b99c640a7adfb8dc1adf277373173939207562d40f1de7ad9e564c9dcf7958457d36142f75e2cac95fee5f4c17f8578fe44a150544951bb
6
+ metadata.gz: e52dc82b43f7bc9d1c6776f619c8e05d623487ef05e83cb00233af9df37d811236e72ba6fb713ee0351e6e5911e8c1dfd0d8f83b1afd520e4f406bef7ecdf3bb
7
+ data.tar.gz: a0d841ac37d99ea10c0a3cf45087c4d588a80b98a417cc35e8466808e22c4dd8a17f1337579ee4164841fb4da58c903c579ce5e4cc8a24d9f4d00ecb49c02fb8
data/.gitignore CHANGED
@@ -14,3 +14,4 @@
14
14
  mkmf.log
15
15
  .DS_Store
16
16
  *.gem
17
+ *.env
data/README.md CHANGED
@@ -3,32 +3,30 @@
3
3
 
4
4
  # OmniAuth Nuwe
5
5
 
6
- This gem contains the Nuwe strategy for OmniAuth.
6
+ This gem contains the Nuwe OAuth2 Strategy for OmniAuth.
7
7
 
8
8
  ## Installation
9
9
 
10
- Add this line to your application's Gemfile:
10
+ Add to your application's `Gemfile`:
11
11
 
12
12
  ```ruby
13
13
  gem 'omniauth-nuwe'
14
14
  ```
15
15
 
16
- And then execute:
16
+ Then `bundle install`.
17
17
 
18
- $ bundle
19
-
20
- Or install it yourself as:
18
+ ## Usage
21
19
 
22
- $ gem install omniauth-nuwe
20
+ `OmniAuth::Strategies::Nuwe` is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.
23
21
 
24
- ## Usage
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
- TODO: Write usage instructions here
24
+ Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
27
25
 
28
- ## Contributing
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
- 1. Fork it ( https://github.com/[my-github-username]/omniauth-nuwe/fork )
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`.
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'sinatra'
4
+ gem 'omniauth-nuwe'
@@ -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
@@ -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,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Nuwe
3
- VERSION = "0.0.1"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -1,4 +1,4 @@
1
- require 'omniauth-oauth2'
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('/v3/profile.json').body
30
+ @raw_info ||= access_token.get("/v3/profile.json").parsed
33
31
  end
34
32
  end
35
33
  end
@@ -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")
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe "OmniAuth::Strategies::Nuwe" do
4
4
  subject do
5
- OmniAuth::Strategies::Nuwe.new(nil, @options || {})
5
+ OmniAuth::Strategies::Nuwe.new({})
6
6
  end
7
7
 
8
8
  context 'client options' do
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.1
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: {}