omniauth-do 1.0.0.alpha
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.
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/Gemfile +12 -0
- data/Guardfile +10 -0
- data/README.md +48 -0
- data/Rakefile +12 -0
- data/lib/omniauth/strategies/do.rb +37 -0
- data/lib/omniauth-do/version.rb +5 -0
- data/lib/omniauth-do.rb +2 -0
- data/omniauth-do.gemspec +24 -0
- data/spec/omniauth/strategies/do.rb +13 -0
- data/spec/spec_helper.rb +16 -0
- metadata +156 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/Gemfile
ADDED
data/Guardfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# OmniAuth Do
|
2
|
+
|
3
|
+
This is an OmniAuth strategy for authenticating to [Do](https://do.com). To
|
4
|
+
use it, you'll need to request an OAuth2 Application ID and Secret
|
5
|
+
by e-mailing dev@do.com.
|
6
|
+
|
7
|
+
## Basic Usage
|
8
|
+
|
9
|
+
use OmniAuth::Builder do
|
10
|
+
provider :do, ENV['DO_KEY'], ENV['DO_SECRET']
|
11
|
+
end
|
12
|
+
|
13
|
+
### User Scopes
|
14
|
+
|
15
|
+
Do lets you set scopes to provide granular access to different portions
|
16
|
+
of a user's data. Note that during the Do API Beta period, all scopes
|
17
|
+
will result in full-access to user data.
|
18
|
+
|
19
|
+
use OmniAuth::Builder do
|
20
|
+
provider :do, ENV['DO_KEY'], ENV['DO_SECRET'], scope: "user.profile"
|
21
|
+
end
|
22
|
+
|
23
|
+
For questions about the forthcoming implementations of scopes, e-mail
|
24
|
+
dev@do.com
|
25
|
+
|
26
|
+
### Provisioning
|
27
|
+
|
28
|
+
In addition to accessing user data, [confidential
|
29
|
+
clients](http://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-2.1)
|
30
|
+
can utilize Do's User and Group Provisioning API's, allowed by the
|
31
|
+
`user.provisioning` and `group.provisioning` scopes respectively.
|
32
|
+
|
33
|
+
### Beta
|
34
|
+
|
35
|
+
The use of the Do API is subject to the terms and conditions found at
|
36
|
+
[do.com/legal](https://do.com/legal). Take care to note Section 8.4:
|
37
|
+
|
38
|
+
> Any Non-GA Services will be clearly designated as beta, pilot, limited release, developer preview, non-production or by a description of similar import. Non-GA Services are provided for evaluation purposes and not for production use, are not supported, may contain bugs or errors, and may be subject to additional terms. NON-GA SERVICES ARE NOT CONSIDERED "SERVICES" HEREUNDER AND ARE PROVIDED "AS IS" WITH NO EXPRESS OR IMPLIED WARRANTY. We may discontinue Non-GA Services at any time in Our sole discretion and may never make them generally available.
|
39
|
+
|
40
|
+
## License
|
41
|
+
|
42
|
+
Copyright (c) 2011 Austin Bales and Do.com, Inc.
|
43
|
+
|
44
|
+
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:
|
45
|
+
|
46
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
47
|
+
|
48
|
+
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,37 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Do < OmniAuth::Strategies::OAuth2
|
6
|
+
SITE_URL = "https://do.com"
|
7
|
+
|
8
|
+
option :name, "do"
|
9
|
+
option :client_options, {
|
10
|
+
:site => SITE_URL,
|
11
|
+
:authorize_url => SITE_URL + '/oauth2/authorize',
|
12
|
+
:token_url => SITE_URL + '/oauth2/token'
|
13
|
+
}
|
14
|
+
|
15
|
+
uid {raw_info['id']}
|
16
|
+
|
17
|
+
info do
|
18
|
+
{
|
19
|
+
name: raw_info['name'],
|
20
|
+
first_name: raw_info['first_name'],
|
21
|
+
last_name: raw_info['last_name'],
|
22
|
+
email: raw_info['email'],
|
23
|
+
image: raw_info['avatar']['48']
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
extra do
|
28
|
+
{:raw_info => raw_info}
|
29
|
+
end
|
30
|
+
|
31
|
+
def raw_info
|
32
|
+
@raw_info ||= access_token.get('/account').parsed || {}
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/omniauth-do.rb
ADDED
data/omniauth-do.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth-do/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Austin Bales"]
|
6
|
+
gem.email = ["austin@do.com"]
|
7
|
+
gem.description = %q{OmniAuth strategy for Do (do.com).}
|
8
|
+
gem.summary = %q{OmniAuth strategy for Do (do.com).}
|
9
|
+
gem.homepage = "https://github.com/do/omniauth-do"
|
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-do"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = OmniAuth::Do::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,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe OmniAuth::Strategies::Do do
|
4
|
+
subject do
|
5
|
+
OmniAuth::Strategies::Do.new({})
|
6
|
+
end
|
7
|
+
|
8
|
+
context "client options" do
|
9
|
+
it 'should have correct site' do
|
10
|
+
subject.options.client_options.site.should eq("https://do.com")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
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-do'
|
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,156 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-do
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.alpha
|
5
|
+
prerelease: 6
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Austin Bales
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-30 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 Do (do.com).
|
111
|
+
email:
|
112
|
+
- austin@do.com
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files: []
|
116
|
+
files:
|
117
|
+
- .gitignore
|
118
|
+
- .rspec
|
119
|
+
- Gemfile
|
120
|
+
- Guardfile
|
121
|
+
- README.md
|
122
|
+
- Rakefile
|
123
|
+
- lib/omniauth-do.rb
|
124
|
+
- lib/omniauth-do/version.rb
|
125
|
+
- lib/omniauth/strategies/do.rb
|
126
|
+
- omniauth-do.gemspec
|
127
|
+
- spec/omniauth/strategies/do.rb
|
128
|
+
- spec/spec_helper.rb
|
129
|
+
homepage: https://github.com/do/omniauth-do
|
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.24
|
150
|
+
signing_key:
|
151
|
+
specification_version: 3
|
152
|
+
summary: OmniAuth strategy for Do (do.com).
|
153
|
+
test_files:
|
154
|
+
- spec/omniauth/strategies/do.rb
|
155
|
+
- spec/spec_helper.rb
|
156
|
+
has_rdoc:
|