omniauth-thecity 1.0.0 → 1.0.1
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/README.md +28 -0
- data/lib/omniauth-thecity/version.rb +1 -1
- data/lib/omniauth/strategies/thecity.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ef1f6ca2d04f19825de6df66da44858cdea2146
|
4
|
+
data.tar.gz: 42128cb835c4f7d5556f0ac739d0939d0c48b2e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b44be598fda2c028e0150fa1720c4db1b78e1307b937a3c00dc916f358bca5b9617eb7b876a00662bf7c785ae53e52f688dbbf03f7584554c62bb7a22e9116f
|
7
|
+
data.tar.gz: 8c575b464dc6c2c6c2837f51b6bcef38ba9ec8d901b1cc9cd070db062795a25ae143f569544fb948ebafe9c328bbf78e2daac8d3e009ac7974737579869447f1
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Omniauth::Thecity
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/omniauth-thecity)
|
4
|
+
[](https://gemnasium.com/thecity/omniauth-thecity)
|
4
5
|
|
5
6
|
This gem contains The City strategy for OmniAuth.
|
6
7
|
|
@@ -30,6 +31,33 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
|
30
31
|
end
|
31
32
|
```
|
32
33
|
|
34
|
+
### The City subdomains
|
35
|
+
|
36
|
+
City users have one global user, and then a local user for each subdomain (City) they have an active account.
|
37
|
+
|
38
|
+
When a user successfully authenticates, omnniauth-thecity returns an array of local users belonging to the City global user. If you pass along a subdomain, The City authentication service will only return an active local user for the subdomain you passed in.
|
39
|
+
|
40
|
+
If your app only cares about one City subdomain (e.g. gracechurch.onthecity.org ), you can configure omniauth-thecity globally like this:
|
41
|
+
```ruby
|
42
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
43
|
+
provider :thecity, "APPID", "SECRET", :scope => 'user_basic user_extended', :subdomain => 'gracechurch'}
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
Otherwise, you can set the subdomain per request as a query parameter, or header.
|
48
|
+
|
49
|
+
For example, when using [devise](https://github.com/plataformatec/devise) you can pass the subdomain using the route helper:
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
user_omniauth_authorize_path(:thecity, params: {subdomain: 'gracechurch'})
|
53
|
+
```
|
54
|
+
|
55
|
+
or as a custom header in your request:
|
56
|
+
|
57
|
+
```
|
58
|
+
X_THECITY_SUBDOMAIN: gracechurch
|
59
|
+
```
|
60
|
+
|
33
61
|
## Authentication Hash
|
34
62
|
An example auth hash available in `request.env['omniauth.auth']`:
|
35
63
|
|
@@ -25,7 +25,7 @@ module OmniAuth
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def subdomain
|
28
|
-
options.subdomain ||= request.params["subdomain"] || request.headers['
|
28
|
+
options.subdomain ||= request.params["subdomain"] || request.headers['HTTP_X_THECITY_SUBDOMAIN'] || nil rescue nil
|
29
29
|
end
|
30
30
|
|
31
31
|
uid do
|