Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [diff] [blame] | 1 | package pac |
| 2 | |
| 3 | import ( |
| 4 | "bytes" |
| 5 | "fmt" |
| 6 | |
| 7 | "gopkg.in/jcmturner/rpc.v1/mstypes" |
| 8 | "gopkg.in/jcmturner/rpc.v1/ndr" |
| 9 | ) |
| 10 | |
| 11 | // Claims reference: https://msdn.microsoft.com/en-us/library/hh553895.aspx |
| 12 | |
| 13 | // DeviceClaimsInfo implements https://msdn.microsoft.com/en-us/library/hh554226.aspx |
| 14 | type DeviceClaimsInfo struct { |
| 15 | ClaimsSetMetadata mstypes.ClaimsSetMetadata |
| 16 | ClaimsSet mstypes.ClaimsSet |
| 17 | } |
| 18 | |
| 19 | // Unmarshal bytes into the ClientClaimsInfo struct |
| 20 | func (k *DeviceClaimsInfo) Unmarshal(b []byte) (err error) { |
| 21 | dec := ndr.NewDecoder(bytes.NewReader(b)) |
| 22 | m := new(mstypes.ClaimsSetMetadata) |
| 23 | err = dec.Decode(m) |
| 24 | if err != nil { |
| 25 | err = fmt.Errorf("error unmarshaling ClientClaimsInfo ClaimsSetMetadata: %v", err) |
| 26 | } |
| 27 | k.ClaimsSetMetadata = *m |
| 28 | k.ClaimsSet, err = k.ClaimsSetMetadata.ClaimsSet() |
| 29 | if err != nil { |
| 30 | err = fmt.Errorf("error unmarshaling ClientClaimsInfo ClaimsSet: %v", err) |
| 31 | } |
| 32 | return |
| 33 | } |