blob: 80c477cef71f09434e4691a5299922e48673150f [file] [log] [blame]
khenaidood948f772021-08-11 17:49:24 -04001package types
2
3import (
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
11type AuthorizationData []AuthorizationDataEntry
12
13// AuthorizationDataEntry implements RFC 4120 type: https://tools.ietf.org/html/rfc4120#section-5.2.6
14type 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
20type ADIfRelevant AuthorizationData
21
22// ADKDCIssued implements RFC 4120 type: https://tools.ietf.org/html/rfc4120#section-5.2.6.2
23type 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
31type 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
37type ADMandatoryForKDC AuthorizationData
38
39// Unmarshal bytes into the ADKDCIssued.
40func (a *ADKDCIssued) Unmarshal(b []byte) error {
41 _, err := asn1.Unmarshal(b, a)
42 return err
43}
44
45// Unmarshal bytes into the AuthorizationData.
46func (a *AuthorizationData) Unmarshal(b []byte) error {
47 _, err := asn1.Unmarshal(b, a)
48 return err
49}
50
51// Unmarshal bytes into the AuthorizationDataEntry.
52func (a *AuthorizationDataEntry) Unmarshal(b []byte) error {
53 _, err := asn1.Unmarshal(b, a)
54 return err
55}