vault: Index | Files

package credsutil

import ""


Package Files

credsutil.go sql.go


const (
    NoneLength int = -1

func RandomAlphaNumeric Uses

func RandomAlphaNumeric(length int, prependA1a bool) (string, error)

RandomAlphaNumeric returns a random string of characters [A-Za-z0-9-] of the provided length. The string generated takes up to 4 characters of space that are predefined and prepended to ensure password character requirements. It also requires a min length of 10 characters.

type CredentialsProducer Uses

type CredentialsProducer interface {
    GenerateCredentials(context.Context) (string, error)
    GenerateUsername(dbplugin.UsernameConfig) (string, error)
    GeneratePassword() (string, error)
    GenerateExpiration(time.Time) (string, error)

CredentialsProducer can be used as an embedded interface in the Database definition. It implements the methods for generating user information for a particular database type and is used in all the builtin database types.

type SQLCredentialsProducer Uses

type SQLCredentialsProducer struct {
    DisplayNameLen    int
    RoleNameLen       int
    UsernameLen       int
    Separator         string
    LowercaseUsername bool

SQLCredentialsProducer implements CredentialsProducer and provides a generic credentials producer for most sql database types.

func (*SQLCredentialsProducer) GenerateCredentials Uses

func (scp *SQLCredentialsProducer) GenerateCredentials(ctx context.Context) (string, error)

func (*SQLCredentialsProducer) GenerateExpiration Uses

func (scp *SQLCredentialsProducer) GenerateExpiration(ttl time.Time) (string, error)

func (*SQLCredentialsProducer) GeneratePassword Uses

func (scp *SQLCredentialsProducer) GeneratePassword() (string, error)

func (*SQLCredentialsProducer) GenerateUsername Uses

func (scp *SQLCredentialsProducer) GenerateUsername(config dbplugin.UsernameConfig) (string, error)

Package credsutil imports 6 packages (graph) and is imported by 15 packages. Updated 2020-02-13. Refresh now. Tools for package owners.