forked from jcmturner/gokrb5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client_claims.go
34 lines (29 loc) · 904 Bytes
/
client_claims.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package pac
import (
"bytes"
"fmt"
"gopkg.in/jcmturner/rpc.v1/mstypes"
"gopkg.in/jcmturner/rpc.v1/ndr"
)
// Claims reference: https://msdn.microsoft.com/en-us/library/hh553895.aspx
// ClientClaimsInfo implements https://msdn.microsoft.com/en-us/library/hh536365.aspx
type ClientClaimsInfo struct {
ClaimsSetMetadata mstypes.ClaimsSetMetadata
ClaimsSet mstypes.ClaimsSet
}
// Unmarshal bytes into the ClientClaimsInfo struct
func (k *ClientClaimsInfo) Unmarshal(b []byte) (err error) {
dec := ndr.NewDecoder(bytes.NewReader(b))
m := new(mstypes.ClaimsSetMetadata)
err = dec.Decode(m)
if err != nil {
err = fmt.Errorf("error unmarshaling ClientClaimsInfo ClaimsSetMetadata: %v", err)
return
}
k.ClaimsSetMetadata = *m
k.ClaimsSet, err = k.ClaimsSetMetadata.ClaimsSet()
if err != nil {
err = fmt.Errorf("error unmarshaling ClientClaimsInfo ClaimsSet: %v", err)
}
return
}