Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bakery: remove Request type. #12

Merged
merged 1 commit into from Dec 11, 2014

Conversation

rogpeppe
Copy link
Member

httpbakery: remove Service type. Add cookie helpers.

Also change bakery.DischargeAll so that it returns a slice suitable
for putting in a cookie.

@@ -19,6 +19,36 @@ import (
"gopkg.in/macaroon-bakery.v0/bakery"
)

// DefaultHTTPClient is an http.Client that ensures that
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a go bug that the default client doesn't do this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a link to the bug.

@mhilton
Copy link
Contributor

mhilton commented Dec 10, 2014

👍 LGTM

@@ -33,6 +37,7 @@ func DischargeAll(
if err != nil {
return nil, errgo.NoteMask(err, fmt.Sprintf("cannot get discharge from %q", cav.Location), errgo.Any)
}
dm.Bind(sig)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of a reason you wouldn't want to bind when discharging all the macaroons, but this behavior should at least be documented in the godoc comment.

Would binding twice break things? I have a feeling it would, I'd have to go look at the impl of Macaroon.Bind.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is already documented in the godoc doc: "All the discharge macaroons
will be bound to the primary macaroon."

Yes, binding twice would break things. But I don't think that should
be an issue - you can't usefully add caveats to a macaroon after
discharging it, so I think that doing the binding here makes sense.
If it turns out it's actually useful to be able to discharge but not bind,
we can always create a DischargeAllUnbound function in the future.

I'm hoping that no-one will need to call Bind directly any more.

@cmars
Copy link
Contributor

cmars commented Dec 10, 2014

LGTM with the bulk errors in CheckRequest addressed here or in a followup. @alesstimec note the API changes in this PR.

Thanks!

@alesstimec
Copy link
Contributor

@cmars Noted. Will change, as soon as this PR lands.

httpbakery: remove Service type. Add cookie helpers.
rogpeppe added a commit that referenced this pull request Dec 11, 2014
@rogpeppe rogpeppe merged commit 56d1729 into go-macaroon-bakery:v0 Dec 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants