blob: c2299bb082b970630a018a5dffd336e7dbb7097f [file] [log] [blame]
Scott Baker2c1c4822019-10-16 11:02:41 -07001package pac
2
3import (
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
14type DeviceClaimsInfo struct {
15 ClaimsSetMetadata mstypes.ClaimsSetMetadata
16 ClaimsSet mstypes.ClaimsSet
17}
18
19// Unmarshal bytes into the ClientClaimsInfo struct
20func (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}