omniauth-nexaas_id 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 378798aa8225024b3e030184e6885791d83be5012a323be13a3fa9f945fadc8a
4
- data.tar.gz: dec1238d5fb2c829c1818b693f2bd1d8069a8bdb4e7ea0d4e66d8a015d35077b
3
+ metadata.gz: 62eaf951e9a142d18dedc6f13c15e2f12cfe68ca4609803f26cc42d7796daa41
4
+ data.tar.gz: a6b474fa037675bfcce2e6b3e41a35345a4ea9c5fc3125058feeafe85896e028
5
5
  SHA512:
6
- metadata.gz: 907b0d598fb91283eb25f03ccfd0f9e81561e6b509bda3ffb8e158c9ed3ac9f2629438ce6fae820f2284af6be2d9ced92fdf022159844163c122655311f3a46f
7
- data.tar.gz: 3dbd48a71570b4765ae99173060724099ee9cc2e0900e57186f93065ed6cd4f890a8bcb66b5b749784200f238d86522582530acbeadbabe9788c0e208e5dc61a
6
+ metadata.gz: 94c37f7e5b105f18aa3464564b162a24921079cc389fcef085ab8361d2d462e9b8e3b6f53789fd02e0c009bbc1d1b80d1601e00d41068f2801c4095daf7a3778
7
+ data.tar.gz: 86a362594de93c6cf43e25ec257026ec01fdfc9e1a9fd147694ed406494a25d37424c49f3d92f09a9939b39f1bbf71ce4202681e19f2ef79644b50943f9822e7
data/README.md CHANGED
@@ -2,54 +2,19 @@
2
2
 
3
3
  Nexaas ID OAuth2 Strategy for OmniAuth.
4
4
 
5
- ## Installation
5
+ ## Documentation
6
6
 
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'omniauth-nexaas_id'
11
- ```
12
-
13
- And then execute:
14
-
15
- $ bundle
16
-
17
- Or install it yourself as:
18
-
19
- $ gem install omniauth-nexaas_id
20
-
21
- ## Usage
22
-
23
- `OmniAuth::Strategies::NexaasID` is simply a Rack middleware. Read the OmniAuth docs for detailed information: https://github.com/omniauth/omniauth.
24
-
25
- Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
26
-
27
- ```ruby
28
- Rails.application.config.middleware.use OmniAuth::Builder do
29
- provider :nexaas_id, ENV['NEXAAS_ID_TOKEN'], ENV['NEXAAS_ID_SECRET']
30
- end
31
- ```
32
-
33
- You can optionally specify the URL as an option (useful in case you want to point to Nexaas ID's staging environment):
34
-
35
- ```ruby
36
- Rails.application.config.middleware.use OmniAuth::Builder do
37
- provider :nexaas_id, ENV['NEXAAS_ID_TOKEN'], ENV['NEXAAS_ID_SECRET'], client_options: { site: ENV['NEXAAS_ID_URL'] }
38
- end
39
- ```
40
-
41
- ## Development
42
-
43
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
44
-
45
- To install this gem onto your local machine, run `bundle exec rake install`. 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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
46
-
47
- ## Contributing
48
-
49
- Bug reports and pull requests are welcome on GitHub at https://github.com/myfreecomm/omniauth-nexaas_id.
7
+ You can get documentation from:
50
8
 
9
+ - [Installation](https://github.com/myfreecomm/omniauth-nexaas_id/wiki)
10
+ - [Development & Contributing](https://github.com/myfreecomm/omniauth-nexaas_id/wiki/Development-&-Contributing)
11
+ - [Usage](https://github.com/myfreecomm/omniauth-nexaas_id/wiki/Usage)
12
+ - [Example resource explained](https://github.com/myfreecomm/omniauth-nexaas_id/wiki/Returned-resource)
51
13
 
52
14
  ## License
53
15
 
54
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
16
+ This gem is available as open source under the terms of the
17
+ [MIT License](http://opensource.org/licenses/MIT).
55
18
 
19
+ License text is
20
+ [here](https://github.com/myfreecomm/omniauth-nexaas_id/wiki/License).
@@ -5,10 +5,15 @@ OmniAuth.config.add_camelization('nexaas_id', 'NexaasID')
5
5
  module OmniAuth
6
6
  module Strategies
7
7
  class NexaasID < OmniAuth::Strategies::OAuth2
8
- DEFAULT_SCOPE = 'profile invite'
8
+ DEFAULT_SCOPE = 'profile invite'.freeze
9
+
10
+ def initialize(*args)
11
+ @api_token = nil
12
+ super
13
+ end
9
14
 
10
15
  option :name, :nexaas_id
11
- option :client_options, { site: 'https://id.nexaas.com' }
16
+ option :client_options, site: 'https://id.nexaas.com'
12
17
 
13
18
  uid do
14
19
  raw_info['id']
@@ -29,7 +34,8 @@ module OmniAuth
29
34
 
30
35
  extra do
31
36
  {
32
- 'raw_info' => raw_info
37
+ raw_info: raw_info,
38
+ legacy: { api_token: @api_token }
33
39
  }
34
40
  end
35
41
 
@@ -56,6 +62,15 @@ module OmniAuth
56
62
  options[:authorize_params][:scopes] = options['scope'] || DEFAULT_SCOPE
57
63
  super
58
64
  end
65
+
66
+ protected
67
+
68
+ def build_access_token
69
+ if (token = super) && token.params
70
+ @api_token = token.params['api_token']
71
+ end
72
+ token
73
+ end
59
74
  end
60
75
  end
61
76
  end
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "omniauth-nexaas_id"
7
- spec.version = "0.1.1"
7
+ spec.version = "0.1.2"
8
8
  spec.authors = ["Rodrigo Tassinari de Oliveira", "Luiz Carlos Buiatte"]
9
9
  spec.email = ["rodrigo@pittlandia.net", "luiz.buiatte@nexaas.com"]
10
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-nexaas_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Tassinari de Oliveira
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-10-03 00:00:00.000000000 Z
12
+ date: 2018-10-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth-oauth2