Updating for backend API change

This commit is contained in:
Armon Dadgar 2015-06-30 17:36:12 -07:00
parent 41b72a4d39
commit 5d69e7da90
13 changed files with 18 additions and 15 deletions

View File

@ -1,19 +1,22 @@
package appId
import (
"github.com/hashicorp/vault/helper/salt"
"github.com/hashicorp/vault/logical"
"github.com/hashicorp/vault/logical/framework"
)
func Factory(map[string]string) (logical.Backend, error) {
func Factory(*logical.BackendConfig) (logical.Backend, error) {
return Backend(), nil
}
func Backend() *framework.Backend {
var salt *salt.Salt
var b backend
b.MapAppId = &framework.PolicyMap{
PathMap: framework.PathMap{
Name: "app-id",
Salt: salt,
Schema: map[string]*framework.FieldSchema{
"display_name": &framework.FieldSchema{
Type: framework.TypeString,
@ -31,6 +34,7 @@ func Backend() *framework.Backend {
b.MapUserId = &framework.PathMap{
Name: "user-id",
Salt: salt,
Schema: map[string]*framework.FieldSchema{
"cidr_block": &framework.FieldSchema{
Type: framework.TypeString,

View File

@ -5,7 +5,7 @@ import (
"github.com/hashicorp/vault/logical/framework"
)
func Factory(map[string]string) (logical.Backend, error) {
func Factory(*logical.BackendConfig) (logical.Backend, error) {
return Backend(), nil
}

View File

@ -9,7 +9,7 @@ import (
"golang.org/x/oauth2"
)
func Factory(map[string]string) (logical.Backend, error) {
func Factory(*logical.BackendConfig) (logical.Backend, error) {
return Backend(), nil
}

View File

@ -3,12 +3,12 @@ package ldap
import (
"fmt"
"github.com/go-ldap/ldap"
"github.com/hashicorp/vault/logical"
"github.com/hashicorp/vault/logical/framework"
"github.com/go-ldap/ldap"
)
func Factory(map[string]string) (logical.Backend, error) {
func Factory(*logical.BackendConfig) (logical.Backend, error) {
return Backend(), nil
}
@ -93,7 +93,6 @@ func (b *backend) Login(req *logical.Request, username string, password string)
return nil, logical.ErrorResponse(err.Error()), nil
}
// Try to authenticate to the server using the provided credentials
binddn := fmt.Sprintf("%s=%s,%s", cfg.UserAttr, EscapeLDAPValue(username), cfg.UserDN)
if err = c.Bind(binddn, password); err != nil {

View File

@ -5,7 +5,7 @@ import (
"github.com/hashicorp/vault/logical/framework"
)
func Factory(map[string]string) (logical.Backend, error) {
func Factory(*logical.BackendConfig) (logical.Backend, error) {
return Backend(), nil
}

View File

@ -8,7 +8,7 @@ import (
"github.com/hashicorp/vault/logical/framework"
)
func Factory(map[string]string) (logical.Backend, error) {
func Factory(*logical.BackendConfig) (logical.Backend, error) {
return Backend(), nil
}

View File

@ -11,7 +11,7 @@ import (
)
// Factory creates a new backend
func Factory(map[string]string) (logical.Backend, error) {
func Factory(*logical.BackendConfig) (logical.Backend, error) {
return Backend(), nil
}

View File

@ -5,7 +5,7 @@ import (
"github.com/hashicorp/vault/logical/framework"
)
func Factory(map[string]string) (logical.Backend, error) {
func Factory(*logical.BackendConfig) (logical.Backend, error) {
return Backend(), nil
}

View File

@ -11,7 +11,7 @@ import (
"github.com/hashicorp/vault/logical/framework"
)
func Factory(map[string]string) (logical.Backend, error) {
func Factory(*logical.BackendConfig) (logical.Backend, error) {
return Backend(), nil
}

View File

@ -10,7 +10,7 @@ import (
)
// Factory creates a new backend implementing the logical.Backend interface
func Factory(map[string]string) (logical.Backend, error) {
func Factory(*logical.BackendConfig) (logical.Backend, error) {
return Backend(), nil
}

View File

@ -10,7 +10,7 @@ import (
"github.com/hashicorp/vault/logical/framework"
)
func Factory(map[string]string) (logical.Backend, error) {
func Factory(*logical.BackendConfig) (logical.Backend, error) {
return Backend(), nil
}

View File

@ -5,7 +5,7 @@ import (
"github.com/hashicorp/vault/logical/framework"
)
func Factory(map[string]string) (logical.Backend, error) {
func Factory(*logical.BackendConfig) (logical.Backend, error) {
return Backend(), nil
}

View File

@ -110,7 +110,7 @@ func Test(t TestT, c TestCase) {
core, err := vault.NewCore(&vault.CoreConfig{
Physical: physical.NewInmem(),
LogicalBackends: map[string]logical.Factory{
"test": func(map[string]string) (logical.Backend, error) {
"test": func(*logical.BackendConfig) (logical.Backend, error) {
return c.Backend, nil
},
},