shib-rack 0.1.0 → 0.2.0

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: 855ed5c8d4eec25c07f99b235be9b94eba1153c7
4
- data.tar.gz: ffe393cfb960a090997ee82895f9a58f57d11c4f
3
+ metadata.gz: f82a33214cf9c9f29eab19c5db443aff50a083ed
4
+ data.tar.gz: 6234a4871c79daaeb50f7aec9fbaa2efd0c03b14
5
5
  SHA512:
6
- metadata.gz: 8004fe06ab2146f4629561447145afb655c579d4654d982f10ee6adb522c413931b910d90403663987c2896da4d4aac2f1fd54d6902d03156f64e33f3b6ff7aa
7
- data.tar.gz: f4201a06e3481fdd85e85661fa9e655def304905a9eda10ed412989fe0084a195c8842ac85f1b1696494d75c3c554285fcb7fbbdd61f0b49400c28dc377e0688
6
+ metadata.gz: 3f1b163facbc8a910823bb7aa88a41677c2733fa420590df2bef0d6bd44d958ece35ebb3acce5d684b1a08e5a33fb35cff3b077669595cbfa47710eeb4cf1ee5
7
+ data.tar.gz: fdc175e4432e7526587ec60113743f0c87682e056b68e3f253eb4944ffc85d49ef07b075a14e0e1d5be30c747cf2ad6d238b931dd78f6df50be51c129a1427e9
@@ -16,7 +16,7 @@ module ShibRack
16
16
 
17
17
  def map_multi_value(**mappings)
18
18
  mappings.each do |attr, header|
19
- mapper = ->(env) { env[header].split(';') }
19
+ mapper = ->(env) { parse_multi_value(env[header]) }
20
20
  add_attribute_mapping(attr, mapper)
21
21
  end
22
22
  end
@@ -25,6 +25,10 @@ module ShibRack
25
25
  raise "Conflicting mapping for `#{attr}`" if attribute_mappings[attr]
26
26
  attribute_mappings[attr] = mapper
27
27
  end
28
+
29
+ def parse_multi_value(value)
30
+ value.split(/(?<!\\);/).map { |x| x.gsub('\;', ';') }
31
+ end
28
32
  end
29
33
 
30
34
  def self.included(base)
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'cgi'
4
+ require 'uri'
4
5
 
5
6
  module ShibRack
6
7
  # Handler for authenticating to an application in development mode, using
@@ -45,11 +46,23 @@ module ShibRack
45
46
  st, = params['identity']
46
47
  identity = st && DevelopmentHandler.resolve_identity(st)
47
48
 
48
- return super(env.merge(identity)) if identity
49
+ if identity
50
+ restore_original_query(env)
51
+ return super(env.merge(identity))
52
+ end
49
53
 
54
+ env['rack.session']['original_params'] = params
50
55
  [302, { 'Location' => "#{env['SCRIPT_NAME']}/development" }, []]
51
56
  end
52
57
 
58
+ def restore_original_query(env)
59
+ original_params = env['rack.session']['original_params']
60
+ return unless original_params
61
+
62
+ env['QUERY_STRING'] = URI.encode_www_form(original_params)
63
+ env['rack.session']['original_params'] = nil
64
+ end
65
+
53
66
  def development
