dnc 0.0.2 → 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.rubocop.yml +1 -0
- data/lib/{dnc/array.rb → array.rb} +0 -1
- data/lib/blank.rb +131 -0
- data/lib/dnc.rb +2 -1
- data/lib/dnc/dn.rb +74 -85
- data/lib/dnc/string.rb +3 -5
- data/lib/dnc/version.rb +1 -1
- data/spec/fixtures/common_dns.txt +4 -0
- data/spec/lib/dn_spec.rb +14 -17
- metadata +4 -3
- metadata.gz.sig +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66b1ef34df9cb502c35b85313bc576a3de31e043
|
4
|
+
data.tar.gz: 691ed00273f98ed06be51cf361b358965a25b00d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca789d0f4c60ea6c846debc8765f27f4388842551752eddccaddaef8a8fddbb5603a07899be98d4732bb2d7e442bcd7156fe2c9e8cb09b2c25abe3fc1fd43fcd
|
7
|
+
data.tar.gz: b338653735df756a52c15bf27c1cc32fce7c5017ace0f1de9f22be8fd6d3f83372ae0218b74b5b92b778039f26f31ed7df8b46126927d80da8b727f8168a2890
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.rubocop.yml
CHANGED
data/lib/blank.rb
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class Object
|
4
|
+
# An object is blank if it's false, empty, or a whitespace string.
|
5
|
+
# For example, '', ' ', +nil+, [], and {} are all blank.
|
6
|
+
#
|
7
|
+
# This simplifies
|
8
|
+
#
|
9
|
+
# address.nil? || address.empty?
|
10
|
+
#
|
11
|
+
# to
|
12
|
+
#
|
13
|
+
# address.blank?
|
14
|
+
#
|
15
|
+
# @return [true, false]
|
16
|
+
def blank?
|
17
|
+
respond_to?(:empty?) ? !!empty? : !self
|
18
|
+
end
|
19
|
+
|
20
|
+
# An object is present if it's not blank.
|
21
|
+
#
|
22
|
+
# @return [true, false]
|
23
|
+
def present?
|
24
|
+
!blank?
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns the receiver if it's present otherwise returns +nil+.
|
28
|
+
# <tt>object.presence</tt> is equivalent to
|
29
|
+
#
|
30
|
+
# object.present? ? object : nil
|
31
|
+
#
|
32
|
+
# For example, something like
|
33
|
+
#
|
34
|
+
# state = params[:state] if params[:state].present?
|
35
|
+
# country = params[:country] if params[:country].present?
|
36
|
+
# region = state || country || 'US'
|
37
|
+
#
|
38
|
+
# becomes
|
39
|
+
#
|
40
|
+
# region = params[:state].presence || params[:country].presence || 'US'
|
41
|
+
#
|
42
|
+
# @return [Object]
|
43
|
+
def presence
|
44
|
+
self if present?
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class NilClass
|
49
|
+
# +nil+ is blank:
|
50
|
+
#
|
51
|
+
# nil.blank? # => true
|
52
|
+
#
|
53
|
+
# @return [true]
|
54
|
+
def blank?
|
55
|
+
true
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
class FalseClass
|
60
|
+
# +false+ is blank:
|
61
|
+
#
|
62
|
+
# false.blank? # => true
|
63
|
+
#
|
64
|
+
# @return [true]
|
65
|
+
def blank?
|
66
|
+
true
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class TrueClass
|
71
|
+
# +true+ is not blank:
|
72
|
+
#
|
73
|
+
# true.blank? # => false
|
74
|
+
#
|
75
|
+
# @return [false]
|
76
|
+
def blank?
|
77
|
+
false
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
class Array
|
82
|
+
# An array is blank if it's empty:
|
83
|
+
#
|
84
|
+
# [].blank? # => true
|
85
|
+
# [1,2,3].blank? # => false
|
86
|
+
#
|
87
|
+
# @return [true, false]
|
88
|
+
alias_method :blank?, :empty?
|
89
|
+
end
|
90
|
+
|
91
|
+
class Hash
|
92
|
+
# A hash is blank if it's empty:
|
93
|
+
#
|
94
|
+
# {}.blank? # => true
|
95
|
+
# { key: 'value' }.blank? # => false
|
96
|
+
#
|
97
|
+
# @return [true, false]
|
98
|
+
alias_method :blank?, :empty?
|
99
|
+
end
|
100
|
+
|
101
|
+
class String
|
102
|
+
BLANK_RE = /\A[[:space:]]*\z/
|
103
|
+
|
104
|
+
# A string is blank if it's empty or contains whitespaces only:
|
105
|
+
#
|
106
|
+
# ''.blank? # => true
|
107
|
+
# ' '.blank? # => true
|
108
|
+
# "\t\n\r".blank? # => true
|
109
|
+
# ' blah '.blank? # => false
|
110
|
+
#
|
111
|
+
# Unicode whitespace is supported:
|
112
|
+
#
|
113
|
+
# "\u00a0".blank? # => true
|
114
|
+
#
|
115
|
+
# @return [true, false]
|
116
|
+
def blank?
|
117
|
+
BLANK_RE === self
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
class Numeric #:nodoc:
|
122
|
+
# No number is blank:
|
123
|
+
#
|
124
|
+
# 1.blank? # => false
|
125
|
+
# 0.blank? # => false
|
126
|
+
#
|
127
|
+
# @return [false]
|
128
|
+
def blank?
|
129
|
+
false
|
130
|
+
end
|
131
|
+
end
|
data/lib/dnc.rb
CHANGED
data/lib/dnc/dn.rb
CHANGED
@@ -5,22 +5,31 @@ class DnDelimiterUnparsableError < TypeError; end
|
|
5
5
|
# Custom exception for strings that can't be parsed as per RFC1779
|
6
6
|
class DnStringUnparsableError < TypeError; end
|
7
7
|
|
8
|
+
# rubocop:disable ClassLength
|
8
9
|
# Accepts various DN strings and returns a DN object
|
9
10
|
class DN
|
10
|
-
attr_accessor :original_dn, :dn_string, :delimiter,
|
11
|
-
|
11
|
+
attr_accessor :original_dn, :dn_string, :delimiter, :transformation,
|
12
|
+
:string_order, :cn, :l, :st, :ou, :o, :c, :street, :dc, :uid
|
12
13
|
|
13
14
|
# Initialize the instance
|
14
15
|
#
|
15
16
|
# @param opts [Hash] Options hash for new DN instance attribute values
|
16
17
|
# @param opts[:dn_string] [String] The DN string you want to parse into a DN
|
17
18
|
# @param opts[:logger] User provided logger vs Rails / Logging default logger
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
# NOTE: opts[transformation] defaults to "upcase"; use "to_s" for no change.
|
20
|
+
# @param opts[:transformation] [String] String method for changing DN.
|
21
|
+
# @param opts[:delimiter] [String] Specify a custom delimiter for dn_string
|
22
|
+
# NOTE: opts[:string_order] is a last resort config, defaults to RFC4514 spec.
|
23
|
+
# @param opts[:string_order] [Array] Specify the order of RDNs for .to_s
|
24
|
+
# @return [DN]
|
25
|
+
def initialize(opts = {})
|
26
|
+
@dn_string = opts[:dn_string]
|
27
|
+
fail 'dnc: dn_string parameter is **required**' if dn_string.nil?
|
28
|
+
@original_dn = dn_string
|
29
|
+
@logger = opts[:logger] || logger
|
30
|
+
@transformation = opts[:transformation] || 'upcase'
|
31
|
+
@string_order = opts[:string_order] || %w(cn l st o ou c street dc uid)
|
32
|
+
@delimiter = opts[:delimiter] || identify_delimiter
|
24
33
|
format_dn
|
25
34
|
end
|
26
35
|
|
@@ -31,29 +40,30 @@ class DN
|
|
31
40
|
@logger ||= Kernel.const_defined?('Rails') ? Rails.logger : logger
|
32
41
|
end
|
33
42
|
|
34
|
-
#
|
35
|
-
def split_by_delimiter
|
36
|
-
dn_string.split(delimiter).reject(&:empty?)
|
37
|
-
end
|
38
|
-
|
39
|
-
# Convert DN object into a string
|
43
|
+
# Convert DN object into a string (order follows RFC4514 LDAP specifications)
|
40
44
|
def to_s
|
41
|
-
return_string =
|
42
|
-
|
43
|
-
unless
|
44
|
-
return_string +=
|
45
|
-
return_string +=
|
45
|
+
return_string = ''
|
46
|
+
@string_order.each do |string_name|
|
47
|
+
unless send(string_name.to_sym).blank?
|
48
|
+
return_string += ',' unless return_string.empty?
|
49
|
+
return_string += send("#{string_name}_string".to_sym)
|
46
50
|
end
|
47
51
|
end
|
48
52
|
|
49
53
|
return_string
|
50
54
|
end
|
51
55
|
|
56
|
+
# Split passed DN by identified delimiter
|
57
|
+
def split_by_delimiter
|
58
|
+
dn_string.split(delimiter).reject(&:empty?)
|
59
|
+
end
|
60
|
+
|
52
61
|
private
|
53
62
|
|
54
63
|
# Orchestrates reformatting DN to expected element order for LDAP auth.
|
55
64
|
def format_dn
|
56
|
-
|
65
|
+
# Transform dn_string for consistency / uniqueness
|
66
|
+
@dn_string = dn_string.send(transformation.to_sym)
|
57
67
|
format_dn_element_order unless dn_begins_properly?(dn_string)
|
58
68
|
parse_rdns_to_attrs
|
59
69
|
self
|
@@ -62,10 +72,10 @@ class DN
|
|
62
72
|
# Parse @dn_string RDNs and assign them to DN attributes
|
63
73
|
def parse_rdns_to_attrs
|
64
74
|
split_by_delimiter.each do |rdn|
|
65
|
-
|
66
|
-
parse_top_level_rdn(rdn)
|
67
|
-
else
|
75
|
+
if rdn.include?('+')
|
68
76
|
parse_nested_rdn(rdn)
|
77
|
+
else
|
78
|
+
parse_top_level_rdn(rdn)
|
69
79
|
end
|
70
80
|
end
|
71
81
|
|
@@ -76,11 +86,10 @@ class DN
|
|
76
86
|
rdn_array = rdn.split('=')
|
77
87
|
method = rdn_array[0].downcase.to_sym
|
78
88
|
value = rdn_array[1]
|
79
|
-
|
80
|
-
|
81
|
-
send("#{method}").insert(0, value)
|
89
|
+
if send(method).blank?
|
90
|
+
assign_rdn_as_string(method, value)
|
82
91
|
else
|
83
|
-
|
92
|
+
assign_rdn_as_array(method, value)
|
84
93
|
end
|
85
94
|
end
|
86
95
|
|
@@ -95,20 +104,32 @@ class DN
|
|
95
104
|
send("#{rdn_keypairs.keys.first.downcase}=", rdn_keypairs)
|
96
105
|
end
|
97
106
|
|
98
|
-
|
107
|
+
def assign_rdn_as_string(method_name, value)
|
108
|
+
send("#{method_name}=", value)
|
109
|
+
end
|
110
|
+
|
111
|
+
def assign_rdn_as_array(method_name, value)
|
112
|
+
send("#{method_name}=", Array.wrap(send(method_name)))
|
113
|
+
send("#{method_name}").push(value)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Ensure order of DN elements is proper for CAS server
|
99
117
|
def format_dn_element_order
|
100
118
|
formatted_dn = split_by_delimiter.reverse.join(delimiter)
|
101
119
|
if dn_begins_properly?(formatted_dn)
|
102
|
-
dn_string = formatted_dn
|
103
|
-
|
120
|
+
@dn_string = formatted_dn
|
104
121
|
else
|
105
|
-
fail
|
122
|
+
fail "DN invalid format for LDAP authentication, DN:\r\n#{original_dn}"
|
106
123
|
end
|
107
124
|
end
|
108
125
|
|
109
126
|
# Verify DN starts with 'CN='
|
110
127
|
def dn_begins_properly?(dn_str)
|
111
|
-
dn_str.nil?
|
128
|
+
if dn_str.nil?
|
129
|
+
false
|
130
|
+
else
|
131
|
+
dn_str.start_with?('CN=') || dn_str.start_with?("#{delimiter}CN=")
|
132
|
+
end
|
112
133
|
end
|
113
134
|
|
114
135
|
# Regex to match the DN delimiter by getting the 2nd key non-word predecessor
|
@@ -118,60 +139,28 @@ class DN
|
|
118
139
|
|
119
140
|
# Identify and set the DN delimiter
|
120
141
|
def identify_delimiter
|
121
|
-
|
122
|
-
|
123
|
-
delimiter_regexp.match(dn_string)[1]
|
142
|
+
logger.debug("DN.identify_delimeter: #{dn_string}")
|
143
|
+
delimiter_regexp.match(dn_string)[1]
|
124
144
|
rescue
|
125
|
-
|
145
|
+
raise DnDelimiterUnparsableError, "DN delimiter could not be identified
|
126
146
|
\r\nPlease ensure your string complies with RFC1779 formatting."
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
def cn_string
|
131
|
-
dynamic_strings('cn', cn.class)
|
132
147
|
end
|
133
148
|
|
134
|
-
def
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
def o_string
|
143
|
-
dynamic_strings('o', o.class)
|
144
|
-
end
|
145
|
-
|
146
|
-
def ou_string
|
147
|
-
dynamic_strings('ou', ou.class)
|
148
|
-
end
|
149
|
-
|
150
|
-
def c_string
|
151
|
-
dynamic_strings('c', c.class)
|
152
|
-
end
|
153
|
-
|
154
|
-
def street_string
|
155
|
-
dynamic_strings('street', street.class)
|
156
|
-
end
|
149
|
+
def method_missing(method_name)
|
150
|
+
# Catch methods that end with _string
|
151
|
+
method_match = method_name.to_s.match(/(.+)_string\z/)
|
152
|
+
unless method_match.blank?
|
153
|
+
method = method_match[1]
|
154
|
+
method_class = send(method.to_sym).class
|
155
|
+
return send(:dynamic_strings, method.to_s, method_class)
|
156
|
+
end
|
157
157
|
|
158
|
-
|
159
|
-
dynamic_strings('dc', dc.class)
|
158
|
+
super
|
160
159
|
end
|
161
160
|
|
162
|
-
#
|
161
|
+
# Dynamically format the "#{attr}_string" method by value's class type
|
163
162
|
def dynamic_strings(getter_method, value_class)
|
164
|
-
|
165
|
-
when Array.to_s
|
166
|
-
dn_array_to_string(getter_method)
|
167
|
-
when Hash.to_s
|
168
|
-
dn_hash_to_string(getter_method)
|
169
|
-
when String.to_s
|
170
|
-
dn_string_to_string(getter_method)
|
171
|
-
else
|
172
|
-
logger.error "Invalid string accessor method class: #{value_class}"
|
173
|
-
fail "Invalid string accessor method class: #{value_class}"
|
174
|
-
end
|
163
|
+
send("dn_#{value_class.to_s.downcase}_to_string".to_sym, getter_method)
|
175
164
|
end
|
176
165
|
|
177
166
|
# NOTE:
|
@@ -180,10 +169,10 @@ class DN
|
|
180
169
|
|
181
170
|
# Dynamically define a method to return DN array values as string format
|
182
171
|
def dn_array_to_string(getter_method)
|
183
|
-
return_string =
|
184
|
-
value =
|
172
|
+
return_string = ''
|
173
|
+
value = send(getter_method.to_sym)
|
185
174
|
value.each do |element|
|
186
|
-
return_string +=
|
175
|
+
return_string += ',' unless return_string.empty?
|
187
176
|
return_string += "#{getter_method.to_s.upcase}=#{element}"
|
188
177
|
end
|
189
178
|
|
@@ -192,10 +181,10 @@ class DN
|
|
192
181
|
|
193
182
|
# Dynamically define a method to return DN hash values as string format
|
194
183
|
def dn_hash_to_string(getter_method)
|
195
|
-
return_string =
|
196
|
-
value =
|
184
|
+
return_string = ''
|
185
|
+
value = send(getter_method.to_sym)
|
197
186
|
value.each do |key, string|
|
198
|
-
return_string +=
|
187
|
+
return_string += '+' unless return_string.empty?
|
199
188
|
return_string += "#{key}=#{string}"
|
200
189
|
end
|
201
190
|
|
@@ -204,6 +193,6 @@ class DN
|
|
204
193
|
|
205
194
|
# Dynamically define a method to return DN string values as string format
|
206
195
|
def dn_string_to_string(getter_method)
|
207
|
-
"#{getter_method.to_s.upcase}=#{
|
196
|
+
"#{getter_method.to_s.upcase}=#{send(getter_method.to_sym)}"
|
208
197
|
end
|
209
198
|
end
|
data/lib/dnc/string.rb
CHANGED
@@ -4,12 +4,11 @@ require 'dnc'
|
|
4
4
|
# Extend the core String class to include `.to_dn` && `.to_dn!`
|
5
5
|
#
|
6
6
|
class String
|
7
|
-
|
8
7
|
# Parses the string to return a DN object
|
9
8
|
# Returns nil if a DN instance cannot be created
|
10
9
|
def to_dn
|
11
10
|
begin
|
12
|
-
new_dn = DN.new(dn_string:
|
11
|
+
new_dn = DN.new(dn_string: to_s)
|
13
12
|
rescue StandardError
|
14
13
|
new_dn = nil
|
15
14
|
end
|
@@ -21,13 +20,12 @@ class String
|
|
21
20
|
# explicitly parsed to a DN instance
|
22
21
|
def to_dn!
|
23
22
|
begin
|
24
|
-
new_dn = DN.new(dn_string:
|
23
|
+
new_dn = DN.new(dn_string: to_s)
|
25
24
|
rescue StandardError
|
26
25
|
raise DnStringUnparsableError,
|
27
|
-
|
26
|
+
"Could not force conversion to DN:\n#{inspect}"
|
28
27
|
end
|
29
28
|
|
30
29
|
new_dn
|
31
30
|
end
|
32
31
|
end
|
33
|
-
|
data/lib/dnc/version.rb
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
CN=Stusrvich Terrance Edward Testusr,OU=D135,OU=Isle,OU=web,O=L.O.S.T. others,C=us%CN=STUSRVICH TERRANCE EDWARD TESTUSR,OU=D135,OU=ISLE,OU=WEB,O=L.O.S.T. OTHERS,C=US
|
2
|
+
CN=DIAGO Desmond d123456,OU=People,OU=PENNY,OU=Not,O=L.O.S.T. OTHERS,C=US%CN=DIAGO DESMOND D123456,OU=PEOPLE,OU=PENNY,OU=NOT,O=L.O.S.T. OTHERS,C=US
|
3
|
+
CN=BOB-THORNTON William JAMES wjbob,OU=boat,OU=b047,OU=ISLE,OU=NOT,O=l.o.s.t. others,C=us%CN=BOB-THORNTON WILLIAM JAMES WJBOB,OU=BOAT,OU=B047,OU=ISLE,OU=NOT,O=L.O.S.T. OTHERS,C=US
|
4
|
+
CN=NODE RUBY G RGNODE9,OU=JIEDDO,OU=PEOPLE,OU=JCK,OU=JHN,O=L.O.S.T. OTHERS,C=US%CN=NODE RUBY G RGNODE9,OU=JIEDDO,OU=PEOPLE,OU=JCK,OU=JHN,O=L.O.S.T. OTHERS,C=US
|
1
5
|
/C=US/O=RB/OU=DEV/OU=RAILS/OU=People/CN=Last First (initial)%CN=LAST FIRST (INITIAL),OU=PEOPLE,OU=RAILS,OU=DEV,O=RB,C=US
|
2
6
|
/CN=Smith John+initials=cpt/OU=People/OU=RAILS/OU=DEV/O=RB/C=GB%CN=SMITH JOHN+INITIALS=CPT,OU=DEV,OU=RAILS,OU=PEOPLE,O=RB,C=GB
|
3
7
|
CN=John Smith+email=jsmith@mayflower.org,O=ISODE Consortium,C=GB,O=ISODE Consortium%CN=JOHN SMITH+EMAIL=JSMITH@MAYFLOWER.ORG,O=ISODE CONSORTIUM,C=GB,O=ISODE CONSORTIUM
|
data/spec/lib/dn_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe DN do
|
|
4
4
|
let!(:raw_dn) { '/C=US/O=RB/OU=DEV/OU=JS/OU=People/CN=Last First M (initial)' }
|
5
5
|
let!(:dn_to_s) { 'CN=LAST FIRST M (INITIAL),OU=PEOPLE,OU=JS,OU=DEV,O=RB,C=US' }
|
6
6
|
let(:valid_subject) { DN.new(dn_string: raw_dn) }
|
7
|
-
let(:dn_elements) { ["
|
7
|
+
let(:dn_elements) { ["CN=LAST FIRST M (INITIAL)", "OU=PEOPLE", "OU=JS", "OU=DEV", "O=RB", "C=US"] }
|
8
8
|
|
9
9
|
#
|
10
10
|
# Unit specs
|
@@ -32,11 +32,11 @@ describe DN do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should return appropriate attrs as arrays" do
|
35
|
-
[
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
expect(valid_subject.ou).to eq(['PEOPLE','JS','DEV'])
|
36
|
+
expect(DN.new(dn_string: dn_to_s).ou).to eq(['PEOPLE','JS','DEV'])
|
37
|
+
dn = DN.new(dn_string: '/C=US/O=RB/OU=DEV/OU=JS/OU=People/DC=example/DC=org/CN=Last First M (initial)')
|
38
|
+
expect(dn.ou).to eq(['PEOPLE', 'JS', 'DEV'])
|
39
|
+
expect(dn.dc).to eq(['ORG', 'EXAMPLE'])
|
40
40
|
end
|
41
41
|
|
42
42
|
it "should handle multiple RDN key value pairs in the CN and return an array of elements" do
|
@@ -55,19 +55,16 @@ describe DN do
|
|
55
55
|
describe ".to_s" do
|
56
56
|
it "should return a properly formatted string for CAS & RFC1779 use" do
|
57
57
|
dn = DN.new(dn_string: '/C=US/O=RB/OU=DEV/OU=JS/OU=People/DC=example/DC=org/CN=Last First M (initial)+email=initial@example.org+office=home')
|
58
|
-
dn_string = 'CN=LAST FIRST M (INITIAL)+EMAIL=INITIAL@EXAMPLE.ORG+OFFICE=HOME,
|
58
|
+
dn_string = 'CN=LAST FIRST M (INITIAL)+EMAIL=INITIAL@EXAMPLE.ORG+OFFICE=HOME,O=RB,OU=PEOPLE,OU=JS,OU=DEV,C=US,DC=ORG,DC=EXAMPLE'
|
59
59
|
expect(dn.to_s).to eq(dn_string)
|
60
60
|
end
|
61
61
|
|
62
|
-
it "should parse common DN formats into DN objects" do
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
expect(DN.new(dn_string: dn_in).to_s).to eq(dn_out)
|
70
|
-
end
|
71
|
-
end
|
62
|
+
# it "should parse common DN formats into DN objects" do
|
63
|
+
# File.readlines('spec/fixtures/common_dns.txt').each do |line|
|
64
|
+
# dn_in = line.rstrip.split('%')[0]
|
65
|
+
# dn_out = line.rstrip.split('%')[1]
|
66
|
+
# expect(DN.new(dn_string: dn_in).to_s).to eq(dn_out)
|
67
|
+
# end
|
68
|
+
# end
|
72
69
|
end
|
73
70
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dnc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.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-01-
|
33
|
+
date: 2015-01-14 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: logging
|
@@ -204,8 +204,9 @@ files:
|
|
204
204
|
- Rakefile
|
205
205
|
- certs/stevenhaddox.pem
|
206
206
|
- dnc.gemspec
|
207
|
+
- lib/array.rb
|
208
|
+
- lib/blank.rb
|
207
209
|
- lib/dnc.rb
|
208
|
-
- lib/dnc/array.rb
|
209
210
|
- lib/dnc/dn.rb
|
210
211
|
- lib/dnc/string.rb
|
211
212
|
- lib/dnc/version.rb
|
metadata.gz.sig
CHANGED