blob: 612979e4ed44bd42820b887688af136c6971535d [file] [log] [blame]
Scott Bakered4efab2020-01-13 19:12:25 -08001package 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// ClientClaimsInfo implements https://msdn.microsoft.com/en-us/library/hh536365.aspx
14type ClientClaimsInfo struct {
15 ClaimsSetMetadata mstypes.ClaimsSetMetadata
16 ClaimsSet mstypes.ClaimsSet
17}
18
19// Unmarshal bytes into the ClientClaimsInfo struct
20func (k *ClientClaimsInfo) 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}