Documentation ¶
Index ¶
- Constants
- func CheckSchemaUpgrade(version uint8) bool
- func CreateAuditEntry(user structs.User, validation tinymfa.Validation) error
- func CreateConnection() (*sql.DB, error)
- func CreateIssuer(issuer structs.Issuer) (structs.IssuerCreation, error)
- func CreateUser(user structs.User) (structs.User, error)
- func DeleteIssuer(issuer structs.Issuer) (bool, error)
- func DeleteToken(issuerid, tokenid string) error
- func DeleteTokens(issuerid string) error
- func DeleteUser(user structs.User) (bool, error)
- func DeleteUsers(objectid string) error
- func GetAuditEntries(parameters structs.AuditQueryParameter) ([]structs.AuditEntry, error)
- func GetFailedValidationCount(user structs.User, message int64) (int, error)
- func GetIssuer(issuer string) (structs.Issuer, error)
- func GetIssuerAccessTokens(issuer structs.Issuer) ([]structs.TokenEntry, error)
- func GetIssuerByID(issuerID string) (structs.Issuer, error)
- func GetIssuerKey(issuer structs.Issuer) ([]byte, error)
- func GetIssuers() ([]structs.Issuer, error)
- func GetOidcConfiguration() (structs.OidcConfig, error)
- func GetQrCodeConfiguration() (structs.QrCodeConfig, error)
- func GetRootKey() ([]byte, error)
- func GetSchemaVersion() (uint8, error)
- func GetSystemConfiguration() (structs.ServerConfig, error)
- func GetSystemProperty(key string) (string, error)
- func GetTokenLength(issuer structs.Issuer) (uint8, error)
- func GetUser(user string, issuer structs.Issuer) (structs.User, error)
- func GetUserKey(user structs.User) ([]byte, error)
- func GetUserKeyBase32(user structs.User) (string, error)
- func GetUsers(issuer structs.Issuer) ([]structs.User, error)
- func InitializeSystem() error
- func InsertToken(token structs.Token) error
- func PingDatabase() error
- func UpdateIssuer(issuer structs.Issuer) (bool, error)
- func UpdateOidcConfiguration(oidcconfig structs.OidcConfig) (structs.OidcConfig, error)
- func UpdateQrCodeConfiguration(qrcodeconfig structs.QrCodeConfig) (structs.QrCodeConfig, error)
- func UpdateSystemConfiguration(config structs.ServerConfig) (structs.ServerConfig, error)
- func UpdateUser(user structs.User) (bool, error)
- func UpgradeSchema(version uint8) (uint8, error)
- func ValidateToken(issuer structs.Issuer, submittedToken string) (bool, error)
Constants ¶
const ( //RouterPortKey the key of the router port entry in serverconfig table RouterPortKey = "http_port" //DenyLimitKey the key of the deny limit entry in serverconfig table DenyLimitKey = "deny_limit" //RootTokenKey is the key of the root token entry in serverconfig table RootTokenKey = "root_token" //VerifyTokenKey is the key of the verify token entry in serverconfig table VerifyTokenKey = "verify_tokens" //SchemaVersionKey is the key of the schema version entry in serverconfig table SchemaVersionKey = "schema_version" //SecretFilePath location of the root key SecretFilePath string = "/opt/go-tiny-mfa/secrets/key" //RootTokenFilePath location of the root-token export RootTokenFilePath string = "/opt/go-tiny-mfa/secrets/root-token.readanddelete" )
const (
CurrentSchemaVersion uint8 = 2
)
Variables ¶
This section is empty.
Functions ¶
func CheckSchemaUpgrade ¶
func CreateAuditEntry ¶
func CreateAuditEntry(user structs.User, validation tinymfa.Validation) error
CreateAuditEntry creates an audit in the database
func CreateConnection ¶
CreateConnection creates a connection to a postgres DB
func CreateIssuer ¶
func CreateIssuer(issuer structs.Issuer) (structs.IssuerCreation, error)
CreateIssuer inserts a Issuer struct to the database
func CreateUser ¶
CreateUser inserts a userstruct to the DB
func DeleteIssuer ¶
DeleteIssuer deletes an issuer from the database
func DeleteToken ¶
DeleteToken deletes all tokens for a given issuer id
func DeleteTokens ¶
DeleteTokens deletes all tokens for a given issuer id
func DeleteUser ¶
DeleteUser deletes a user from the database
func DeleteUsers ¶
DeleteUsers deletes all tokens for a given object id
func GetAuditEntries ¶
func GetAuditEntries(parameters structs.AuditQueryParameter) ([]structs.AuditEntry, error)
GetAuditEntries returns all audit entries from the db
func GetFailedValidationCount ¶
GetFailedValidationCount returns the number of times a user failed validation for a given message
func GetIssuerAccessTokens ¶
func GetIssuerAccessTokens(issuer structs.Issuer) ([]structs.TokenEntry, error)
GetIssuerAccessTokens returns all access tokens for a given issuer from the database
func GetIssuerByID ¶
GetIssuerByID returns the requested issuer from the database as Issuer struct
func GetIssuerKey ¶
GetIssuerKey returns the decrypted issuer key as byte array
func GetIssuers ¶
GetIssuers returns all Issuers from the database
func GetOidcConfiguration ¶ added in v0.2.4
func GetOidcConfiguration() (structs.OidcConfig, error)
GetOidcConfiguration returns the oidc configuration
func GetQrCodeConfiguration ¶
func GetQrCodeConfiguration() (structs.QrCodeConfig, error)
GetQrCodeConfiguration returns the configured qr colors
func GetRootKey ¶
GetRootKey retrieves the key generated on system initialization
func GetSchemaVersion ¶
func GetSystemConfiguration ¶
func GetSystemConfiguration() (structs.ServerConfig, error)
GetSystemConfiguration returns the system config
func GetSystemProperty ¶
GetSystemProperty returns the value for the given key
func GetTokenLength ¶
GetTokenLength returns the length of the desired token
func GetUserKey ¶
GetUserKey returns the decrypted user key as byte array
func GetUserKeyBase32 ¶
GetUserKeyBase32 returns the decrypted user key in base32 encoding
func InitializeSystem ¶
func InitializeSystem() error
InitializeSystem will initialize the database and the root key
func InsertToken ¶
InsertToken inserts an access token to the database
func UpdateIssuer ¶
UpdateIssuer updates an existing issuer
func UpdateOidcConfiguration ¶ added in v0.2.4
func UpdateOidcConfiguration(oidcconfig structs.OidcConfig) (structs.OidcConfig, error)
UpdateOidcConfiguration returns the oidc configuration
func UpdateQrCodeConfiguration ¶
func UpdateQrCodeConfiguration(qrcodeconfig structs.QrCodeConfig) (structs.QrCodeConfig, error)
UpdateQrCodeConfiguration returns the configured qr colors
func UpdateSystemConfiguration ¶
func UpdateSystemConfiguration(config structs.ServerConfig) (structs.ServerConfig, error)
UpdateSystemConfiguration updates the system configuration
func UpdateUser ¶
UpdateUser updates an existing user
func UpgradeSchema ¶
Types ¶
This section is empty.