omniauth-thecity 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +36 -0
- data/LICENSE.txt +22 -0
- data/README.md +38 -0
- data/Rakefile +1 -0
- data/lib/.DS_Store +0 -0
- data/lib/omniauth-thecity.rb +2 -0
- data/lib/omniauth-thecity/version.rb +5 -0
- data/lib/omniauth/.DS_Store +0 -0
- data/lib/omniauth/strategies/thecity.rb +45 -0
- data/omniauth-thecity-0.0.1.gem +0 -0
- data/omniauth-thecity.gemspec +23 -0
- metadata +72 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 612cbb6e2d5f0c003a19caafa45b0b7f9af1c24c
|
4
|
+
data.tar.gz: 3f858faf420e781096442dd3f35b7ee509013117
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ef57099341762fb26102765113be0cebab1f03515aa1c6a41128a2dae88c8a92b94be18e19b31467b3fceb761a5b66a9a473267d581cd46ce4932997ddc27b45
|
7
|
+
data.tar.gz: 59a197fc3d55ad5589381248a8eca5367ee7f261480a1798eb7554516b7d32fad4b875b1df8e79b58db92b36ec3589ff152a9ba96b0c3db580d8d21caaaf34c5
|
data/.DS_Store
ADDED
Binary file
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
omniauth-thecity (0.0.1)
|
5
|
+
omniauth-oauth2 (~> 1.1.1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
faraday (0.8.4)
|
11
|
+
multipart-post (~> 1.1)
|
12
|
+
hashie (1.2.0)
|
13
|
+
httpauth (0.2.0)
|
14
|
+
jwt (0.1.5)
|
15
|
+
multi_json (>= 1.0)
|
16
|
+
multi_json (1.3.6)
|
17
|
+
multipart-post (1.1.5)
|
18
|
+
oauth2 (0.8.0)
|
19
|
+
faraday (~> 0.8)
|
20
|
+
httpauth (~> 0.1)
|
21
|
+
jwt (~> 0.1.4)
|
22
|
+
multi_json (~> 1.0)
|
23
|
+
rack (~> 1.2)
|
24
|
+
omniauth (1.1.1)
|
25
|
+
hashie (~> 1.2)
|
26
|
+
rack
|
27
|
+
omniauth-oauth2 (1.1.1)
|
28
|
+
oauth2 (~> 0.8.0)
|
29
|
+
omniauth (~> 1.0)
|
30
|
+
rack (1.4.1)
|
31
|
+
|
32
|
+
PLATFORMS
|
33
|
+
ruby
|
34
|
+
|
35
|
+
DEPENDENCIES
|
36
|
+
omniauth-thecity!
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Mark Blair
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Omniauth::Thecity
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'omniauth-thecity'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install omniauth-thecity
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Place this in omniauth.rb initializer for the project
|
22
|
+
|
23
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
24
|
+
provider :thecity, "APPID", "SECRET", :scope => 'user_basic user_extended'
|
25
|
+
end
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
1. Fork it
|
30
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
31
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
32
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
33
|
+
5. Create new Pull Request
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/.DS_Store
ADDED
Binary file
|
Binary file
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'omniauth/strategies/oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class TheCity < OmniAuth::Strategies::OAuth2
|
6
|
+
DEFAULT_SCOPE = 'user_basic'
|
7
|
+
|
8
|
+
option :name, :thecity
|
9
|
+
|
10
|
+
option :client_options, {
|
11
|
+
site: "https://authentication.onthecity.org",
|
12
|
+
authorize_path: "/oauth/authorize"
|
13
|
+
}
|
14
|
+
|
15
|
+
def request_phase
|
16
|
+
redirect client.auth_code.authorize_url({:redirect_uri => callback_url}.merge(authorize_params))
|
17
|
+
end
|
18
|
+
|
19
|
+
def authorize_params
|
20
|
+
super.tap do |params|
|
21
|
+
params[:scope] ||= DEFAULT_SCOPE
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
uid do
|
26
|
+
raw_info["global_user"]["id"]
|
27
|
+
end
|
28
|
+
|
29
|
+
info do
|
30
|
+
raw_info
|
31
|
+
end
|
32
|
+
|
33
|
+
def raw_info
|
34
|
+
if session[:subdomain].present?
|
35
|
+
@raw_info ||= access_token.get("/authorization?subdomain=#{session[:subdomain]}").parsed
|
36
|
+
else
|
37
|
+
@raw_info ||= access_token.get("/authorization").parsed
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
OmniAuth.config.add_camelization 'thecity', 'TheCity'
|
45
|
+
|
Binary file
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth-thecity/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "omniauth-thecity"
|
8
|
+
gem.version = Omniauth::TheCity::VERSION
|
9
|
+
gem.platform = Gem::Platform::RUBY
|
10
|
+
gem.authors = ["Mark Blair", "Robert Leib"]
|
11
|
+
gem.email = ["mark@onthecity.org"]
|
12
|
+
gem.description = %q{OmniAuth Strategy for using The City's OAuth 2 Provider}
|
13
|
+
gem.summary = %q{TO DO: Write a gem summary}
|
14
|
+
gem.homepage = ""
|
15
|
+
|
16
|
+
gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.1.1'
|
17
|
+
|
18
|
+
|
19
|
+
gem.files = `git ls-files`.split($/)
|
20
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
21
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
22
|
+
gem.require_paths = ["lib"]
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-thecity
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mark Blair
|
8
|
+
- Robert Leib
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-09-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth-oauth2
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ~>
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 1.1.1
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 1.1.1
|
28
|
+
description: OmniAuth Strategy for using The City's OAuth 2 Provider
|
29
|
+
email:
|
30
|
+
- mark@onthecity.org
|
31
|
+
executables: []
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- .DS_Store
|
36
|
+
- Gemfile
|
37
|
+
- Gemfile.lock
|
38
|
+
- LICENSE.txt
|
39
|
+
- README.md
|
40
|
+
- Rakefile
|
41
|
+
- lib/.DS_Store
|
42
|
+
- lib/omniauth-thecity.rb
|
43
|
+
- lib/omniauth-thecity/version.rb
|
44
|
+
- lib/omniauth/.DS_Store
|
45
|
+
- lib/omniauth/strategies/thecity.rb
|
46
|
+
- omniauth-thecity-0.0.1.gem
|
47
|
+
- omniauth-thecity.gemspec
|
48
|
+
homepage: ''
|
49
|
+
licenses: []
|
50
|
+
metadata: {}
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubyforge_project:
|
67
|
+
rubygems_version: 2.1.5
|
68
|
+
signing_key:
|
69
|
+
specification_version: 4
|
70
|
+
summary: 'TO DO: Write a gem summary'
|
71
|
+
test_files: []
|
72
|
+
has_rdoc:
|