credential/*: adhere to new API
This commit is contained in:
parent
cd3fa3be92
commit
37af1683c6
|
@ -12,7 +12,7 @@ func Factory(map[string]string) (logical.Backend, error) {
|
|||
func Backend() *framework.Backend {
|
||||
var b backend
|
||||
b.MapAppId = &framework.PolicyMap{
|
||||
PathMap: &framework.PathMap{"app-id"},
|
||||
PathMap: framework.PathMap{Name: "app-id"},
|
||||
DefaultKey: "default",
|
||||
}
|
||||
b.MapUserId = &framework.PathMap{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package appId
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/vault/logical"
|
||||
|
@ -34,11 +35,21 @@ func (b *backend) pathLogin(
|
|||
userId := data.Get("user_id").(string)
|
||||
|
||||
// Look up the apps that this user is allowed to access
|
||||
apps, err := b.MapUserId.Get(req.Storage, userId)
|
||||
appsMap, err := b.MapUserId.Get(req.Storage, userId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
appsRaw, ok := appsMap["value"]
|
||||
if !ok {
|
||||
appsRaw = ""
|
||||
}
|
||||
|
||||
apps, ok := appsRaw.(string)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("internal error: mapping is not a string")
|
||||
}
|
||||
|
||||
// Verify that the app is in the list
|
||||
found := false
|
||||
for _, app := range strings.Split(apps, ",") {
|
||||
|
|
|
@ -16,7 +16,7 @@ func Factory(map[string]string) (logical.Backend, error) {
|
|||
func Backend() *framework.Backend {
|
||||
var b backend
|
||||
b.Map = &framework.PolicyMap{
|
||||
PathMap: &framework.PathMap{"teams"},
|
||||
PathMap: framework.PathMap{Name: "teams"},
|
||||
DefaultKey: "default",
|
||||
}
|
||||
b.Backend = &framework.Backend{
|
||||
|
|
Loading…
Reference in New Issue