keycard 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/keycard.gemspec +0 -1
- data/lib/keycard/request/attributes.rb +32 -0
- data/lib/keycard/request/cosign_attributes.rb +2 -2
- data/lib/keycard/request/direct_attributes.rb +2 -2
- data/lib/keycard/request/proxied_attributes.rb +2 -2
- data/lib/keycard/request/shibboleth_attributes.rb +0 -10
- data/lib/keycard/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 289f06e8e7d3002eba8c6aa13bedf6be9fd2cd643f2923ce8cb5185aeaec6fda
|
4
|
+
data.tar.gz: 885e1c86b158ff4778764ea0d2a5ee6bd18ff133e811af47032b42b7a56f0e24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c510e8be9b90985c08d54c07489368b14911c28d595abe51748acea4ec9f2b5914a06c3425d97afc7e9eeae18c8a7a02b1ca8a3850bc0795f88fb897918b384
|
7
|
+
data.tar.gz: d60d7e51da879687dd570c26382947a619f9978309de7cb797bde095e11043e71c28783e85847f22c12beff652b685db8b0dcdeb55b715197ea502fb0f6c7d4f
|
data/keycard.gemspec
CHANGED
@@ -88,6 +88,38 @@ module Keycard::Request
|
|
88
88
|
|
89
89
|
private
|
90
90
|
|
91
|
+
# Retrieve the value from the request's environment for a given key.
|
92
|
+
#
|
93
|
+
# This will trim whitespace and yield nil for empty values or those with
|
94
|
+
# the special value of '(null)'. Use {#safe} if you always want a string.
|
95
|
+
#
|
96
|
+
# @return [String|nil] value for the key, filtered and trimmed to nil
|
97
|
+
def get(key)
|
98
|
+
scrub request.env[key]
|
99
|
+
end
|
100
|
+
|
101
|
+
# Retrieve a guaranteed string value from the request's environment for a
|
102
|
+
# given key.
|
103
|
+
#
|
104
|
+
# This has the same behavior as {#get}, except that it will coalesce
|
105
|
+
# missing values to an empty string, convenient if you need to do string
|
106
|
+
# operations like splitting the value.
|
107
|
+
def safe(key)
|
108
|
+
get(key) || ''
|
109
|
+
end
|
110
|
+
|
111
|
+
# Scrub a value to remove whitespace, filter the special '(null)' value,
|
112
|
+
# and translate resulting empty strings to nil.
|
113
|
+
def scrub(value)
|
114
|
+
str = (value || '').strip
|
115
|
+
case str
|
116
|
+
when nil, '(null)', ''
|
117
|
+
nil
|
118
|
+
else
|
119
|
+
str
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
91
123
|
attr_reader :finders
|
92
124
|
attr_reader :request
|
93
125
|
end
|
@@ -15,7 +15,7 @@ module Keycard::Request
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def user_pid
|
18
|
-
|
18
|
+
get 'HTTP_X_REMOTE_USER'
|
19
19
|
end
|
20
20
|
|
21
21
|
def user_eid
|
@@ -23,7 +23,7 @@ module Keycard::Request
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def client_ip
|
26
|
-
(
|
26
|
+
safe('HTTP_X_FORWARDED_FOR').split(',').first
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -14,7 +14,7 @@ module Keycard::Request
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def user_pid
|
17
|
-
|
17
|
+
get 'REMOTE_USER'
|
18
18
|
end
|
19
19
|
|
20
20
|
def user_eid
|
@@ -22,7 +22,7 @@ module Keycard::Request
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def client_ip
|
25
|
-
(
|
25
|
+
safe('REMOTE_ADDR').split(',').first
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -18,7 +18,7 @@ module Keycard::Request
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def user_pid
|
21
|
-
|
21
|
+
get 'HTTP_X_REMOTE_USER'
|
22
22
|
end
|
23
23
|
|
24
24
|
def user_eid
|
@@ -26,7 +26,7 @@ module Keycard::Request
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def client_ip
|
29
|
-
(
|
29
|
+
safe('HTTP_X_FORWARDED_FOR').split(',').first
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
data/lib/keycard/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: keycard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noah Botimer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-07-
|
12
|
+
date: 2018-07-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sequel
|