omniauth-mvc 1.0.0 → 1.0.1
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 +4 -4
- data/.gitignore +3 -0
- data/README.md +18 -2
- data/example/.env.example +4 -0
- data/example/Gemfile +10 -0
- data/example/Gemfile.lock +55 -0
- data/example/config.ru +5 -0
- data/example/omniauth_app.rb +66 -0
- data/lib/omniauth-mvc/version.rb +1 -1
- data/lib/omniauth/strategies/mvc.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6de7af9bc47f15112b326814d5a1f40ff89337e5
|
4
|
+
data.tar.gz: 860484508e0454ed079b7938cece477f5559d1df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24a1a24f0f13c88fa8efb90c73f8d8014c82020dfa7edb84137ee1d03e93a905309e6aaca252af304cdf9291e03cd0b40ff5ef7df180da7250bf15a4e62649c9
|
7
|
+
data.tar.gz: 7a4654ac6d8fdb3adbbe4494c70fe2c59d8d7527e3ec3c71feb37060ef5c7ccb9c774b8d6015de4ba26ab8adbf01f7b889149779e1115cec27c3dade9f15fc03
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -22,7 +22,23 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
OmniAuth::Strategies::MVC is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.
|
26
|
+
|
27
|
+
Here's a quick example, adding the middleware to a Rails app in config/initializers/omniauth.rb:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
31
|
+
provider :mvc, ENV['MVC_KEY'], ENV['MVC_SECRET']
|
32
|
+
end
|
33
|
+
```
|
34
|
+
|
35
|
+
[See the example Sinatra app for full examples](https://github.com/yasu/omniauth-mvc/blob/master/example/config.ru) of both the server and client-side flows.
|
36
|
+
|
37
|
+
Go to the example directory and execute the following command:
|
38
|
+
|
39
|
+
```
|
40
|
+
$ rackup -p 4567
|
41
|
+
```
|
26
42
|
|
27
43
|
## Development
|
28
44
|
|
@@ -32,7 +48,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
48
|
|
33
49
|
## Contributing
|
34
50
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
51
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/yasu/omniauth-mvc.
|
36
52
|
|
37
53
|
|
38
54
|
## License
|
data/example/Gemfile
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
daemons (1.2.3)
|
5
|
+
eventmachine (1.2.0.1)
|
6
|
+
faraday (0.9.2)
|
7
|
+
multipart-post (>= 1.2, < 3)
|
8
|
+
hashie (3.4.4)
|
9
|
+
json (1.8.3)
|
10
|
+
jwt (1.5.1)
|
11
|
+
multi_json (1.12.1)
|
12
|
+
multi_xml (0.5.5)
|
13
|
+
multipart-post (2.0.0)
|
14
|
+
oauth2 (1.1.0)
|
15
|
+
faraday (>= 0.8, < 0.10)
|
16
|
+
jwt (~> 1.0, < 1.5.2)
|
17
|
+
multi_json (~> 1.3)
|
18
|
+
multi_xml (~> 0.5)
|
19
|
+
rack (>= 1.2, < 3)
|
20
|
+
omniauth (1.3.1)
|
21
|
+
hashie (>= 1.2, < 4)
|
22
|
+
rack (>= 1.0, < 3)
|
23
|
+
omniauth-mvc (1.0.0)
|
24
|
+
omniauth (~> 1.2)
|
25
|
+
omniauth-oauth2 (~> 1.4)
|
26
|
+
omniauth-oauth2 (1.4.0)
|
27
|
+
oauth2 (~> 1.0)
|
28
|
+
omniauth (~> 1.2)
|
29
|
+
rack (1.6.4)
|
30
|
+
rack-protection (1.5.3)
|
31
|
+
rack
|
32
|
+
shotgun (0.9.1)
|
33
|
+
rack (>= 1.0)
|
34
|
+
sinatra (1.4.7)
|
35
|
+
rack (~> 1.5)
|
36
|
+
rack-protection (~> 1.4)
|
37
|
+
tilt (>= 1.3, < 3)
|
38
|
+
thin (1.7.0)
|
39
|
+
daemons (~> 1.0, >= 1.0.9)
|
40
|
+
eventmachine (~> 1.0, >= 1.0.4)
|
41
|
+
rack (>= 1, < 3)
|
42
|
+
tilt (2.0.5)
|
43
|
+
|
44
|
+
PLATFORMS
|
45
|
+
ruby
|
46
|
+
|
47
|
+
DEPENDENCIES
|
48
|
+
json
|
49
|
+
omniauth-mvc
|
50
|
+
shotgun
|
51
|
+
sinatra
|
52
|
+
thin
|
53
|
+
|
54
|
+
BUNDLED WITH
|
55
|
+
1.10.5
|
data/example/config.ru
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'sinatra'
|
3
|
+
require 'json'
|
4
|
+
require 'omniauth'
|
5
|
+
require 'omniauth-mvc'
|
6
|
+
|
7
|
+
class SinatraApp < Sinatra::Base
|
8
|
+
configure do
|
9
|
+
set :sessions, true
|
10
|
+
set :inline_templates, true
|
11
|
+
end
|
12
|
+
use OmniAuth::Builder do
|
13
|
+
provider :mvc, ENV['APP_ID'], ENV['APP_SECRET'],
|
14
|
+
display: 'popup',
|
15
|
+
callback_url: ENV['CALLBACK_URL']
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
get '/' do
|
20
|
+
erb "
|
21
|
+
<a href='#{ENV['AUTH_URL']}'>Login with MVC</a>"
|
22
|
+
end
|
23
|
+
|
24
|
+
get '/auth/:provider/callback' do
|
25
|
+
erb "<h1>#{params[:provider]}</h1>
|
26
|
+
<pre>#{JSON.pretty_generate(request.env['omniauth.auth'])}</pre>"
|
27
|
+
end
|
28
|
+
|
29
|
+
get '/auth/failure' do
|
30
|
+
erb "<h1>Authentication Failed:</h1><h3>message:<h3> <pre>#{params}</pre>"
|
31
|
+
end
|
32
|
+
|
33
|
+
get '/auth/:provider/deauthorized' do
|
34
|
+
erb "#{params[:provider]} has deauthorized this app."
|
35
|
+
end
|
36
|
+
|
37
|
+
get '/protected' do
|
38
|
+
throw(:halt, [401, "Not authorized\n"]) unless session[:authenticated]
|
39
|
+
erb "<pre>#{request.env['omniauth.auth'].to_json}</pre><hr>
|
40
|
+
<a href='/logout'>Logout</a>"
|
41
|
+
end
|
42
|
+
|
43
|
+
get '/logout' do
|
44
|
+
session[:authenticated] = false
|
45
|
+
redirect '/'
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
SinatraApp.run! if __FILE__ == $0
|
51
|
+
|
52
|
+
__END__
|
53
|
+
|
54
|
+
@@ layout
|
55
|
+
<html>
|
56
|
+
<head>
|
57
|
+
<link href='http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css' rel='stylesheet' />
|
58
|
+
</head>
|
59
|
+
<body>
|
60
|
+
<div class='container'>
|
61
|
+
<div class='content'>
|
62
|
+
<%= yield %>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
data/lib/omniauth-mvc/version.rb
CHANGED
@@ -22,7 +22,7 @@ module OmniAuth
|
|
22
22
|
:email => raw_info['email'],
|
23
23
|
:location => raw_info['location'],
|
24
24
|
:profile_image_url => raw_info['profile_image_url'],
|
25
|
-
:
|
25
|
+
:current_user_url => raw_info['current_user_url']
|
26
26
|
}
|
27
27
|
end
|
28
28
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
-
require 'omniauth
|
2
|
+
require 'omniauth-mvc'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-mvc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yasuhiro Manai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -98,6 +98,11 @@ files:
|
|
98
98
|
- Rakefile
|
99
99
|
- bin/console
|
100
100
|
- bin/setup
|
101
|
+
- example/.env.example
|
102
|
+
- example/Gemfile
|
103
|
+
- example/Gemfile.lock
|
104
|
+
- example/config.ru
|
105
|
+
- example/omniauth_app.rb
|
101
106
|
- lib/omniauth-mvc.rb
|
102
107
|
- lib/omniauth-mvc/version.rb
|
103
108
|
- lib/omniauth/strategies/mvc.rb
|
@@ -124,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
129
|
version: '0'
|
125
130
|
requirements: []
|
126
131
|
rubyforge_project:
|
127
|
-
rubygems_version: 2.4.
|
132
|
+
rubygems_version: 2.4.7
|
128
133
|
signing_key:
|
129
134
|
specification_version: 4
|
130
135
|
summary: MVC-online OAuth2 Strategy for OmniAuth
|