// FormatProcessSubprin produces a string that represents a subprincipal with // the given ID and hash. func FormatProcessSubprin(id uint, hash []byte) auth.SubPrin { var args []auth.Term if id != 0 { args = append(args, auth.Int(id)) } args = append(args, auth.Bytes(hash)) return auth.SubPrin{auth.PrinExt{Name: "Program", Arg: args}} }
// FormatDockerSubprin produces a string that represents a subprincipal with the // given ID and hash. func FormatDockerSubprin(id uint, hash []byte) auth.SubPrin { var args []auth.Term if id != 0 { args = append(args, auth.Int(id)) } args = append(args, auth.Bytes(hash)) return auth.SubPrin{auth.PrinExt{Name: "Container", Arg: args}} }
// FormatCoreOSLinuxhostSubprin produces a string that represents a subprincipal with the // given ID and hash. func FormatCoreOSLinuxhostSubprin(id uint, hash []byte) auth.SubPrin { var args []auth.Term if id != 0 { args = append(args, auth.Int(id)) } args = append(args, auth.Bytes(hash)) return auth.SubPrin{auth.PrinExt{Name: "CoreOS", Arg: args}} }
func TestVerifyDirectiveWithBadPredicate_badTerms(t *testing.T) { params := Params{ CanRead: auth.Pred{ Name: ReadPredicate, Arg: []auth.Term{auth.Int(0), auth.Str(""), auth.Str("a")}, // TODO: Note make([]auth.Term, 3) above causes NPE in auth.Marshal(thisPred) // Is that a bug? }, } expectError(¶ms, t) }