-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tomasz Pawelczak
committed
Jan 26, 2018
1 parent
20e44aa
commit 4bc2432
Showing
15 changed files
with
958 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,5 @@ | |
|
||
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 | ||
.glide/ | ||
|
||
vendor/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Gopkg.toml example | ||
# | ||
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md | ||
# for detailed Gopkg.toml documentation. | ||
# | ||
# required = ["github.com/user/thing/cmd/thing"] | ||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project" | ||
# version = "1.0.0" | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project2" | ||
# branch = "dev" | ||
# source = "github.com/myfork/project2" | ||
# | ||
# [[override]] | ||
# name = "github.com/x/y" | ||
# version = "2.4.0" | ||
|
||
|
||
[[constraint]] | ||
name = "github.com/fatih/structs" | ||
version = "1.0.0" | ||
|
||
[[constraint]] | ||
name = "github.com/hashicorp/vault" | ||
version = "0.9.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package authfile | ||
|
||
import ( | ||
"github.com/hashicorp/vault/logical" | ||
"github.com/hashicorp/vault/logical/framework" | ||
log "github.com/mgutz/logxi/v1" | ||
) | ||
|
||
func Factory(conf *logical.BackendConfig) (logical.Backend, error) { | ||
b := Backend(conf) | ||
err := b.Setup(conf) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return b, nil | ||
} | ||
|
||
func Backend(conf *logical.BackendConfig) *backend { | ||
var b backend | ||
|
||
b.logger = conf.Logger | ||
if b.logger.IsInfo() { | ||
b.logger.Info("vault-auth-file: starting...", "version", HumanVersion) | ||
} | ||
|
||
|
||
b.Backend = &framework.Backend{ | ||
Help: backendHelp, | ||
BackendType: logical.TypeCredential, | ||
PathsSpecial: &logical.Paths{ | ||
Unauthenticated: []string{ | ||
"login", | ||
}, | ||
}, | ||
|
||
Paths: append([]*framework.Path{ | ||
pathLogin(&b), | ||
pathConfig(&b), | ||
}), | ||
|
||
AuthRenew: b.pathLoginRenew, | ||
} | ||
return &b | ||
} | ||
|
||
type backend struct { | ||
*framework.Backend | ||
logger log.Logger | ||
} | ||
|
||
const backendHelp = ` | ||
File authentication backend takes a username and password and verify | ||
them against passwords like unix file. Passwords hash are in glibc compatible | ||
SHA512 format (see man crypt). | ||
Policies are assigned also in password file, as coma separated list. | ||
` |
Oops, something went wrong.