[lxc-devel] [lxd/master] all: move to bakery.v2
monstermunchkin on Github
lxc-bot at linuxcontainers.org
Fri Oct 27 16:52:24 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 350 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20171027/1244d607/attachment.bin>
-------------- next part --------------
From 81592a91591ba36b4159dfe7ba5fc2a088f4609a Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thipp at suse.de>
Date: Fri, 27 Oct 2017 18:40:21 +0200
Subject: [PATCH] all: move to bakery.v2
Signed-off-by: Thomas Hipp <thomashipp at gmail.com>
---
client/connection.go | 2 +-
client/lxd.go | 4 ++--
lxc/config/config.go | 2 +-
lxc/main.go | 2 +-
lxd/daemon.go | 17 +++++++++--------
test/godeps.list | 4 ++--
test/macaroon-identity/auth.go | 8 ++++----
test/macaroon-identity/formschema.go | 2 +-
8 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/client/connection.go b/client/connection.go
index 0a606452d..c2e830cd9 100644
--- a/client/connection.go
+++ b/client/connection.go
@@ -8,7 +8,7 @@ import (
"github.com/lxc/lxd/shared/logger"
"github.com/lxc/lxd/shared/simplestreams"
- "gopkg.in/macaroon-bakery.v2-unstable/httpbakery"
+ "gopkg.in/macaroon-bakery.v2/httpbakery"
)
// ConnectionArgs represents a set of common connection properties
diff --git a/client/lxd.go b/client/lxd.go
index 6aef4cf17..9e0be5200 100644
--- a/client/lxd.go
+++ b/client/lxd.go
@@ -9,8 +9,8 @@ import (
"sync"
"github.com/gorilla/websocket"
- "gopkg.in/macaroon-bakery.v2-unstable/bakery"
- "gopkg.in/macaroon-bakery.v2-unstable/httpbakery"
+ "gopkg.in/macaroon-bakery.v2/bakery"
+ "gopkg.in/macaroon-bakery.v2/httpbakery"
"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shared/api"
diff --git a/lxc/config/config.go b/lxc/config/config.go
index 486b39afd..f6e9a3fe0 100644
--- a/lxc/config/config.go
+++ b/lxc/config/config.go
@@ -5,7 +5,7 @@ import (
"path/filepath"
"github.com/juju/persistent-cookiejar"
- "gopkg.in/macaroon-bakery.v2-unstable/httpbakery"
+ "gopkg.in/macaroon-bakery.v2/httpbakery"
)
// Config holds settings to be used by a client or daemon
diff --git a/lxc/main.go b/lxc/main.go
index ed738d3a0..dde2c2e85 100644
--- a/lxc/main.go
+++ b/lxc/main.go
@@ -10,7 +10,7 @@ import (
"strings"
"syscall"
- "gopkg.in/macaroon-bakery.v2-unstable/httpbakery/form"
+ "gopkg.in/macaroon-bakery.v2/httpbakery/form"
"github.com/lxc/lxd/lxc/config"
"github.com/lxc/lxd/shared"
diff --git a/lxd/daemon.go b/lxd/daemon.go
index 966058c73..c7fd7a7e7 100644
--- a/lxd/daemon.go
+++ b/lxd/daemon.go
@@ -25,9 +25,10 @@ import (
_ "github.com/mattn/go-sqlite3"
"github.com/syndtr/gocapability/capability"
"golang.org/x/net/context"
- "gopkg.in/macaroon-bakery.v2-unstable/bakery"
- "gopkg.in/macaroon-bakery.v2-unstable/bakery/checkers"
- "gopkg.in/macaroon-bakery.v2-unstable/httpbakery"
+ "gopkg.in/macaroon-bakery.v2/bakery"
+ "gopkg.in/macaroon-bakery.v2/bakery/checkers"
+ "gopkg.in/macaroon-bakery.v2/bakery/identchecker"
+ "gopkg.in/macaroon-bakery.v2/httpbakery"
"gopkg.in/tomb.v2"
"github.com/lxc/lxd/client"
@@ -98,7 +99,7 @@ type Daemon struct {
type externalAuth struct {
endpoint string
- bakery *bakery.Bakery
+ bakery *identchecker.Bakery
}
// NewDaemon returns a new, un-initialized Daemon object.
@@ -165,7 +166,7 @@ func getBakeryOps(r *http.Request) []bakery.Op {
}}
}
-func writeMacaroonsRequiredResponse(b *bakery.Bakery, r *http.Request, w http.ResponseWriter, derr *bakery.DischargeRequiredError) {
+func writeMacaroonsRequiredResponse(b *identchecker.Bakery, r *http.Request, w http.ResponseWriter, derr *bakery.DischargeRequiredError) {
ctx := httpbakery.ContextWithRequest(context.TODO(), r)
caveats := append(derr.Caveats, checkers.TimeBeforeCaveat(time.Now().Add(5*time.Minute)))
@@ -1053,15 +1054,15 @@ func (d *Daemon) setupExternalAuthentication(authEndpoint string) error {
if strings.HasPrefix(authEndpoint, "http://") {
pkLocator.AllowInsecure()
}
- bakery := bakery.New(bakery.BakeryParams{
+ bakery := identchecker.NewBakery(identchecker.BakeryParams{
Key: key,
Location: authEndpoint,
Locator: pkLocator,
Checker: httpbakery.NewChecker(),
IdentityClient: idmClient,
- Authorizer: bakery.ACLAuthorizer{
+ Authorizer: identchecker.ACLAuthorizer{
GetACL: func(ctx context.Context, op bakery.Op) ([]string, bool, error) {
- return []string{bakery.Everyone}, false, nil
+ return []string{identchecker.Everyone}, false, nil
},
},
})
diff --git a/test/godeps.list b/test/godeps.list
index 172f8847f..86644a6ce 100644
--- a/test/godeps.list
+++ b/test/godeps.list
@@ -10,7 +10,7 @@ github.com/rogpeppe/fastuuid
golang.org/x/crypto
golang.org/x/net
gopkg.in/errgo.v1
-gopkg.in/macaroon-bakery.v2-unstable
-gopkg.in/macaroon.v2-unstable
+gopkg.in/macaroon-bakery.v2
+gopkg.in/macaroon.v2
gopkg.in/retry.v1
gopkg.in/yaml.v2
diff --git a/test/macaroon-identity/auth.go b/test/macaroon-identity/auth.go
index 14259f00a..b062455c9 100644
--- a/test/macaroon-identity/auth.go
+++ b/test/macaroon-identity/auth.go
@@ -8,10 +8,10 @@ import (
"golang.org/x/net/context"
- "gopkg.in/macaroon-bakery.v2-unstable/bakery"
- "gopkg.in/macaroon-bakery.v2-unstable/bakery/checkers"
- "gopkg.in/macaroon-bakery.v2-unstable/httpbakery"
- "gopkg.in/macaroon-bakery.v2-unstable/httpbakery/form"
+ "gopkg.in/macaroon-bakery.v2/bakery"
+ "gopkg.in/macaroon-bakery.v2/bakery/checkers"
+ "gopkg.in/macaroon-bakery.v2/httpbakery"
+ "gopkg.in/macaroon-bakery.v2/httpbakery/form"
"github.com/juju/httprequest"
"github.com/rogpeppe/fastuuid"
diff --git a/test/macaroon-identity/formschema.go b/test/macaroon-identity/formschema.go
index 4f5041eff..fa3b471cb 100644
--- a/test/macaroon-identity/formschema.go
+++ b/test/macaroon-identity/formschema.go
@@ -4,7 +4,7 @@ import (
"github.com/juju/schema"
"gopkg.in/juju/environschema.v1"
- "gopkg.in/macaroon-bakery.v2-unstable/httpbakery/form"
+ "gopkg.in/macaroon-bakery.v2/httpbakery/form"
)
var schemaResponse = form.SchemaResponse{
More information about the lxc-devel
mailing list