Skip to content

Commit

Permalink
Version 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Pawelczak committed Jan 26, 2018
1 parent 20e44aa commit 4bc2432
Show file tree
Hide file tree
Showing 15 changed files with 958 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@

# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/

vendor/
292 changes: 292 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions Gopkg.toml
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"
57 changes: 57 additions & 0 deletions authfile/backend.go
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.
`
Loading

0 comments on commit 4bc2432

Please sign in to comment.