Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearDatabase ¶
func ClearDatabase()
ClearDatabase clears the internal database, leaving only the default users. This is primarily for use by tests.
func DropRole ¶
func DropRole(name string)
DropRole removes the given role from the database. If the role does not exist, then this is a no-op.
func GenerateRandomOctetString ¶
func GenerateRandomOctetString(length int) rfc5802.OctetString
GenerateRandomOctetString generates an OctetString filled with random bytes.
func RoleExists ¶
RoleExists returns whether the given role exists.
Types ¶
type MockDatabase ¶
MockDatabase is a temporary database to hold role passwords.
type Role ¶
type Role struct {
Name string // rolname
IsSuperUser bool // rolsuper
InheritPrivileges bool // rolinherit
CanCreateRoles bool // rolcreaterole
CanCreateDB bool // rolcreatedb
CanLogin bool // rolcanlogin
IsReplicationRole bool // rolreplication
CanBypassRowLevelSecurity bool // rolbypassrls
ConnectionLimit int32 // rolconnlimit
Password *ScramSha256Password // rolpassword
ValidUntil *time.Time // rolvaliduntil
}
Role represents a role/user.
func CreateDefaultRole ¶
CreateDefaultRole creates the given role object with all default values set.
type ScramSha256Password ¶
type ScramSha256Password struct {
Iterations uint32
Salt rfc5802.OctetString
StoredKey rfc5802.OctetString
ServerKey rfc5802.OctetString
}
ScramSha256Password is the struct form of an encrypted password.
func NewScramSha256Password ¶
func NewScramSha256Password(rawPassword string) (*ScramSha256Password, error)
NewScramSha256Password creates a ScramSha256Password with a randomly-generated salt.
func (ScramSha256Password) AsPasswordString ¶
func (password ScramSha256Password) AsPasswordString() string
AsPasswordString returns the password as defined in https://www.postgresql.org/docs/15/catalog-pg-authid.html