omniauth-thecity 0.0.1 → 0.0.3
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.
- checksums.yaml +4 -4
- data/.gitignore +12 -0
- data/README.md +71 -14
- data/lib/omniauth-thecity/version.rb +1 -1
- data/lib/omniauth/strategies/thecity.rb +9 -3
- metadata +2 -2
- data/omniauth-thecity-0.0.1.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 822ec3c46a21fc4817db7af64f6a4af6e2c642a1
|
4
|
+
data.tar.gz: dc2bef5ccc60a765a31c3629b01f0ac548e3abee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ce778247f62c015d74510190a76f08c189b558f3e229a3ec4bf7721f4cc8859f60cc7845d4a74bca94e388e962e4e5a8b6ab687e03dd12cf67517b4515cd0c7
|
7
|
+
data.tar.gz: 226ef7bfa89dab8b3e75f2adac7c36c484135e94115102b0a64f58cf347398aaf004705ff955b4ba6dd707e67a2b8f3f80a43c3ed9dc85ed3d7545551624e034
|
data/.gitignore
ADDED
data/README.md
CHANGED
@@ -1,28 +1,82 @@
|
|
1
1
|
# Omniauth::Thecity
|
2
2
|
|
3
|
-
|
3
|
+
[](http://badge.fury.io/rb/omniauth-thecity)
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
5
|
+
This gem contains The City strategy for OmniAuth.
|
8
6
|
|
9
|
-
|
7
|
+
## Before You Begin
|
10
8
|
|
11
|
-
|
9
|
+
You should have already installed OmniAuth into your app; if not, read the [OmniAuth README](https://github.com/intridea/omniauth) to get started.
|
12
10
|
|
13
|
-
|
11
|
+
## Installation
|
14
12
|
|
15
|
-
|
13
|
+
Add this line to your application's Gemfile:
|
16
14
|
|
17
|
-
|
15
|
+
```ruby
|
16
|
+
gem 'omniauth-thecity'
|
17
|
+
```
|
18
18
|
|
19
|
+
Or install it yourself as:
|
20
|
+
```
|
21
|
+
$ gem install omniauth-thecity
|
22
|
+
```
|
19
23
|
## Usage
|
20
24
|
|
21
|
-
|
25
|
+
Tell OmniAuth about this provider. For a Rails app, your `config/initializers/omniauth.rb` file should look like this:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
29
|
+
provider :thecity, "APPID", "SECRET", :scope => 'user_basic user_extended'
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
## Authentication Hash
|
34
|
+
An example auth hash available in `request.env['omniauth.auth']`:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
{
|
38
|
+
"provider"=>:thecity,
|
39
|
+
"uid"=>216612,
|
40
|
+
"info"=> {
|
41
|
+
"global_user"=> {
|
42
|
+
"id"=>216612,
|
43
|
+
"first"=>"Robert",
|
44
|
+
"last"=>"Robertson",
|
45
|
+
"email"=>"robert.son@email.com",
|
46
|
+
"gender"=>"Male",
|
47
|
+
"birthdate"=>"1977-10-13"
|
48
|
+
},
|
49
|
+
"user"=> {
|
50
|
+
"id"=>14347,
|
51
|
+
"title"=>"Deacon",
|
52
|
+
"member"=>false,
|
53
|
+
"staff"=>true,
|
54
|
+
"first"=>"Bob",
|
55
|
+
"last"=>"Robertson",
|
56
|
+
"email"=>"robert.son@email.com",
|
57
|
+
"account_id"=>12345678,
|
58
|
+
"profile_picture"=> "https://....a4bfe58666_thumb.png",
|
59
|
+
"admin_privileges"=>[
|
60
|
+
{ "title"=>"Account Admin" },
|
61
|
+
{ "group_id"=>12345, "title"=>"Group Admin" },
|
62
|
+
{ "title"=>"User Admin" }
|
63
|
+
]
|
64
|
+
}
|
65
|
+
},
|
66
|
+
"credentials"=> {
|
67
|
+
"token"=>"3551fe753551355144dc88b45173551f9e69dde79f355180db35516c11b357e9",
|
68
|
+
"expires"=>false
|
69
|
+
},
|
70
|
+
"extra"=>{}
|
71
|
+
}
|
72
|
+
```
|
73
|
+
|
74
|
+
## Watch the RailsCast
|
75
|
+
|
76
|
+
Ryan Bates has put together an excellent RailsCast on OmniAuth:
|
77
|
+
|
78
|
+
[")](http://railscasts.com/episodes/241-simple-omniauth-revised)
|
22
79
|
|
23
|
-
Rails.application.config.middleware.use OmniAuth::Builder do
|
24
|
-
provider :thecity, "APPID", "SECRET", :scope => 'user_basic user_extended'
|
25
|
-
end
|
26
80
|
|
27
81
|
## Contributing
|
28
82
|
|
@@ -33,6 +87,9 @@ Place this in omniauth.rb initializer for the project
|
|
33
87
|
5. Create new Pull Request
|
34
88
|
|
35
89
|
|
90
|
+
## License
|
36
91
|
|
92
|
+
Copyright (c) 2013 Mark Blair
|
93
|
+
See [LICENSE][] for details.
|
37
94
|
|
38
|
-
|
95
|
+
[license]: LICENSE.txt
|
@@ -12,8 +12,10 @@ module OmniAuth
|
|
12
12
|
authorize_path: "/oauth/authorize"
|
13
13
|
}
|
14
14
|
|
15
|
+
option :subdomain, nil
|
16
|
+
|
15
17
|
def request_phase
|
16
|
-
redirect client.auth_code.authorize_url({:redirect_uri => callback_url}.merge(authorize_params))
|
18
|
+
redirect client.auth_code.authorize_url({:redirect_uri => callback_url, :subdomain => subdomain}.merge(authorize_params))
|
17
19
|
end
|
18
20
|
|
19
21
|
def authorize_params
|
@@ -22,6 +24,10 @@ module OmniAuth
|
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
27
|
+
def subdomain
|
28
|
+
options.subdomain ||= request.params["subdomain"] || request.headers['HTTP_X_CITY_SUBDOMAIN'] || nil rescue nil
|
29
|
+
end
|
30
|
+
|
25
31
|
uid do
|
26
32
|
raw_info["global_user"]["id"]
|
27
33
|
end
|
@@ -31,8 +37,8 @@ module OmniAuth
|
|
31
37
|
end
|
32
38
|
|
33
39
|
def raw_info
|
34
|
-
if
|
35
|
-
@raw_info ||= access_token.get("/authorization?subdomain=#{
|
40
|
+
if subdomain
|
41
|
+
@raw_info ||= access_token.get("/authorization?subdomain=#{subdomain}").parsed
|
36
42
|
else
|
37
43
|
@raw_info ||= access_token.get("/authorization").parsed
|
38
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-thecity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Blair
|
@@ -33,6 +33,7 @@ extensions: []
|
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
35
|
- .DS_Store
|
36
|
+
- .gitignore
|
36
37
|
- Gemfile
|
37
38
|
- Gemfile.lock
|
38
39
|
- LICENSE.txt
|
@@ -43,7 +44,6 @@ files:
|
|
43
44
|
- lib/omniauth-thecity/version.rb
|
44
45
|
- lib/omniauth/.DS_Store
|
45
46
|
- lib/omniauth/strategies/thecity.rb
|
46
|
-
- omniauth-thecity-0.0.1.gem
|
47
47
|
- omniauth-thecity.gemspec
|
48
48
|
homepage: ''
|
49
49
|
licenses: []
|
data/omniauth-thecity-0.0.1.gem
DELETED
Binary file
|