forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
messageldap.go
89 lines (72 loc) · 2.36 KB
/
messageldap.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package ldapserver
// OCTETSTRING ASN.1 types
type OCTETSTRING string
// LDAPOID is a notational convenience to indicate that the
// permitted value of this string is a (UTF-8 encoded) dotted-decimal
// representation of an OBJECT IDENTIFIER. Although an LDAPOID is
type LDAPOID string
// LDAPDN is defined to be the representation of a Distinguished Name
// (DN) after encoding according to the specification
type LDAPDN string
// respectively, and have the same single octet UTF-8 encoding. Other
// Unicode characters have a multiple octet UTF-8 encoding.
type LDAPString string
//
// AttributeDescription ::= LDAPString
// -- Constrained to <attributedescription>
// -- [RFC4512]
type AttributeDescription LDAPString
// AttributeValue ::= OCTET STRING
type AttributeValue OCTETSTRING
//
// PartialAttribute ::= SEQUENCE {
// type AttributeDescription,
// vals SET OF value AttributeValue }
type PartialAttribute struct {
type_ AttributeDescription
vals []AttributeValue
}
func (p *PartialAttribute) GetDescription() AttributeDescription {
return p.type_
}
func (p *PartialAttribute) GetValues() []AttributeValue {
return p.vals
}
//
// PartialAttributeList ::= SEQUENCE OF
// partialAttribute PartialAttribute
type PartialAttributeList []PartialAttribute
func (l *PartialAttributeList) add(p PartialAttribute) {
*l = append(*l, p)
}
//
// Attribute ::= PartialAttribute(WITH COMPONENTS {
// ...,
// vals (SIZE(1..MAX))})
type Attribute PartialAttribute
//
// AttributeList ::= SEQUENCE OF attribute Attribute
type AttributeList []Attribute
func (p *Attribute) GetDescription() AttributeDescription {
return p.type_
}
func (p *Attribute) GetValues() []AttributeValue {
return p.vals
}
//
// AssertionValue ::= OCTET STRING
type AssertionValue OCTETSTRING
//
// AttributeValueAssertion ::= SEQUENCE {
// attributeDesc AttributeDescription,
// assertionValue AssertionValue }
type AttributeValueAssertion struct {
attributeDesc AttributeDescription
assertionValue AssertionValue
}
func (a *AttributeValueAssertion) GetName() string {
return string(a.attributeDesc)
}
func (a *AttributeValueAssertion) GetValue() string {
return string(a.assertionValue)
}