omniauth-nexaas_id 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +55 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/omniauth/strategies/nexaas_id.rb +57 -0
- data/lib/omniauth-nexaas_id.rb +2 -0
- data/omniauth-nexaas_id.gemspec +27 -0
- metadata +128 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f1214f50974ff81f26a03b8c9968be60a9cd0d9c79e485264b57f39e3591757f
|
4
|
+
data.tar.gz: d433fbb1bce097a28c540e955f05f1729905291f2690d4518e44554db43f5de9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 216f8fd3cbd7a925ecea56872aeb02d33a6d624c7c2552e05a3db531f7fce807ca40183ebaa4bcdd51d99b2d12b270c4f21565325f52bcca366c26fa4ee6e332
|
7
|
+
data.tar.gz: e4979e3e6dc7c0f64b32bad12fc62603d2cda4c8eeb3de07d23b9244bfc1ceeedd933a6dfe20f686ebc859beb87da0a508350aa1f7573675030e5add0f6d2444
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Rodrigo Tassinari de Oliveira
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Omniauth::NexaasID
|
2
|
+
|
3
|
+
Nexaas ID OAuth2 Strategy for OmniAuth.
|
4
|
+
|
5
|
+
## Installation
|
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.
|
50
|
+
|
51
|
+
|
52
|
+
## License
|
53
|
+
|
54
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
55
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "omniauth/strategies/nexaas_id"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
OmniAuth.config.add_camelization('nexaas_id', 'NexaasID')
|
4
|
+
|
5
|
+
module OmniAuth
|
6
|
+
module Strategies
|
7
|
+
class NexaasID < OmniAuth::Strategies::OAuth2
|
8
|
+
DEFAULT_SCOPE = 'profile invite'
|
9
|
+
|
10
|
+
option :name, :nexaas_id
|
11
|
+
option :client_options, { site: 'https://id.nexaas.com' }
|
12
|
+
|
13
|
+
uid do
|
14
|
+
raw_info['id']
|
15
|
+
end
|
16
|
+
|
17
|
+
info do
|
18
|
+
{
|
19
|
+
id: raw_info['id'],
|
20
|
+
name: raw_info['name'],
|
21
|
+
email: raw_info['main_email'],
|
22
|
+
picture_url: raw_info['picture']
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
extra do
|
27
|
+
{
|
28
|
+
'raw_info' => raw_info
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Example:
|
33
|
+
#
|
34
|
+
# {
|
35
|
+
# "id"=>"e9fa918b-a90e-49f3-86ec-e3ce92488a3e",
|
36
|
+
# "name"=>"John Doe",
|
37
|
+
# "main_email"=>"john@doe.com",
|
38
|
+
# "emails"=>[{"address"=>"john@doe.com", "confirmed"=>true}],
|
39
|
+
# "created_at"=>"2016-07-21T22:02:17Z",
|
40
|
+
# "updated_at"=>"2016-07-21T22:02:17Z",
|
41
|
+
# "_links"=>{
|
42
|
+
# "self"=>{
|
43
|
+
# "href"=>"https://id.nexaas.com/api/v1/users/e9fa918b-a90e-49f3-86ec-e3ce92488a3e"
|
44
|
+
# }
|
45
|
+
# }
|
46
|
+
# }
|
47
|
+
def raw_info
|
48
|
+
@raw_info ||= access_token.get('/api/v1/profile').parsed
|
49
|
+
end
|
50
|
+
|
51
|
+
def request_phase
|
52
|
+
options[:authorize_params][:scopes] = options['scope'] || DEFAULT_SCOPE
|
53
|
+
super
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "omniauth-nexaas_id"
|
7
|
+
spec.version = "0.1.0"
|
8
|
+
spec.authors = ["Rodrigo Tassinari de Oliveira", "Luiz Carlos Buiatte"]
|
9
|
+
spec.email = ["rodrigo@pittlandia.net", "luiz.buiatte@nexaas.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{Nexaas ID OAuth2 strategy for Omniauth.}
|
12
|
+
spec.description = %q{Nexaas ID OAuth2 strategy for Omniauth.}
|
13
|
+
spec.homepage = "https://github.com/myfreecomm/omniauth-nexaas_id"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "omniauth-oauth2", "~> 1.3"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
24
|
+
spec.add_development_dependency "rake", "~> 11.2"
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.5"
|
26
|
+
spec.add_development_dependency "byebug", "~> 9.0"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-nexaas_id
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rodrigo Tassinari de Oliveira
|
8
|
+
- Luiz Carlos Buiatte
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2018-08-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth-oauth2
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.3'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.3'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: bundler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.12'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.12'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '11.2'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '11.2'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rspec
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '3.5'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '3.5'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: byebug
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '9.0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '9.0'
|
84
|
+
description: Nexaas ID OAuth2 strategy for Omniauth.
|
85
|
+
email:
|
86
|
+
- rodrigo@pittlandia.net
|
87
|
+
- luiz.buiatte@nexaas.com
|
88
|
+
executables: []
|
89
|
+
extensions: []
|
90
|
+
extra_rdoc_files: []
|
91
|
+
files:
|
92
|
+
- ".gitignore"
|
93
|
+
- ".rspec"
|
94
|
+
- ".travis.yml"
|
95
|
+
- Gemfile
|
96
|
+
- LICENSE.txt
|
97
|
+
- README.md
|
98
|
+
- Rakefile
|
99
|
+
- bin/console
|
100
|
+
- bin/setup
|
101
|
+
- lib/omniauth-nexaas_id.rb
|
102
|
+
- lib/omniauth/strategies/nexaas_id.rb
|
103
|
+
- omniauth-nexaas_id.gemspec
|
104
|
+
homepage: https://github.com/myfreecomm/omniauth-nexaas_id
|
105
|
+
licenses:
|
106
|
+
- MIT
|
107
|
+
metadata: {}
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
requirements: []
|
123
|
+
rubyforge_project:
|
124
|
+
rubygems_version: 2.7.6
|
125
|
+
signing_key:
|
126
|
+
specification_version: 4
|
127
|
+
summary: Nexaas ID OAuth2 strategy for Omniauth.
|
128
|
+
test_files: []
|