omniauth-irm_health 0.0.1.pre.snapshot

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6d4307f925e002ceb1c856afabc2b6cee8d3b2a4
4
+ data.tar.gz: 85deda0ba13a7692cc7bc14f68ac32fab96f446e
5
+ SHA512:
6
+ metadata.gz: 59eb782e30fdc3f9adf0c6b28a782c7e3bdddd776396ee5bfc07f7aa2ef98bdbe97cb53e6c1c3c97616acc742e0c29d4fffb59e4a69ee891796ff2f232f3b504
7
+ data.tar.gz: 669019fa1987c4b476c10c26d49283bae7682c4a3c27ae6c58b969a6d9d1aa9333ecd2a617f046ce4acdc4efcdc7a1474d3a966b60122ed26470a99f823d01ad
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ *.gem
2
+ .bundle
3
+ .rspec
4
+ /Gemfile.lock
5
+ pkg/*
6
+ .powenv
7
+ tmp
8
+ bin
9
+ example/app.log
data/.travis.yml ADDED
@@ -0,0 +1,16 @@
1
+ before_install:
2
+ - gem update bundler
3
+ - bundle --version
4
+ - gem update --system 2.1.11
5
+ - gem --version
6
+ rvm:
7
+ - 1.8.7
8
+ - 1.9.2
9
+ - 1.9.3
10
+ - 2.0.0
11
+ - 2.1
12
+ - jruby
13
+ - rbx
14
+ matrix:
15
+ allow_failures:
16
+ - rvm: rbx
data/CHANGELOG.md ADDED
@@ -0,0 +1,102 @@
1
+ ## 0.1.1 (2014-06-27)
2
+ Changes:
3
+
4
+ - test version gem originated from omniauth-facebook (https://github.com/mkdynamic/omniauth-facebook)
5
+
6
+
7
+ ## 1.6.0 (2014-01-13)
8
+
9
+ Features:
10
+
11
+ - ability to specify `auth_type` per-request (#78, @sebastian-stylesaint)
12
+ - image dimension can be set using `image_size` option (#91, @weilu)
13
+ - update Facebook authorize URL to fix broken authorization (#103, @dlackty)
14
+ - adds `info_fields` option (#109, @bloudermilk)
15
+ - adds `locale` parameter (#133, @donbobka, @simi)
16
+ - add automatically `appsecret_proof` (#140, @nlsrchtr, @simi)
17
+
18
+ Changes:
19
+
20
+ - `NoAuthorizationCodeError` and `UnknownSignatureAlgorithmError` will now `fail!` (#117, @nchelluri)
21
+ - don't try to parse the signature if it's nil (#127, @oriolgual)
22
+
23
+ ## 1.5.1 (2013-11-18)
24
+
25
+ Changes:
26
+
27
+ - don't use `access_token` in URL [CVE-2013-4593](https://github.com/mkdynamic/omniauth-facebook/wiki/Access-token-vulnerability:-CVE-2013-4593) (@homakov, @mkdynamic, @simi)
28
+
29
+ ## 1.5.0 (2013-11-13)
30
+
31
+ Changes:
32
+
33
+ - remove `state` param to fix CSRF vulnerabilty [CVE-2013-4562](https://github.com/mkdynamic/omniauth-facebook/wiki/CSRF-vulnerability:-CVE-2013-4562) (@homakov, @mkdynamic, @simi)
34
+
35
+ ## 1.4.1 (2012-07-07)
36
+
37
+ Changes:
38
+
39
+ - update to omniauth-oauth2 1.1.0 for csrf protection (@mkdynamic)
40
+
41
+ ## 1.4.0 (2012-06-24)
42
+
43
+ Features:
44
+
45
+ - obey `skip_info?` config (@mkdynamic)
46
+ - add support of the `:auth_type` option to `:authorize_options` (#58, @JHeidinga, @mkdynamic)
47
+ - support `access_token` parameter as part of the callback request (#62, @steverandy)
48
+
49
+ ## 1.3.0 (2012-05-05)
50
+
51
+ Features:
52
+
53
+ - dynamic permissions in the auth params (#30, @famoseagle)
54
+ - add support for facebook canvas (@mkdynamic)
55
+ - add verified key to the info hash (#34, @ryansobol)
56
+ - add option to use secure url for image in auth hash (@mkdynamic)
57
+ - add option to specify image size (@mkdynamic)
58
+
59
+ Changes:
60
+
61
+ - have `raw_info` return an empty hash if the Facebook response returns false (#44, @brianjlandau)
62
+ - prevent oauth2 from interpreting Facebook's expires field as `expires_in`, when it's really `expires_at` (#39, @watsonbox)
63
+ - remove deprecated `offline_access` permission (@mkdynamic)
64
+ - tidy up the `callback_url` option (@mkdynamic)
65
+
66
+ ## 1.2.0 (2012-01-06)
67
+
68
+ Features:
69
+
70
+ - add `state` to authorization params (#19, @GermanDZ)
71
+
72
+ Changes:
73
+
74
+ - lock to `rack ~> 1.3.6` (@mkdynamic)
75
+
76
+ ## 1.1.0 (2011-12-10)
77
+
78
+ Features:
79
+
80
+ - add `callback_url` option (#13, @gumayunov)
81
+ - support for parsing code from signed request cookie (client-side flow) (@mkdynamic)
82
+
83
+ ## 1.0.0 (2011-11-19)
84
+
85
+ Features:
86
+
87
+ - allow passing of display via option (@mkdynamic)
88
+
89
+ Bugfixes:
90
+
91
+ - fix `ten_mins_from_now` calculation (#7, @olegkovalenko)
92
+
93
+ ## 1.0.0.rc2 (2011-11-11)
94
+
95
+ Features:
96
+
97
+ - allow passing `display` parameter (@mkdynamic)
98
+ - included default scope (@mkdynamic)
99
+
100
+ ## 1.0.0.rc1 (2011-10-29)
101
+
102
+ - first public gem release (@mkdynamic)
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ platforms :rbx do
6
+ gem 'rubysl', '~> 2.0'
7
+ end
data/README.md ADDED
@@ -0,0 +1,167 @@
1
+ An Omniauth strategy for IRM Healthcare Cloud
2
+
3
+ **CAUTION
4
+ **This is not a release version yet and its source code copied from OmniAuth Facebook. This is not for Omniauth Facebook !!
5
+ **If you were looking for the one, please go to https://github.com/mkdynamic/omniauth-facebook.
6
+ **We do appologize inconvenience.
7
+
8
+
9
+ # OmniAuth IrmHealth  [![Gem Version](https://badge.fury.io/rb/omniauth-irm_health.png)](http://badge.fury.io/rb/omniauth-irm_health)
10
+
11
+
12
+ IrmHealth OAuth2 Strategy for OmniAuth.
13
+
14
+ ## Installing
15
+
16
+ Add to your `Gemfile`:
17
+
18
+ ```ruby
19
+ gem 'omniauth-irm_health'
20
+ ```
21
+
22
+ Then `bundle install`.
23
+
24
+ ## Usage
25
+
26
+ `OmniAuth::Strategies::IrmHealth` is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.
27
+
28
+ Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
29
+
30
+ ```ruby
31
+ Rails.application.config.middleware.use OmniAuth::Builder do
32
+ provider :irm_health, ENV['IRM_KEY'], ENV['IRM_SECRET']
33
+ end
34
+ ```
35
+
36
+ ## Configuring
37
+
38
+ You can configure several options, which you pass in to the `provider` method via a `Hash`:
39
+
40
+ Option name | Default | Explanation
41
+ --- | --- | ---
42
+ `scope` | `email` | A comma-separated list of permissions you want to request from the user. See the Facebook docs for a full list of available permissions: https://developers.facebook.com/docs/reference/login/
43
+ `display` | `page` | The display context to show the authentication page. Options are: `page`, `popup` and `touch`. Read the Facebook docs for more details: https://developers.facebook.com/docs/reference/dialogs/oauth/
44
+ `image_size` | `square` | Set the size for the returned image url in the auth hash. Valid options include `square` (50x50), `small` (50 pixels wide, variable height), `normal` (100 pixels wide, variable height), or `large` (about 200 pixels wide, variable height). Additionally, you can request a picture of a specific size by setting this option to a hash with `:width` and `:height` as keys. This will return an available profile picture closest to the requested size and requested aspect ratio. If only `:width` or `:height` is specified, we will return a picture whose width or height is closest to the requested size, respectively.
45
+ `info_fields` | | Specify exactly which fields should be returned when getting the user's info. Value should be a comma-separated string as per https://developers.facebook.com/docs/graph-api/reference/user/ (only `/me` endpoint).
46
+ `locale` | | Specify locale which should be used when getting the user's info. Value should be locale string as per https://developers.facebook.com/docs/reference/api/locale/.
47
+ `auth_type` | | Optionally specifies the requested authentication features as a comma-separated list, as per https://developers.facebook.com/docs/facebook-login/reauthentication/. Valid values are `https` (checks for the presence of the secure cookie and asks for re-authentication if it is not present), and `reauthenticate` (asks the user to re-authenticate unconditionally). Default is `nil`.
48
+ `secure_image_url` | `false` | Set to `true` to use https for the avatar image url returned in the auth hash.
49
+ `callback_url` / `callback_path` | | Specify a custom callback URL used during the server-side flow. Note this must be allowed by your app configuration on Facebook (see 'Valid OAuth redirect URIs' under the 'Advanced' settings section in the configuration for your Facebook app for more details).
50
+
51
+ For example, to request `email`, `user_birthday` and `read_stream` permissions and display the authentication page in a popup window:
52
+
53
+ ```ruby
54
+ Rails.application.config.middleware.use OmniAuth::Builder do
55
+ provider :irm_health, ENV['IRM_KEY'], ENV['IRM_SECRET'],
56
+ :scope => 'email'
57
+ end
58
+ ```
59
+
60
+ ### Per-Request Options
61
+
62
+ If you want to set the `display` format, `auth_type`, or `scope` on a per-request basis, you can just pass it to the OmniAuth request phase URL, for example: `/auth/facebook?display=popup` or `/auth/facebook?scope=email`.
63
+
64
+ ## Auth Hash
65
+
66
+ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
67
+
68
+ ```ruby
69
+ {
70
+ :provider => 'facebook',
71
+ :uid => '1234567',
72
+ :info => {
73
+ :nickname => 'jbloggs',
74
+ :email => 'joe@bloggs.com',
75
+ :name => 'Joe Bloggs',
76
+ :first_name => 'Joe',
77
+ :last_name => 'Bloggs',
78
+ :image => 'http://graph.facebook.com/1234567/picture?type=square',
79
+ :urls => { :Facebook => 'http://www.facebook.com/jbloggs' },
80
+ :location => 'Palo Alto, California',
81
+ :verified => true
82
+ },
83
+ :credentials => {
84
+ :token => 'ABCDEF...', # OAuth 2.0 access_token, which you may wish to store
85
+ :expires_at => 1321747205, # when the access token expires (it always will)
86
+ :expires => true # this will always be true
87
+ },
88
+ :extra => {
89
+ :raw_info => {
90
+ :id => '1234567',
91
+ :name => 'Joe Bloggs',
92
+ :first_name => 'Joe',
93
+ :last_name => 'Bloggs',
94
+ :link => 'http://www.facebook.com/jbloggs',
95
+ :username => 'jbloggs',
96
+ :location => { :id => '123456789', :name => 'Palo Alto, California' },
97
+ :gender => 'male',
98
+ :email => 'joe@bloggs.com',
99
+ :timezone => -8,
100
+ :locale => 'en_US',
101
+ :verified => true,
102
+ :updated_time => '2011-11-11T06:21:03+0000'
103
+ }
104
+ }
105
+ }
106
+ ```
107
+
108
+ The precise information available may depend on the permissions which you request.
109
+
110
+ ## Client-side Flow with Facebook Javascript SDK
111
+
112
+ You can use the Facebook Javascript SDK with `FB.login`, and just hit the callback endpoint (`/auth/facebook/callback` by default) once the user has authenticated in the success callback.
113
+
114
+ **Note that you must enable cookies in the `FB.init` config for this process to work.**
115
+
116
+ See the example Sinatra app under `example/` and read the [Facebook docs on Login for JavaScript](https://developers.facebook.com/docs/facebook-login/login-flow-for-web/) for more details.
117
+
118
+ ### How it Works
119
+
120
+ The client-side flow is supported by parsing the authorization code from the signed request which Facebook places in a cookie.
121
+
122
+ When you call `/auth/facebook/callback` in the success callback of `FB.login` that will pass the cookie back to the server. omniauth-facebook will see this cookie and:
123
+
124
+ 1. parse it,
125
+ 2. extract the authorization code contained in it
126
+ 3. and hit Facebook and obtain an access token which will get placed in the `request.env['omniauth.auth']['credentials']` hash.
127
+
128
+ ## Token Expiry
129
+
130
+ The expiration time of the access token you obtain will depend on which flow you are using.
131
+
132
+ ### Client-Side Flow
133
+
134
+ If you use the client-side flow, Facebook will give you back a short lived access token (~ 2 hours).
135
+
136
+ You can exchange this short lived access token for a longer lived version. Read the [Facebook docs](https://developers.facebook.com/docs/facebook-login/access-tokens/) for more information on exchanging a short lived token for a long lived token.
137
+
138
+ ### Server-Side Flow
139
+
140
+ If you use the server-side flow, Facebook will give you back a longer lived access token (~ 60 days).
141
+
142
+ ## Supported Rubies
143
+
144
+ Actively tested with the following Ruby versions:
145
+
146
+ - MRI 2.1.0
147
+ - MRI 2.0.0
148
+ - MRI 1.9.3
149
+ - MRI 1.9.2
150
+ - MRI 1.8.7
151
+ - JRuby 1.7.9
152
+ - Rubinius (latest stable)
153
+
154
+ ## License
155
+
156
+ Copyright (c) 2012 by Mark Dodwell
157
+
158
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
159
+
160
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
161
+
162
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
163
+
164
+
165
+ [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/mkdynamic/omniauth-facebook/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
166
+
167
+ =======
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |task|
5
+ task.libs << 'test'
6
+ end
7
+
8
+ task :default => :test
data/example/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'sinatra'
4
+ gem 'sinatra-reloader'
5
+ gem 'omniauth-irm_health', :path => '../'
@@ -0,0 +1,59 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ omniauth-irm_health (0.0.1)
5
+ omniauth-oauth2 (~> 1.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ backports (3.3.5)
11
+ faraday (0.9.0)
12
+ multipart-post (>= 1.2, < 3)
13
+ hashie (2.1.1)
14
+ jwt (0.1.13)
15
+ multi_json (>= 1.5)
16
+ multi_json (1.8.2)
17
+ multi_xml (0.5.5)
18
+ multipart-post (2.0.0)
19
+ oauth2 (0.9.3)
20
+ faraday (>= 0.8, < 0.10)
21
+ jwt (~> 0.1.8)
22
+ multi_json (~> 1.3)
23
+ multi_xml (~> 0.5)
24
+ rack (~> 1.2)
25
+ omniauth (1.2.1)
26
+ hashie (>= 1.2, < 3)
27
+ rack (~> 1.0)
28
+ omniauth-oauth2 (1.1.2)
29
+ faraday (>= 0.8, < 0.10)
30
+ multi_json (~> 1.3)
31
+ oauth2 (~> 0.9.3)
32
+ omniauth (~> 1.2)
33
+ rack (1.5.2)
34
+ rack-protection (1.5.1)
35
+ rack
36
+ rack-test (0.6.2)
37
+ rack (>= 1.0)
38
+ sinatra (1.4.4)
39
+ rack (~> 1.4)
40
+ rack-protection (~> 1.4)
41
+ tilt (~> 1.3, >= 1.3.4)
42
+ sinatra-contrib (1.4.2)
43
+ backports (>= 2.0)
44
+ multi_json
45
+ rack-protection
46
+ rack-test
47
+ sinatra (~> 1.4.0)
48
+ tilt (~> 1.3)
49
+ sinatra-reloader (1.0)
50
+ sinatra-contrib
51
+ tilt (1.4.1)
52
+
53
+ PLATFORMS
54
+ ruby
55
+
56
+ DEPENDENCIES
57
+ omniauth-irm_health!
58
+ sinatra
59
+ sinatra-reloader
data/example/app.rb ADDED
@@ -0,0 +1,93 @@
1
+ require 'sinatra'
2
+ require "sinatra/reloader"
3
+ require 'yaml'
4
+
5
+ # configure sinatra
6
+ set :run, false
7
+ set :raise_errors, true
8
+
9
+ # setup logging to file
10
+ log = File.new("app.log", "a+")
11
+ $stdout.reopen(log)
12
+ $stderr.reopen(log)
13
+ $stderr.sync = true
14
+ $stdout.sync = true
15
+
16
+ # server-side flow
17
+ get '/server-side' do
18
+ # NOTE: You would just hit this endpoint directly from the browser in a real app. The redirect is just here to
19
+ # explicit declare this server-side flow.
20
+ redirect '/auth/facebook'
21
+ end
22
+
23
+ # client-side flow
24
+ get '/client-side' do
25
+ content_type 'text/html'
26
+ # NOTE: When you enable cookie below in the FB.init call the GET request in the FB.login callback will send a signed
27
+ # request in a cookie back the OmniAuth callback which will parse out the authorization code and obtain an
28
+ # access_token with it.
29
+ <<-END
30
+ <html>
31
+ <head>
32
+ <title>Client-side Flow Example</title>
33
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" type="text/javascript"></script>
34
+ </head>
35
+ <body>
36
+ <div id="fb-root"></div>
37
+
38
+ <script type="text/javascript">
39
+ window.fbAsyncInit = function() {
40
+ FB.init({
41
+ appId : '#{ENV['APP_ID']}',
42
+ status : true, // check login status
43
+ cookie : true, // enable cookies to allow the server to access the session
44
+ xfbml : true // parse XFBML
45
+ });
46
+ };
47
+
48
+ (function(d) {
49
+ var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
50
+ js = d.createElement('script'); js.id = id; js.async = true;
51
+ js.src = "//connect.facebook.net/en_US/all.js";
52
+ d.getElementsByTagName('head')[0].appendChild(js);
53
+ }(document));
54
+
55
+ $(function() {
56
+ $('a').click(function(e) {
57
+ e.preventDefault();
58
+
59
+ FB.login(function(response) {
60
+ if (response.authResponse) {
61
+ $('#connect').html('Connected! Hitting OmniAuth callback (GET /auth/facebook/callback)...');
62
+
63
+ // since we have cookies enabled, this request will allow omniauth to parse
64
+ // out the auth code from the signed request in the fbsr_XXX cookie
65
+ $.getJSON('/auth/facebook/callback', function(json) {
66
+ $('#connect').html('Connected! Callback complete.');
67
+ $('#results').html(JSON.stringify(json));
68
+ });
69
+ }
70
+ }, { scope: 'email,read_stream', state: 'abc123' });
71
+ });
72
+ });
73
+ </script>
74
+
75
+ <p id="connect">
76
+ <a href="#">Connect to FB!</a>
77
+ </p>
78
+
79
+ <p id="results" />
80
+ </body>
81
+ </html>
82
+ END
83
+ end
84
+
85
+ get '/auth/:provider/callback' do
86
+ content_type 'application/json'
87
+ MultiJson.encode(request.env)
88
+ end
89
+
90
+ get '/auth/failure' do
91
+ content_type 'application/json'
92
+ MultiJson.encode(request.env)
93
+ end