Abhilash S.L | 3b49463 | 2019-07-16 15:51:09 +0530 | [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 | // ClientClaimsInfo implements https://msdn.microsoft.com/en-us/library/hh536365.aspx |
| 14 | type ClientClaimsInfo struct { |
| 15 | ClaimsSetMetadata mstypes.ClaimsSetMetadata |
| 16 | ClaimsSet mstypes.ClaimsSet |
| 17 | } |
| 18 | |
| 19 | // Unmarshal bytes into the ClientClaimsInfo struct |
| 20 | func (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 | } |