AuthorizationData.go 1.8 KB

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