omniauth-goodsie 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +5 -0
- data/.rvmrc +1 -0
- data/Gemfile +3 -0
- data/README.md +65 -0
- data/Rakefile +6 -0
- data/lib/omniauth-goodsie.rb +2 -0
- data/lib/omniauth-goodsie/version.rb +5 -0
- data/lib/omniauth/strategies/goodsie.rb +30 -0
- data/omniauth-goodsie.gemspec +25 -0
- data/spec/omniauth/strategies/goodsie_spec.rb +5 -0
- data/spec/spec_helper.rb +13 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
M2E0YTljODE0YmNjZDNmZTcwNGRlNDMyODYzMzNiMmIyNjc4Nzg1Ng==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
M2VlODVhOGU4Mzk3ODNkZDU4YzViMzY1NGRjMzlmNGQzOTE1NmE1YQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YzBiMmY3Y2ZlMGRlYjI1MTAzZjQ4NGYwMDcyN2FhNzcyZmQ0ZjNjY2RmNjBk
|
10
|
+
ZmI2MmZhMjdhZjdjMzdmZTQ4OGZhZWM1YTZmOTljZjhkMWZkM2Q5OTdjMTdj
|
11
|
+
MzVjM2U3ZDVjYmUzMTUyNDU5NmFjMjFlN2ExNTMwODlmZDZhMzc=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OTdkNmZhZTJjNjAzMTU4YTkyYmFkMzhiYzBlNTRiMGEyMGViNTBiNjBhM2Iy
|
14
|
+
NDgyNGYyMDI3OGJlN2EwZjc1ZGZmZTc3OGIyZjIwMDdiMjVhMjk4N2ZmYjEz
|
15
|
+
MDk1YWZjZGJiZDI1NDNjNzU2ZDkzYWQ5ZWU5ODM1OGYxOTI0ZDU=
|
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm ruby-1.9.3-p362@omniauth-goodsie --create
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# OmniAuth Goodsie
|
2
|
+
|
3
|
+
Goodsie OAuth2 Strategy for OmniAuth 1.0.
|
4
|
+
|
5
|
+
## Installing
|
6
|
+
|
7
|
+
Add to your `Gemfile`:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'omniauth-goodsie'
|
11
|
+
```
|
12
|
+
|
13
|
+
Then `bundle install`.
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
`OmniAuth::Strategies::Goodsie` is simply a Rack middleware. Read the OmniAuth 1.0 docs for detailed instructions: https://github.com/intridea/omniauth.
|
18
|
+
|
19
|
+
Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
23
|
+
provider :goodsie, ENV['GOODSIE_API_KEY'], ENV['GOODSIE_SHARED_SECRET'],
|
24
|
+
:callback_url => 'http://yourapp.com/auth/goodsie/callback'
|
25
|
+
end
|
26
|
+
```
|
27
|
+
|
28
|
+
## Configuring
|
29
|
+
|
30
|
+
You can configure the scope, which you pass in to the `provider` method via a `Hash`:
|
31
|
+
|
32
|
+
* `scope`: A list of permissions you want to request from the user. See the Goodsie API docs for a full list of available permissions: http://goodsie.com/developer/docs/api/authentication#scopes.
|
33
|
+
|
34
|
+
For example, to request `storefront`, `cart` and `admin` permissions and display the authentication page:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
38
|
+
provider :goodsie, ENV['GOODSIE_API_KEY'], ENV['GOODSIE_SHARED_SECRET'],
|
39
|
+
:scope => 'admin',
|
40
|
+
:callback_url => 'http://yourapp.com/auth/goodsie/callback'
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
## Authentication Hash
|
45
|
+
|
46
|
+
Here's an example *Authentication Hash* available in `request.env['omniauth.auth']`:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
{
|
50
|
+
:provider => 'goodsie',
|
51
|
+
:credentials => {
|
52
|
+
:token => 'afasd923kjh0934kf', # OAuth 2.0 access_token, which you store and use to authenticate API requests
|
53
|
+
}
|
54
|
+
}
|
55
|
+
```
|
56
|
+
|
57
|
+
## License
|
58
|
+
|
59
|
+
Copyright (c) 2013 by Falconer Development, LLC
|
60
|
+
|
61
|
+
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:
|
62
|
+
|
63
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
64
|
+
|
65
|
+
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.
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Goodsie < OmniAuth::Strategies::OAuth2
|
6
|
+
|
7
|
+
DEFAULT_SCOPE = 'storefront'
|
8
|
+
|
9
|
+
option :client_options, {
|
10
|
+
:authorize_url => '/oauth2/authorize',
|
11
|
+
:token_url => '/oauth2/access_token',
|
12
|
+
:site => 'https://api.goodsie.com'
|
13
|
+
}
|
14
|
+
|
15
|
+
option :callback_url
|
16
|
+
|
17
|
+
option :provider_ignores_state, true
|
18
|
+
|
19
|
+
def authorize_params
|
20
|
+
super.tap do |params|
|
21
|
+
params[:scope] ||= DEFAULT_SCOPE
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def callback_url
|
26
|
+
options.callback_url || super
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "omniauth-goodsie/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "omniauth-goodsie"
|
7
|
+
s.version = OmniAuth::Goodsie::VERSION
|
8
|
+
s.authors = ["Karl Falconer"]
|
9
|
+
s.email = ["karl@falconerdevelopment.com"]
|
10
|
+
s.homepage = "https://github.com/dropstream/omniauth-goodsie"
|
11
|
+
s.summary = %q{OmniAuth strategy for Goodsie}
|
12
|
+
s.description = %q{In this gem you will find an OmniAuth Goodsie strategy.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "omniauth-ebay"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_runtime_dependency 'omniauth-oauth2', '~> 1.1.0'
|
22
|
+
|
23
|
+
s.add_development_dependency 'rspec', '~> 2.7.0'
|
24
|
+
s.add_development_dependency 'rake'
|
25
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
Bundler.setup :default, :development, :test
|
4
|
+
|
5
|
+
require 'rack/test'
|
6
|
+
require 'capybara/rspec'
|
7
|
+
require 'capybara/mechanize'
|
8
|
+
require 'omniauth-ebay'
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.include Rack::Test::Methods
|
12
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-goodsie
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Karl Falconer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-08-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omniauth-oauth2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.7.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.7.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: In this gem you will find an OmniAuth Goodsie strategy.
|
56
|
+
email:
|
57
|
+
- karl@falconerdevelopment.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- .rvmrc
|
64
|
+
- Gemfile
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- lib/omniauth-goodsie.rb
|
68
|
+
- lib/omniauth-goodsie/version.rb
|
69
|
+
- lib/omniauth/strategies/goodsie.rb
|
70
|
+
- omniauth-goodsie.gemspec
|
71
|
+
- spec/omniauth/strategies/goodsie_spec.rb
|
72
|
+
- spec/spec_helper.rb
|
73
|
+
homepage: https://github.com/dropstream/omniauth-goodsie
|
74
|
+
licenses: []
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ! '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project: omniauth-ebay
|
92
|
+
rubygems_version: 2.0.6
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: OmniAuth strategy for Goodsie
|
96
|
+
test_files:
|
97
|
+
- spec/omniauth/strategies/goodsie_spec.rb
|
98
|
+
- spec/spec_helper.rb
|