khenaidoo | 2672188 | 2021-08-11 17:42:52 -0400 | [diff] [blame] | 1 | package types |
| 2 | |
| 3 | import ( |
| 4 | "github.com/jcmturner/gofork/encoding/asn1" |
| 5 | ) |
| 6 | |
| 7 | // Reference: https://www.ietf.org/rfc/rfc4120.txt |
| 8 | // Section: 5.2.6 |
| 9 | |
| 10 | // AuthorizationData implements RFC 4120 type: https://tools.ietf.org/html/rfc4120#section-5.2.6 |
| 11 | type AuthorizationData []AuthorizationDataEntry |
| 12 | |
| 13 | // AuthorizationDataEntry implements RFC 4120 type: https://tools.ietf.org/html/rfc4120#section-5.2.6 |
| 14 | type AuthorizationDataEntry struct { |
| 15 | ADType int32 `asn1:"explicit,tag:0"` |
| 16 | ADData []byte `asn1:"explicit,tag:1"` |
| 17 | } |
| 18 | |
| 19 | // ADIfRelevant implements RFC 4120 type: https://tools.ietf.org/html/rfc4120#section-5.2.6.1 |
| 20 | type ADIfRelevant AuthorizationData |
| 21 | |
| 22 | // ADKDCIssued implements RFC 4120 type: https://tools.ietf.org/html/rfc4120#section-5.2.6.2 |
| 23 | type ADKDCIssued struct { |
| 24 | ADChecksum Checksum `asn1:"explicit,tag:0"` |
| 25 | IRealm string `asn1:"optional,generalstring,explicit,tag:1"` |
| 26 | Isname PrincipalName `asn1:"optional,explicit,tag:2"` |
| 27 | Elements AuthorizationData `asn1:"explicit,tag:3"` |
| 28 | } |
| 29 | |
| 30 | // ADAndOr implements RFC 4120 type: https://tools.ietf.org/html/rfc4120#section-5.2.6.3 |
| 31 | type ADAndOr struct { |
| 32 | ConditionCount int32 `asn1:"explicit,tag:0"` |
| 33 | Elements AuthorizationData `asn1:"explicit,tag:1"` |
| 34 | } |
| 35 | |
| 36 | // ADMandatoryForKDC implements RFC 4120 type: https://tools.ietf.org/html/rfc4120#section-5.2.6.4 |
| 37 | type ADMandatoryForKDC AuthorizationData |
| 38 | |
| 39 | // Unmarshal bytes into the ADKDCIssued. |
| 40 | func (a *ADKDCIssued) Unmarshal(b []byte) error { |
| 41 | _, err := asn1.Unmarshal(b, a) |
| 42 | return err |
| 43 | } |
| 44 | |
| 45 | // Unmarshal bytes into the AuthorizationData. |
| 46 | func (a *AuthorizationData) Unmarshal(b []byte) error { |
| 47 | _, err := asn1.Unmarshal(b, a) |
| 48 | return err |
| 49 | } |
| 50 | |
| 51 | // Unmarshal bytes into the AuthorizationDataEntry. |
| 52 | func (a *AuthorizationDataEntry) Unmarshal(b []byte) error { |
| 53 | _, err := asn1.Unmarshal(b, a) |
| 54 | return err |
| 55 | } |