omniauth-cloud66 0.1.0
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/Gemfile +4 -0
- data/README.md +37 -0
- data/Rakefile +8 -0
- data/lib/omniauth/strategies/cloud66.rb +30 -0
- data/lib/omniauth-cloud66/version.rb +5 -0
- data/lib/omniauth-cloud66.rb +2 -0
- data/omniauth-cloud66.gemspec +24 -0
- data/spec/omniauth/strategies/cloud66_spec.rb +24 -0
- data/spec/spec_helper.rb +16 -0
- metadata +151 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# OmniAuth Cloud66
|
2
|
+
|
3
|
+
This is the unofficial OmniAuth strategy for authenticating to [Cloud 66](https://www.cloud66.com).
|
4
|
+
|
5
|
+
Before you can start developing your API client for Cloud 66, you need to enable developers mode on your account.
|
6
|
+
|
7
|
+
Login to your Cloud 66 account and enable your account as a Developer account under Account/Apps.
|
8
|
+
Once your account is a developer one, you will see a Developers link on the left menu.
|
9
|
+
|
10
|
+
Now you can register your API client. Click on New Application button and enter the name of your client and the OAuth 2.0 callback URL.
|
11
|
+
|
12
|
+
For more info visit [Cloud 66 official docs](https://www.cloud66.com/help).
|
13
|
+
|
14
|
+
## Basic usage
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
use OmniAuth::Builder do
|
18
|
+
provider :cloud66, ENV['CLIENT_ID'], ENV['CLIENT_SECRET']
|
19
|
+
end
|
20
|
+
```
|
21
|
+
|
22
|
+
## Scopes
|
23
|
+
|
24
|
+
Cloud 66 API lets you set scopes to provide granular access to different types of data:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
use OmniAuth::Builder do
|
28
|
+
provider :cloud66, ENV['CLIENT_ID'], ENV['CLIENT_SECRET'], scope: "public,redeploy"
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
More info on [Scopes](https://www.cloud66.com/help/basics#scopes).
|
33
|
+
|
34
|
+
## License
|
35
|
+
|
36
|
+
omniauth-cloud66 is released under the MIT License.
|
37
|
+
Developed by [rastasheep](https://github.com/rastasheep).
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Cloud66 < OmniAuth::Strategies::OAuth2
|
6
|
+
option :client_options, {
|
7
|
+
:site => "https://www.cloud66.com/api/2",
|
8
|
+
:authorize_url => "https://www.cloud66.com/oauth/authorize" ,
|
9
|
+
:token_url => "https://www.cloud66.com/oauth/token"
|
10
|
+
}
|
11
|
+
|
12
|
+
def request_phase
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def authorize_params
|
17
|
+
super.tap do |params|
|
18
|
+
%w[scope client_options].each do |v|
|
19
|
+
if request.params[v]
|
20
|
+
params[v.to_sym] = request.params[v]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
OmniAuth.config.add_camelization 'cloud66', 'Cloud66'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth-cloud66/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Aleksandar Diklic"]
|
6
|
+
gem.email = ["rastasheep@gmail.com"]
|
7
|
+
gem.description = %q{Unfficial OmniAuth strategy for Cloud66.}
|
8
|
+
gem.summary = %q{Unfficial OmniAuth strategy for Cloud66.}
|
9
|
+
gem.homepage = "https://github.com/rastasheep/omniauth-cloud66"
|
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-cloud66"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = OmniAuth::Cloud66::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,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe OmniAuth::Strategies::Cloud66 do
|
4
|
+
|
5
|
+
subject do
|
6
|
+
OmniAuth::Strategies::Cloud66.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.cloud66.com/api/2")
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should have correct authorize url' do
|
15
|
+
subject.options.client_options.authorize_url.should eq("https://www.cloud66.com/oauth/authorize")
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should have correct token url' do
|
19
|
+
subject.options.client_options.token_url.should eq("https://www.cloud66.com/oauth/token")
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
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-cloud66'
|
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,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-cloud66
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Aleksandar Diklic
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-09-05 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: Unfficial OmniAuth strategy for Cloud66.
|
111
|
+
email:
|
112
|
+
- rastasheep@gmail.com
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files: []
|
116
|
+
files:
|
117
|
+
- .gitignore
|
118
|
+
- Gemfile
|
119
|
+
- README.md
|
120
|
+
- Rakefile
|
121
|
+
- lib/omniauth-cloud66.rb
|
122
|
+
- lib/omniauth-cloud66/version.rb
|
123
|
+
- lib/omniauth/strategies/cloud66.rb
|
124
|
+
- omniauth-cloud66.gemspec
|
125
|
+
- spec/omniauth/strategies/cloud66_spec.rb
|
126
|
+
- spec/spec_helper.rb
|
127
|
+
homepage: https://github.com/rastasheep/omniauth-cloud66
|
128
|
+
licenses: []
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
none: false
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
requirements: []
|
146
|
+
rubyforge_project:
|
147
|
+
rubygems_version: 1.8.23
|
148
|
+
signing_key:
|
149
|
+
specification_version: 3
|
150
|
+
summary: Unfficial OmniAuth strategy for Cloud66.
|
151
|
+
test_files: []
|