omniauth-cloudsdale 0.0.1.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.rspec +1 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +69 -0
- data/README.md +79 -0
- data/Rakefile +6 -0
- data/lib/omniauth/strategies/cloudsdale.rb +28 -0
- data/lib/omniauth-cloudsdale/version.rb +5 -0
- data/lib/omniauth-cloudsdale.rb +2 -0
- data/omniauth-cloudsdale.gemspec +24 -0
- data/spec/omniauth/strategies/cloudsdale_spec.rb +22 -0
- data/spec/spec_helper.rb +16 -0
- metadata +155 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color --tty
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
omniauth-cloudsdale (0.0.1)
|
5
|
+
omniauth (~> 1.0)
|
6
|
+
omniauth-oauth2 (~> 1.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.3.4)
|
12
|
+
coderay (1.0.9)
|
13
|
+
crack (0.3.2)
|
14
|
+
diff-lcs (1.2.4)
|
15
|
+
faraday (0.8.7)
|
16
|
+
multipart-post (~> 1.1)
|
17
|
+
hashie (2.0.5)
|
18
|
+
httpauth (0.2.0)
|
19
|
+
jwt (0.1.8)
|
20
|
+
multi_json (>= 1.5)
|
21
|
+
method_source (0.8.1)
|
22
|
+
multi_json (1.7.3)
|
23
|
+
multipart-post (1.2.0)
|
24
|
+
oauth2 (0.8.1)
|
25
|
+
faraday (~> 0.8)
|
26
|
+
httpauth (~> 0.1)
|
27
|
+
jwt (~> 0.1.4)
|
28
|
+
multi_json (~> 1.0)
|
29
|
+
rack (~> 1.2)
|
30
|
+
omniauth (1.1.4)
|
31
|
+
hashie (>= 1.2, < 3)
|
32
|
+
rack
|
33
|
+
omniauth-oauth2 (1.1.1)
|
34
|
+
oauth2 (~> 0.8.0)
|
35
|
+
omniauth (~> 1.0)
|
36
|
+
pry (0.9.12.2)
|
37
|
+
coderay (~> 1.0.5)
|
38
|
+
method_source (~> 0.8)
|
39
|
+
slop (~> 3.4)
|
40
|
+
rack (1.5.2)
|
41
|
+
rack-test (0.6.2)
|
42
|
+
rack (>= 1.0)
|
43
|
+
rspec (2.13.0)
|
44
|
+
rspec-core (~> 2.13.0)
|
45
|
+
rspec-expectations (~> 2.13.0)
|
46
|
+
rspec-mocks (~> 2.13.0)
|
47
|
+
rspec-core (2.13.1)
|
48
|
+
rspec-expectations (2.13.0)
|
49
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
50
|
+
rspec-mocks (2.13.1)
|
51
|
+
simplecov (0.7.1)
|
52
|
+
multi_json (~> 1.0)
|
53
|
+
simplecov-html (~> 0.7.1)
|
54
|
+
simplecov-html (0.7.1)
|
55
|
+
slop (3.4.5)
|
56
|
+
webmock (1.11.0)
|
57
|
+
addressable (>= 2.2.7)
|
58
|
+
crack (>= 0.3.2)
|
59
|
+
|
60
|
+
PLATFORMS
|
61
|
+
ruby
|
62
|
+
|
63
|
+
DEPENDENCIES
|
64
|
+
omniauth-cloudsdale!
|
65
|
+
pry
|
66
|
+
rack-test
|
67
|
+
rspec (~> 2.7)
|
68
|
+
simplecov
|
69
|
+
webmock
|
data/README.md
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
# OmniAuth Cloudsdale
|
2
|
+
|
3
|
+
Official OmniAuth 1.0 strategy for Cloudsdale.
|
4
|
+
|
5
|
+
## Installing
|
6
|
+
|
7
|
+
Add to your `Gemfile`:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'omniauth-cloudsdale', '~> 0.0.1'
|
11
|
+
```
|
12
|
+
|
13
|
+
Then `bundle install`.
|
14
|
+
|
15
|
+
## Basic Usage
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
|
19
|
+
use OmniAuth::Builder do
|
20
|
+
provider :cloudsdale, ENV['CLOUDSDALE_APP_ID'], ENV['CLOUDSDALE_APP_SECRET']
|
21
|
+
end
|
22
|
+
|
23
|
+
```
|
24
|
+
|
25
|
+
## Cloudsdale Docs
|
26
|
+
|
27
|
+
If you want to learn further about the Cloudsdale service,
|
28
|
+
register an application or read the developer documentation.
|
29
|
+
Visit the developer portal.
|
30
|
+
|
31
|
+
[Cloudsdale Developer Portal](http://dev.cloudsdale.org/).
|
32
|
+
|
33
|
+
## Auth Hash
|
34
|
+
|
35
|
+
Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
{
|
39
|
+
"provider" => "cloudsdale",
|
40
|
+
"uid" => "abcdef1234",
|
41
|
+
"info" => {
|
42
|
+
"nickname" => "My Display Name",
|
43
|
+
"image" => "http://avatar.cloudsdale.org/user/:uid.png?s=128"
|
44
|
+
},
|
45
|
+
"credentials" => {
|
46
|
+
"token" => "abcd1234",
|
47
|
+
"expires" => false
|
48
|
+
},
|
49
|
+
"extra" => {
|
50
|
+
"raw_info" => {
|
51
|
+
"username" => "my_username",
|
52
|
+
"display_name" => "My Display Name"
|
53
|
+
"avatar" => "http://avatar.cloudsdale.org/user/:uid.png?s=128"
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
```
|
58
|
+
|
59
|
+
## License
|
60
|
+
|
61
|
+
Copyright (c) 2013 by Philip Vieira
|
62
|
+
|
63
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
64
|
+
copy of this software and associated documentation files (the "Software"),
|
65
|
+
to deal in the Software without restriction, including without limitation
|
66
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
67
|
+
and/or sell copies of the Software, and to permit persons to whom the
|
68
|
+
Software is furnished to do so, subject to the following conditions:
|
69
|
+
|
70
|
+
The above copyright notice and this permission notice shall be included
|
71
|
+
in all copies or substantial portions of the Software.
|
72
|
+
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
74
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
75
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
76
|
+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
77
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
78
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
79
|
+
DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Cloudsdale < OmniAuth::Strategies::OAuth2
|
6
|
+
|
7
|
+
option :name, :cloudsdale
|
8
|
+
|
9
|
+
option :client_options, {
|
10
|
+
:site => "https://www.cloudsdale.org/",
|
11
|
+
:authorize_url => "https://www.cloudsdale.org/oauth/authorize",
|
12
|
+
:token_url => "https://www.cloudsdale.org/oauth/token"
|
13
|
+
}
|
14
|
+
|
15
|
+
uid { raw_info["id"] }
|
16
|
+
|
17
|
+
info do
|
18
|
+
{
|
19
|
+
:email => raw_info["email"]
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def raw_info
|
24
|
+
@raw_info ||= access_token.get("https://api.cloudsdale.org/v1/me.json").parsed
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth-cloudsdale/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Philip Vieira"]
|
6
|
+
gem.email = ["philip@vallin.se"]
|
7
|
+
gem.description = %q{OmniAuth strategy for Cloudsdale.}
|
8
|
+
gem.summary = %q{OmniAuth strategy for Cloudsdale.}
|
9
|
+
gem.homepage = "https://github.com/IOMUSE/omniauth-cloudsdale"
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "omniauth-cloudsdale"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = OmniAuth::Cloudsdale::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency 'omniauth', '~> 1.0'
|
19
|
+
gem.add_dependency 'omniauth-oauth2', '~> 1.1'
|
20
|
+
gem.add_development_dependency 'rspec', '~> 2.7'
|
21
|
+
gem.add_development_dependency 'rack-test'
|
22
|
+
gem.add_development_dependency 'simplecov'
|
23
|
+
gem.add_development_dependency 'webmock'
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe OmniAuth::Strategies::Cloudsdale do
|
4
|
+
|
5
|
+
subject do
|
6
|
+
OmniAuth::Strategies::Cloudsdale.new({})
|
7
|
+
end
|
8
|
+
|
9
|
+
context "client options" do
|
10
|
+
it 'should have correct site' do
|
11
|
+
subject.options.client_options.site.should eq("https://www.cloudsdale.org/")
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should have correct authorize url' do
|
15
|
+
subject.options.client_options.authorize_url.should eq('https://www.cloudsdale.org/oauth/authorize')
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should have correct token url' do
|
19
|
+
subject.options.client_options.token_url.should eq('https://www.cloudsdale.org/oauth/token')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
$:.unshift File.expand_path('..', __FILE__)
|
2
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start
|
5
|
+
require 'rspec'
|
6
|
+
require 'rack/test'
|
7
|
+
require 'webmock/rspec'
|
8
|
+
require 'omniauth'
|
9
|
+
require 'omniauth-cloudsdale'
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.include WebMock::API
|
13
|
+
config.include Rack::Test::Methods
|
14
|
+
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
|
15
|
+
end
|
16
|
+
|
metadata
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-cloudsdale
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.rc1
|
5
|
+
prerelease: 6
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Philip Vieira
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-20 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: omniauth-oauth2
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.1'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.1'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '2.7'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.7'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rack-test
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: simplecov
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: webmock
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
description: OmniAuth strategy for Cloudsdale.
|
111
|
+
email:
|
112
|
+
- philip@vallin.se
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files: []
|
116
|
+
files:
|
117
|
+
- .gitignore
|
118
|
+
- .rspec
|
119
|
+
- Gemfile
|
120
|
+
- Gemfile.lock
|
121
|
+
- README.md
|
122
|
+
- Rakefile
|
123
|
+
- lib/omniauth-cloudsdale.rb
|
124
|
+
- lib/omniauth-cloudsdale/version.rb
|
125
|
+
- lib/omniauth/strategies/cloudsdale.rb
|
126
|
+
- omniauth-cloudsdale.gemspec
|
127
|
+
- spec/omniauth/strategies/cloudsdale_spec.rb
|
128
|
+
- spec/spec_helper.rb
|
129
|
+
homepage: https://github.com/IOMUSE/omniauth-cloudsdale
|
130
|
+
licenses: []
|
131
|
+
post_install_message:
|
132
|
+
rdoc_options: []
|
133
|
+
require_paths:
|
134
|
+
- lib
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
+
none: false
|
137
|
+
requirements:
|
138
|
+
- - ! '>='
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
|
+
none: false
|
143
|
+
requirements:
|
144
|
+
- - ! '>'
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: 1.3.1
|
147
|
+
requirements: []
|
148
|
+
rubyforge_project:
|
149
|
+
rubygems_version: 1.8.25
|
150
|
+
signing_key:
|
151
|
+
specification_version: 3
|
152
|
+
summary: OmniAuth strategy for Cloudsdale.
|
153
|
+
test_files:
|
154
|
+
- spec/omniauth/strategies/cloudsdale_spec.rb
|
155
|
+
- spec/spec_helper.rb
|