// PushFirstPartyChecker returns a checker that first // uses c0 to check caveats, and falls back to using c1 // if c0 returns bakery.ErrCaveatNotRecognized. func PushFirstPartyChecker(c0, c1 bakery.FirstPartyChecker) bakery.FirstPartyChecker { f := func(caveat string) error { err := c0.CheckFirstPartyCaveat(caveat) if _, ok := err.(*bakery.CaveatNotRecognizedError); ok { err = c1.CheckFirstPartyCaveat(caveat) } return err } return bakery.FirstPartyCheckerFunc(f) }
func FirstParty(condition string) bakery.Caveat { return bakery.Caveat{ Condition: condition, } } func ThirdParty(location, condition string) bakery.Caveat { return bakery.Caveat{ Location: location, Condition: condition, } } var Std = Map{ "time-before": bakery.FirstPartyCheckerFunc(timeBefore), } func TimeBefore(t time.Time) bakery.Caveat { return bakery.Caveat{ Condition: "time-before " + t.Format(time.RFC3339), } } func timeBefore(cav string) error { _, timeStr, err := ParseCaveat(cav) if err != nil { return err } t, err := time.Parse(time.RFC3339, timeStr) if err != nil {