gds-sso 0.6.0 → 0.6.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.
- data/lib/gds-sso/api_access.rb +1 -1
- data/lib/gds-sso/version.rb +1 -1
- data/spec/internal/log/test.log +168 -0
- data/test/api_access_test.rb +16 -0
- metadata +6 -4
data/lib/gds-sso/api_access.rb
CHANGED
|
@@ -5,7 +5,7 @@ module GDS
|
|
|
5
5
|
class ApiAccess
|
|
6
6
|
def self.api_call?(env)
|
|
7
7
|
request = Rack::Accept::Request.new(env)
|
|
8
|
-
request.best_media_type(%w{application/json
|
|
8
|
+
request.best_media_type(%w{text/html application/json}) == 'application/json'
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
end
|
data/lib/gds-sso/version.rb
CHANGED
data/spec/internal/log/test.log
CHANGED
|
@@ -1725,3 +1725,171 @@ Started GET "/restricted" for 127.0.0.1 at 2012-06-12 15:18:58 +0000
|
|
|
1725
1725
|
Processing by ExampleController#restricted as JSON
|
|
1726
1726
|
Authenticating with gds_sso_api_access strategy
|
|
1727
1727
|
Completed 200 OK in 1ms (Views: 0.6ms)
|
|
1728
|
+
|
|
1729
|
+
|
|
1730
|
+
Started GET "/" for 127.0.0.1 at 2012-06-14 15:19:20 +0000
|
|
1731
|
+
Processing by ExampleController#index as HTML
|
|
1732
|
+
Rendered text template (0.0ms)
|
|
1733
|
+
Completed 200 OK in 48ms (Views: 47.9ms)
|
|
1734
|
+
|
|
1735
|
+
|
|
1736
|
+
Started GET "/restricted" for 127.0.0.1 at 2012-06-14 15:19:20 +0000
|
|
1737
|
+
Processing by ExampleController#restricted as HTML
|
|
1738
|
+
Authenticating with gds_sso strategy
|
|
1739
|
+
Completed in 55ms
|
|
1740
|
+
|
|
1741
|
+
|
|
1742
|
+
Started GET "/auth/gds" for 127.0.0.1 at 2012-06-14 15:19:21 +0000
|
|
1743
|
+
|
|
1744
|
+
|
|
1745
|
+
Started GET "/auth/gds/callback?code=3X9gxCoo1mdLjmIAGLUYXi53DmrLJvQMZr7LpNsUnBP40D6D" for 127.0.0.1 at 2012-06-14 15:19:21 +0000
|
|
1746
|
+
Processing by AuthenticationsController#callback as HTML
|
|
1747
|
+
Parameters: {"code"=>"3X9gxCoo1mdLjmIAGLUYXi53DmrLJvQMZr7LpNsUnBP40D6D"}
|
|
1748
|
+
Authenticating with gds_sso strategy
|
|
1749
|
+
Redirected to http://www.example-client.com/restricted
|
|
1750
|
+
Completed 302 Found in 1ms
|
|
1751
|
+
|
|
1752
|
+
|
|
1753
|
+
Started GET "/restricted" for 127.0.0.1 at 2012-06-14 15:19:22 +0000
|
|
1754
|
+
Processing by ExampleController#restricted as HTML
|
|
1755
|
+
Completed 200 OK in 1ms (Views: 0.5ms)
|
|
1756
|
+
|
|
1757
|
+
|
|
1758
|
+
Started GET "/restricted" for 127.0.0.1 at 2012-06-14 15:19:22 +0000
|
|
1759
|
+
Processing by ExampleController#restricted as HTML
|
|
1760
|
+
Authenticating with gds_sso strategy
|
|
1761
|
+
Completed in 0ms
|
|
1762
|
+
|
|
1763
|
+
|
|
1764
|
+
Started GET "/auth/gds" for 127.0.0.1 at 2012-06-14 15:19:22 +0000
|
|
1765
|
+
|
|
1766
|
+
|
|
1767
|
+
Started GET "/auth/gds/callback?code=7ssiO5k4uoxn3ATRiEXLVwyAGuKbBUBY1zH8yiVx5NE0tWWL" for 127.0.0.1 at 2012-06-14 15:19:22 +0000
|
|
1768
|
+
Processing by AuthenticationsController#callback as HTML
|
|
1769
|
+
Parameters: {"code"=>"7ssiO5k4uoxn3ATRiEXLVwyAGuKbBUBY1zH8yiVx5NE0tWWL"}
|
|
1770
|
+
Authenticating with gds_sso strategy
|
|
1771
|
+
Redirected to http://www.example-client.com/restricted
|
|
1772
|
+
Completed 302 Found in 1ms
|
|
1773
|
+
|
|
1774
|
+
|
|
1775
|
+
Started GET "/restricted" for 127.0.0.1 at 2012-06-14 15:19:22 +0000
|
|
1776
|
+
Processing by ExampleController#restricted as HTML
|
|
1777
|
+
Completed 200 OK in 1ms (Views: 0.5ms)
|
|
1778
|
+
|
|
1779
|
+
|
|
1780
|
+
Started GET "/restricted" for 127.0.0.1 at 2012-06-14 15:19:22 +0000
|
|
1781
|
+
Processing by ExampleController#restricted as HTML
|
|
1782
|
+
Authenticating with gds_sso strategy
|
|
1783
|
+
Completed in 0ms
|
|
1784
|
+
|
|
1785
|
+
|
|
1786
|
+
Started GET "/auth/gds" for 127.0.0.1 at 2012-06-14 15:19:22 +0000
|
|
1787
|
+
|
|
1788
|
+
|
|
1789
|
+
Started GET "/auth/gds/callback?code=vqxBHSpDRQB8aXNWxz4XuZSKGiDn7TeoT8BtjrOdiR3T2enX" for 127.0.0.1 at 2012-06-14 15:19:22 +0000
|
|
1790
|
+
Processing by AuthenticationsController#callback as HTML
|
|
1791
|
+
Parameters: {"code"=>"vqxBHSpDRQB8aXNWxz4XuZSKGiDn7TeoT8BtjrOdiR3T2enX"}
|
|
1792
|
+
Authenticating with gds_sso strategy
|
|
1793
|
+
Redirected to http://www.example-client.com/restricted
|
|
1794
|
+
Completed 302 Found in 1ms
|
|
1795
|
+
|
|
1796
|
+
|
|
1797
|
+
Started GET "/restricted" for 127.0.0.1 at 2012-06-14 15:19:22 +0000
|
|
1798
|
+
Processing by ExampleController#restricted as HTML
|
|
1799
|
+
Completed 200 OK in 1ms (Views: 0.3ms)
|
|
1800
|
+
|
|
1801
|
+
|
|
1802
|
+
Started GET "/restricted" for 127.0.0.1 at 2012-06-14 15:19:22 +0000
|
|
1803
|
+
Processing by ExampleController#restricted as JSON
|
|
1804
|
+
Authenticating with gds_sso_api_access strategy
|
|
1805
|
+
Completed in 32ms
|
|
1806
|
+
|
|
1807
|
+
|
|
1808
|
+
Started GET "/restricted" for 127.0.0.1 at 2012-06-14 15:19:22 +0000
|
|
1809
|
+
Processing by ExampleController#restricted as JSON
|
|
1810
|
+
Authenticating with gds_sso_api_access strategy
|
|
1811
|
+
Completed 200 OK in 1ms (Views: 0.6ms)
|
|
1812
|
+
|
|
1813
|
+
|
|
1814
|
+
Started GET "/" for 127.0.0.1 at 2012-06-14 15:20:01 +0000
|
|
1815
|
+
Processing by ExampleController#index as HTML
|
|
1816
|
+
Rendered text template (0.0ms)
|
|
1817
|
+
Completed 200 OK in 46ms (Views: 45.4ms)
|
|
1818
|
+
|
|
1819
|
+
|
|
1820
|
+
Started GET "/restricted" for 127.0.0.1 at 2012-06-14 15:20:01 +0000
|
|
1821
|
+
Processing by ExampleController#restricted as HTML
|
|
1822
|
+
Authenticating with gds_sso strategy
|
|
1823
|
+
Completed in 56ms
|
|
1824
|
+
|
|
1825
|
+
|
|
1826
|
+
Started GET "/auth/gds" for 127.0.0.1 at 2012-06-14 15:20:01 +0000
|
|
1827
|
+
|
|
1828
|
+
|
|
1829
|
+
Started GET "/auth/gds/callback?code=d920cd289e61160ef8333ea385bb435a01bd160b06cd5ffa6d3bd8ec763bce88" for 127.0.0.1 at 2012-06-14 15:20:02 +0000
|
|
1830
|
+
Processing by AuthenticationsController#callback as HTML
|
|
1831
|
+
Parameters: {"code"=>"d920cd289e61160ef8333ea385bb435a01bd160b06cd5ffa6d3bd8ec763bce88"}
|
|
1832
|
+
Authenticating with gds_sso strategy
|
|
1833
|
+
Redirected to http://www.example-client.com/restricted
|
|
1834
|
+
Completed 302 Found in 1ms
|
|
1835
|
+
|
|
1836
|
+
|
|
1837
|
+
Started GET "/restricted" for 127.0.0.1 at 2012-06-14 15:20:02 +0000
|
|
1838
|
+
Processing by ExampleController#restricted as HTML
|
|
1839
|
+
Completed 200 OK in 1ms (Views: 0.5ms)
|
|
1840
|
+
|
|
1841
|
+
|
|
1842
|
+
Started GET "/restricted" for 127.0.0.1 at 2012-06-14 15:20:02 +0000
|
|
1843
|
+
Processing by ExampleController#restricted as HTML
|
|
1844
|
+
Authenticating with gds_sso strategy
|
|
1845
|
+
Completed in 0ms
|
|
1846
|
+
|
|
1847
|
+
|
|
1848
|
+
Started GET "/auth/gds" for 127.0.0.1 at 2012-06-14 15:20:02 +0000
|
|
1849
|
+
|
|
1850
|
+
|
|
1851
|
+
Started GET "/auth/gds/callback?code=2b3f0cd0044671101c4d8c13ae636a8f5d85f809927ada683e4c401db0a519d2" for 127.0.0.1 at 2012-06-14 15:20:03 +0000
|
|
1852
|
+
Processing by AuthenticationsController#callback as HTML
|
|
1853
|
+
Parameters: {"code"=>"2b3f0cd0044671101c4d8c13ae636a8f5d85f809927ada683e4c401db0a519d2"}
|
|
1854
|
+
Authenticating with gds_sso strategy
|
|
1855
|
+
Redirected to http://www.example-client.com/restricted
|
|
1856
|
+
Completed 302 Found in 1ms
|
|
1857
|
+
|
|
1858
|
+
|
|
1859
|
+
Started GET "/restricted" for 127.0.0.1 at 2012-06-14 15:20:03 +0000
|
|
1860
|
+
Processing by ExampleController#restricted as HTML
|
|
1861
|
+
Completed 200 OK in 1ms (Views: 0.7ms)
|
|
1862
|
+
|
|
1863
|
+
|
|
1864
|
+
Started GET "/restricted" for 127.0.0.1 at 2012-06-14 15:20:03 +0000
|
|
1865
|
+
Processing by ExampleController#restricted as HTML
|
|
1866
|
+
Authenticating with gds_sso strategy
|
|
1867
|
+
Completed in 0ms
|
|
1868
|
+
|
|
1869
|
+
|
|
1870
|
+
Started GET "/auth/gds" for 127.0.0.1 at 2012-06-14 15:20:03 +0000
|
|
1871
|
+
|
|
1872
|
+
|
|
1873
|
+
Started GET "/auth/gds/callback?code=60b650e78f074bb9cf48e31b1e4b328057eb32bcf8a34d3b809e847816e05522" for 127.0.0.1 at 2012-06-14 15:20:03 +0000
|
|
1874
|
+
Processing by AuthenticationsController#callback as HTML
|
|
1875
|
+
Parameters: {"code"=>"60b650e78f074bb9cf48e31b1e4b328057eb32bcf8a34d3b809e847816e05522"}
|
|
1876
|
+
Authenticating with gds_sso strategy
|
|
1877
|
+
Redirected to http://www.example-client.com/restricted
|
|
1878
|
+
Completed 302 Found in 1ms
|
|
1879
|
+
|
|
1880
|
+
|
|
1881
|
+
Started GET "/restricted" for 127.0.0.1 at 2012-06-14 15:20:03 +0000
|
|
1882
|
+
Processing by ExampleController#restricted as HTML
|
|
1883
|
+
Completed 200 OK in 1ms (Views: 0.3ms)
|
|
1884
|
+
|
|
1885
|
+
|
|
1886
|
+
Started GET "/restricted" for 127.0.0.1 at 2012-06-14 15:20:03 +0000
|
|
1887
|
+
Processing by ExampleController#restricted as JSON
|
|
1888
|
+
Authenticating with gds_sso_api_access strategy
|
|
1889
|
+
Completed in 11ms
|
|
1890
|
+
|
|
1891
|
+
|
|
1892
|
+
Started GET "/restricted" for 127.0.0.1 at 2012-06-14 15:20:03 +0000
|
|
1893
|
+
Processing by ExampleController#restricted as JSON
|
|
1894
|
+
Authenticating with gds_sso_api_access strategy
|
|
1895
|
+
Completed 200 OK in 1ms (Views: 0.6ms)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
require 'gds-sso/api_access'
|
|
3
|
+
|
|
4
|
+
class ApiAccessTest < Test::Unit::TestCase
|
|
5
|
+
def test_internet_explorer_7_accept_header_is_not_considered_to_be_api_call
|
|
6
|
+
ie7_accept_header = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, ' +
|
|
7
|
+
'application/x-shockwave-flash, application/xaml+xml, application/x-ms-xbap, ' +
|
|
8
|
+
'application/x-ms-application, */*'
|
|
9
|
+
refute GDS::SSO::ApiAccess.api_call?('HTTP_ACCEPT' => ie7_accept_header)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_application_json_accept_header_is_considered_to_be_api_call
|
|
13
|
+
assert GDS::SSO::ApiAccess.api_call?('HTTP_ACCEPT' => 'application/json')
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end
|
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: gds-sso
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 0.6.
|
|
5
|
+
version: 0.6.1
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Matt Patterson
|
|
@@ -11,7 +11,7 @@ autorequire:
|
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
13
|
|
|
14
|
-
date: 2012-06-
|
|
14
|
+
date: 2012-06-14 00:00:00 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: rails
|
|
@@ -181,6 +181,7 @@ files:
|
|
|
181
181
|
- README.md
|
|
182
182
|
- Gemfile
|
|
183
183
|
- Rakefile
|
|
184
|
+
- test/api_access_test.rb
|
|
184
185
|
- test/test_helper.rb
|
|
185
186
|
- test/user_test.rb
|
|
186
187
|
- spec/requests/end_to_end_spec.rb
|
|
@@ -214,7 +215,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
214
215
|
requirements:
|
|
215
216
|
- - ">="
|
|
216
217
|
- !ruby/object:Gem::Version
|
|
217
|
-
hash:
|
|
218
|
+
hash: -3744157965083249395
|
|
218
219
|
segments:
|
|
219
220
|
- 0
|
|
220
221
|
version: "0"
|
|
@@ -223,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
223
224
|
requirements:
|
|
224
225
|
- - ">="
|
|
225
226
|
- !ruby/object:Gem::Version
|
|
226
|
-
hash:
|
|
227
|
+
hash: -3744157965083249395
|
|
227
228
|
segments:
|
|
228
229
|
- 0
|
|
229
230
|
version: "0"
|
|
@@ -235,6 +236,7 @@ signing_key:
|
|
|
235
236
|
specification_version: 3
|
|
236
237
|
summary: Client for GDS' OAuth 2-based SSO
|
|
237
238
|
test_files:
|
|
239
|
+
- test/api_access_test.rb
|
|
238
240
|
- test/test_helper.rb
|
|
239
241
|
- test/user_test.rb
|
|
240
242
|
- spec/requests/end_to_end_spec.rb
|