dnc 0.1 → 0.1.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.travis.yml +0 -1
- data/README.md +57 -14
- data/lib/dnc/version.rb +1 -1
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a396eb196c442711ef2e116e7bc1a999ae5ccceb
|
4
|
+
data.tar.gz: d1bfc2c1f2a9ba9b76ae828e5d5d1c43751bcc71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d4f4c56864855d24f42fd8cc10ebe10f0a800e4645dfec23dfc3bb3c397ede886b49f6ec096b086a34567a60318f07711f7c77516cab87b11db175923405d76
|
7
|
+
data.tar.gz: 006cab85e2b1e56f9e2eddd4a2ebf8831488f0b468464c8ce37de6766e67ba768fb9086684f71723fd55c7ec9d68299f5d5d0c016f657511fca2db8b4800b0cc
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,39 +1,82 @@
|
|
1
1
|
# Distinguished Name (DN) Converter
|
2
2
|
|
3
|
-
|
3
|
+
Convert multiple X509 DN strings into a consistent format.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
|
-
|
10
|
-
gem 'dnc'
|
11
|
-
```
|
9
|
+
gem 'dnc'
|
12
10
|
|
13
11
|
And then execute:
|
14
12
|
|
15
13
|
$ bundle
|
16
14
|
|
17
|
-
Or install it yourself
|
15
|
+
Or install it yourself with:
|
18
16
|
|
19
17
|
$ gem install dnc
|
20
18
|
|
21
19
|
## Usage
|
22
20
|
|
21
|
+
To create a DN instance:
|
22
|
+
|
23
23
|
```ruby
|
24
24
|
require 'dnc'
|
25
|
-
|
26
|
-
dn = DN.new(dn_string: dn_string)
|
25
|
+
dn = DN.new(dn_string: '/C=US/OU=string/O=DN/CN=Some Valid')
|
27
26
|
# Or:
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
dn = '/C=US/OU=string/O=DN/CN=Some Valid'.to_dn
|
28
|
+
dn = '/C=US/OU=string/O=DN/CN=Some Valid'.to_dn!
|
29
|
+
```
|
30
|
+
|
31
|
+
To return a consistently formatted string:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
dn.to_s
|
35
|
+
#=> 'CN=SOME VALID,O=DN,OU=STRING,C=US'
|
36
|
+
```
|
37
|
+
|
38
|
+
This is what a basic DN object looks like:
|
39
|
+
|
40
|
+
```yaml
|
41
|
+
puts dn.to_yaml
|
42
|
+
#=>
|
43
|
+
--- !ruby/object:DN
|
44
|
+
dn_string: CN=SOME VALID/O=DN/OU=STRING/C=US
|
45
|
+
original_dn: "/C=US/OU=string/O=DN/CN=Some Valid"
|
46
|
+
logger: !ruby/object:Logging::Logger
|
47
|
+
[... snipped ...]
|
48
|
+
transformation: upcase
|
49
|
+
delimiter: "/"
|
50
|
+
cn: SOME VALID
|
51
|
+
o: DN
|
52
|
+
ou: STRING
|
53
|
+
c: US
|
54
|
+
string_order:
|
55
|
+
- cn
|
56
|
+
- l
|
57
|
+
- st
|
58
|
+
- o
|
59
|
+
- ou
|
60
|
+
- c
|
61
|
+
- street
|
62
|
+
- dc
|
63
|
+
- uid
|
31
64
|
```
|
32
65
|
|
66
|
+
There are multiple parameters you can pass in to modify the DN's formatting:
|
67
|
+
|
68
|
+
* `dn_string`: **REQUIRED** The DN string you want to parse into a DN object.
|
69
|
+
* `transformation`: `upcase`, `downcase`, `to_s` (or any valid String method).
|
70
|
+
* `delimiter`: Custom delimiter, DN auto detects if possible, but this forces it.
|
71
|
+
* `string_order`: DNC returns RDN elements as per LDAP specs ([RFC4514](http://www.rfc-editor.org/rfc/rfc4514.txt)), but to customize it you can send an array (of strings) to sort your `.to_s` results.
|
72
|
+
The default order is: `%w(cn l st o ou c street dc uid)`
|
73
|
+
* `logger`: Custom logger, defaults to Rails logger or Logging gem logger.
|
74
|
+
|
33
75
|
## Contributing
|
34
76
|
|
35
77
|
1. Fork it ( https://github.com/[my-github-username]/dnc/fork )
|
36
|
-
2.
|
37
|
-
3.
|
38
|
-
4.
|
39
|
-
5.
|
78
|
+
2. Add specs and make them pass (see 3)
|
79
|
+
3. Create your feature branch (`git checkout -b my-new-feature`)
|
80
|
+
4. Commit your changes (`git commit -am 'Add some feature'`)
|
81
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
82
|
+
6. Create a new Pull Request
|
data/lib/dnc/version.rb
CHANGED
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|