open-vault/builtin/credential/userpass/backend.go

57 lines
1.1 KiB
Go
Raw Normal View History

2015-04-19 21:59:30 +00:00
package userpass
import (
2015-07-28 04:11:35 +00:00
"github.com/hashicorp/vault/helper/mfa"
2015-04-19 21:59:30 +00:00
"github.com/hashicorp/vault/logical"
"github.com/hashicorp/vault/logical/framework"
)
func Factory(conf *logical.BackendConfig) (logical.Backend, error) {
return Backend().Setup(conf)
2015-04-19 21:59:30 +00:00
}
func Backend() *framework.Backend {
var b backend
b.Backend = &framework.Backend{
Help: backendHelp,
PathsSpecial: &logical.Paths{
2015-07-28 04:11:35 +00:00
Root: append([]string{
2015-04-19 21:59:30 +00:00
"users/*",
},
2015-07-31 00:16:53 +00:00
mfa.MFARootPaths()...,
2015-07-28 04:11:35 +00:00
),
2015-04-19 21:59:30 +00:00
Unauthenticated: []string{
2015-04-19 22:06:29 +00:00
"login/*",
2015-04-19 21:59:30 +00:00
},
},
Paths: append([]*framework.Path{
pathUsers(&b),
pathUserPolicies(&b),
pathUserPassword(&b),
2015-07-28 04:11:35 +00:00
},
mfa.MFAPaths(b.Backend, pathLogin(&b))...,
),
2015-04-19 22:12:50 +00:00
AuthRenew: b.pathLoginRenew,
2015-04-19 21:59:30 +00:00
}
return b.Backend
}
type backend struct {
*framework.Backend
}
const backendHelp = `
The "userpass" credential provider allows authentication using
a combination of a username and password. No additional factors
are supported.
The username/password combination is configured using the "users/"
endpoints by a user with root access. Authentication is then done
by suppying the two fields for "login".
`