54
67
  [
55
68
  200,
@@ -42,7 +42,7 @@ module ShibRack
42
42
 
43
43
  def constantize(klass_name)
44
44
  return nil if klass_name.nil?
45
- klass_name.split('::').reduce(Kernel) { |a, e| a.const_get(e) }
45
+ klass_name.split('::').reduce(Kernel) { |acc, elem| acc.const_get(elem) }
46
46
  end
47
47
 
48
48
  def receiver
@@ -3,7 +3,8 @@
3
3
  # edited to our format. All data is fictional and any similarity to real
4
4
  # identities is purely coincidental.
5
5
  identities:
6
- - targeted_id: https://idp.ernser.example.edu/idp/shibboleth!https://sp.example.edu/shibboleth!17865674-60c1-4202-aef9-21d4e66338d6
6
+ - persistent_id: https://idp.ernser.example.edu/idp/shibboleth!https://sp.example.edu/shibboleth!17865674-60c1-4202-aef9-21d4e66338d6
7
+ targeted_id: https://idp.ernser.example.edu/idp/shibboleth!https://sp.example.edu/shibboleth!17865674-60c1-4202-aef9-21d4e66338d6
7
8
  auedupersonsharedtoken: CZa_1pvgsbWD_IzNsAR7d7jaGcs
8
9
  displayname: Jefferey Kohler
9
10
  cn: Jefferey Kohler
@@ -15,7 +16,7 @@ identities:
15
16
  edupersonaffiliation: staff;member
16
17
  edupersonscopedaffiliation: staff@ernser.example.edu;member@ernser.example.edu
17
18
 
18
- - targeted_id: https://login.schneidermoen.example.edu/idp/shibboleth!https://sp.example.edu/shibboleth!a4ee2cb2-d764-4e1c-90f2-c6756b83d538
19
+ - persistent_id: https://login.schneidermoen.example.edu/idp/shibboleth!https://sp.example.edu/shibboleth!a4ee2cb2-d764-4e1c-90f2-c6756b83d538
19
20
  auedupersonsharedtoken: iNrgu8iDNLu2V_WT7OxnwKs1EBs
20
21
  displayname: Winifred Cummings IV
21
22
  cn: Winifred Cummings
@@ -39,7 +40,19 @@ identities:
39
40
  edupersonaffiliation: student;member
40
41
  edupersonscopedaffiliation: student@fritsch.example.edu;member@fritsch.example.edu
41
42
 
42
- - targeted_id: https://idp.westmarks.example.edu/idp/shibboleth!https://sp.example.edu/shibboleth!d2949a7a-0920-427f-a98e-846c4261c737
43
+ - auedupersonsharedtoken: a07fhxNyDIEa4DNYBTD1Bc3rTcz
44
+ displayname: Reginald Moneymaker
45
+ cn: Reginald Moneymaker
46
+ principalname: reg@synergy.example.edu
47
+ mail: reginald.moneymaker+label@example.edu
48
+ o: Synergy University
49
+ homeorganization: synergy.example.edu
50
+ homeorganizationtype: urn:mace:terena.org:schac:homeOrganizationType:au:university
51
+ edupersonaffiliation: student;member
52
+ edupersonscopedaffiliation: student@synergy.example.edu;member@synergy.example.edu
53
+
54
+ - persistent_id: https://idp.westmarks.example.edu/idp/shibboleth!https://sp.example.edu/shibboleth!d2949a7a-0920-427f-a98e-846c4261c737
55
+ targeted_id: https://idp.westmarks.example.edu/idp/shibboleth!https://sp.example.edu/shibboleth!d2949a7a-0920-427f-a98e-846c4261c737
43
56
  auedupersonsharedtoken: GBxa6l23yK5m6-jmPcoBJLWzg5w
44
57
  displayname: Lüra Vån Ernser V
45
58
  cn: Lüra VånErnser
@@ -52,6 +65,7 @@ identities:
52
65
  edupersonscopedaffiliation: staff@westmarks.example.edu;member@westmarks.example.edu
53
66
 
54
67
  - targeted_id: https://idp.stroa.example.ac.ru/idp/shibboleth!https://sp.example.edu/shibboleth!JnNdHrBp8qYrHYM8dnXrPdV52whAHcc6bpmlsvw=
68
+ persistent_id: https://idp.stroa.example.ac.ru/idp/shibboleth!https://sp.example.edu/shibboleth!JnNdHrBp8qYrHYM8dnXrPdV52whAHcc6bpmlsvw=
55
69
  auedupersonsharedtoken: weR_sI_2huUSq_2bGOkd1sMNZ9I
56
70
  displayname: Константинова Арина Данииловна
57
71
  cn: Константинова АринаДанииловна
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ShibRack
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shib-rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun Mangelsdorf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-27 00:00:00.000000000 Z
11
+ date: 2016-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -240,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
240
240
  version: '0'
241
241
  requirements: []
242
242
  rubyforge_project:
243
- rubygems_version: 2.5.1
243
+ rubygems_version: 2.6.8
244
244
  signing_key:
245
245
  specification_version: 4
246
246
  summary: Rack middleware for Shibboleth SP authentication