omniauth-dice 0.2.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7133e04ea14b309df8e8c0d57bc11e424fa537f7
4
- data.tar.gz: dbc33b1b548e1e0ab3d2b34a704d0b1c13cc2bba
3
+ metadata.gz: 552059b078d15950580a1ab3d239785e072489bd
4
+ data.tar.gz: a219cf089244eb8e2fd89adcf162f67cca54c88a
5
5
  SHA512:
6
- metadata.gz: ac8a4ad5542cee1c7ad5e4563d1b7aa3c1e550b622bbebcd3362dc7dd0750e3b20634fac2097997035c36ed40b9c5aca508be1611972c54dae4789873d94ba67
7
- data.tar.gz: eedb52806258e18ffc7f648fe19b75dd8f5ac1c65b64a2d55a3e9083fd72622aee1d1fcc0627c02697eb1ef0fb249884fdb0acb9884a6d09cc2c62f08d93c36e
6
+ metadata.gz: 4b274db299621bedf763313c1199551ba53a8629979282c329662e71c2e02a19b6716581b4254dd03c91632360a9ca32123de266bf2f801377d603536495c67a
7
+ data.tar.gz: cd0e5841cd236925e43e4076cac60a407edeb2a7bdb6051e67a49569e4b20569a788c22f93a09a71e5838a3e381e86c1e437de2c7f5788fcc8352575c906e41e
checksums.yaml.gz.sig CHANGED
@@ -1 +1,4 @@
1
- f��l(�C�`�]_7n�@f2t����5��!,�׷���s���#p���d�y([��Z�ԑ��K��_����V�@yB]L��� �zS�(�?�� ��2w��]�C� ���.#V�%����MWy���X�������#���Mn������Fՙ?�F2��S�5��ҘO�������EI��#�i�A�E�M �ɉ��9땨(��E�����R���h�B�˻��G��3��NR~O�\�T���d�n
1
+ G���VsY��t
2
+ ����׿�1T.���1pq|�\z[����o�YU�BA�
3
+ ��ڬ�o>����M�\�r>���6�g��j���4�$����
4
+ ��"������JM12�K�&���Dx��Z�@&���u��rS�*�Z]��,3h��I;y�6��P�@y{DzeZu���l�#�����pF9�����Z)�"�O�;�D1��A�3��5�@Qu���{,�a���ʍ�݊��.]֫� � p}w9F�Ȭb��&
data.tar.gz.sig CHANGED
@@ -1,6 +1 @@
1
- N*Q*�z��NHUl��W,؉d��;u��$n"ڪks�55ҟn�����u0#�&!��.�v�w(Ⱥ2�x��ɹ�ؘ�N���e%� �ŮW��xR�q��� �;�q �� �Ֆ��c�Y��z.��Ym�k
2
- ]}�&_�����j|p�F��V��h
3
- 5�X����y���U�
4
- ��*f�v[
5
- Ũ��d�v�+
6
- С�98�u:d%�n��N��i �&���*(��0�)�&Kf�ň1uX4zϰn
1
+ �)C��O���ɼ�M��F���ۊ{+���ht��
data/README.md CHANGED
@@ -63,6 +63,8 @@ Full configuration options are as follows:
63
63
 
64
64
  * `cas_server` [String] Required base URL for CAS server
65
65
  * `authentication_path` [String] URL path for endpoint, e.g. '/users'
66
+ * `custom_callback_url` [String] Use a fully custom URL for callback endpoint
67
+ This option overrides the `use_callback_url` option setting!
66
68
  * `use_callback_url` [Boolean] Use full URL vs path for callback endpoint
67
69
  This is especially useful if your app runs as a sub-URI example.org/app_name
68
70
  * `return_field` [String] Optional path to append after DN string
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Dice
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
@@ -37,6 +37,7 @@ module OmniAuth
37
37
 
38
38
  option :dnc_options, {}
39
39
  option :cas_server, nil
40
+ option :custom_callback_url, nil
40
41
  option :use_callback_url, false
41
42
  option :authentication_path, nil
42
43
  option :return_field, 'info'
@@ -83,7 +84,7 @@ module OmniAuth
83
84
  log :debug, "Formatted issuer_dn: #{issuer_dn}"
84
85
  set_session_dn(issuer_dn, 'issuer') if issuer_dn
85
86
 
86
- redirect options.use_callback_url==true ? callback_url : callback_path
87
+ redirect_for_callback
87
88
  end
88
89
 
89
90
  def callback_phase
@@ -128,6 +129,18 @@ module OmniAuth
128
129
  info
129
130
  end
130
131
 
132
+ def redirect_for_callback
133
+ if options.custom_callback_url
134
+ redirect options.custom_callback_url
135
+ else
136
+ if options.use_callback_url == true
137
+ redirect callback_url
138
+ else
139
+ redirect callback_path
140
+ end
141
+ end
142
+ end
143
+
131
144
  private
132
145
 
133
146
  # Change Hashie indifferent access keys back to symbols
@@ -103,6 +103,29 @@ describe OmniAuth::Strategies::Dice, type: :strategy do
103
103
  end
104
104
  end
105
105
 
106
+ describe "custom_callback_url" do
107
+ it "should use the custom_callback_url provided instead of default callback_path|url when specified" do
108
+ callback_url_opts = {
109
+ cas_server: 'http://example.org',
110
+ authentication_path: '/dn',
111
+ custom_callback_url: 'http://example.org/sub-uri/auth/dice/callback'
112
+ }
113
+ self.app = Rack::Builder.app do
114
+ use Rack::Session::Cookie, :secret => '1337geeks'
115
+ use RackSessionAccess::Middleware
116
+ use OmniAuth::Strategies::Dice, callback_url_opts
117
+ run lambda{|env| [404, {'env' => env}, ["HELLO!"]]}
118
+ end
119
+ header 'Ssl-Client-Cert', user_cert
120
+ get '/auth/dice'
121
+ expect(last_request.env['HTTP_SSL_CLIENT_CERT']).to eq(user_cert)
122
+ expect(last_request.url).to eq('http://example.org/auth/dice')
123
+ expect(last_request.env['rack.session']['omniauth.params']['user_dn']).to eq(user_dn.to_s)
124
+ expect(last_request.env['rack.session']['omniauth.params']['issuer_dn']).to eq(issuer_dn)
125
+ expect(last_response.location).to eq('http://example.org/sub-uri/auth/dice/callback')
126
+ end
127
+ end
128
+
106
129
  describe '#request_phase' do
107
130
  it 'should fail without a client DN' do
108
131
  expect { get '/auth/dice' }.to raise_error(OmniAuth::Error, 'You need a valid DN to authenticate.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-dice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Haddox
@@ -30,7 +30,7 @@ cert_chain:
30
30
  42qdwEXvvkODZAD6KAIXPdmbMfBgPbcd+B/4eUA0PyKo+4dgL1NuqX4MPWToevIZ
31
31
  O8EKLF2X7NmC6FY1bOsSj/J8r1SOkx0rxgF+geRvY1P+hfNjDfxTsjU=
32
32
  -----END CERTIFICATE-----
33
- date: 2015-02-27 00:00:00.000000000 Z
33
+ date: 2015-03-05 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: awesome_print
metadata.gz.sig CHANGED
@@ -1,3 +1,3 @@
1
- �8P��2� �|���Bߴ�<}�N�^Y�\x���җ��L����*�ٞ@8�24`�a��@�yE9��*�Uũ��}�TI�
2
- ���fT
3
- �w���}{
1
+ p�-���6���"�L~�:0��^
2
+ �r���� ��~1����m��[g�⡊�{X�qc�OV�`�"���y#�9)W>�A�$g�� ��ӡ��� ��Q�ߜ�� sM���^���_î���h.ПhT��+h0�cd�R_r��Eٵ��PCl4m�E�r�c���{���Ϊ�t�CV��
3
+ OJs͂��ޖ����B�V�C�L\9�����V��'��'�� M����B�.��(��l2�ta�!�`S_�Q���e��