Documentation ¶
Index ¶
- Variables
- func GetSkipConsent(clientId string) (skip bool)
- func GetSkipTOTP(clientId string) (skip bool)
- func ReloadConfigFile() (err error)
- type Backend
- type BackendServer
- type BackendServerMonitoring
- type BasicAuth
- type BruteForceRule
- type BruteForceSection
- type Cluster
- type Config
- type DNS
- type DbgModule
- type Feature
- type File
- func (f *File) GetAllProtocols() []string
- func (f *File) GetBackendServer(protocol string) *BackendServer
- func (f *File) GetBackendServerIP(protocol string) string
- func (f *File) GetBackendServerMonitoring() *BackendServerMonitoring
- func (f *File) GetBackendServerPort(protocol string) int
- func (f *File) GetBackendServers() []*BackendServer
- func (*File) GetBruteForceRules() (rules []BruteForceRule)
- func (f *File) GetConfig(backend global.Backend) any
- func (f *File) GetLDAPConfigAuthIdlePoolSize() int
- func (f *File) GetLDAPConfigAuthPoolSize() int
- func (f *File) GetLDAPConfigBindDN() string
- func (f *File) GetLDAPConfigBindPW() string
- func (f *File) GetLDAPConfigLookupIdlePoolSize() int
- func (f *File) GetLDAPConfigLookupPoolSize() int
- func (f *File) GetLDAPConfigSASLExternal() bool
- func (f *File) GetLDAPConfigServerURIs() []string
- func (f *File) GetLDAPConfigStartTLS() bool
- func (f *File) GetLDAPConfigTLSCAFile() string
- func (f *File) GetLDAPConfigTLSClientCert() string
- func (f *File) GetLDAPConfigTLSClientKey() string
- func (f *File) GetLDAPConfigTLSSkipVerify() bool
- func (f *File) GetLDAPSearchProtocol(protocol string) (*LDAPSearchProtocol, error)
- func (f *File) GetLuaPackagePath() string
- func (f *File) GetLuaScriptPath() string
- func (f *File) GetLuaSearchProtocol(protocol string) (*LuaSearchProtocol, error)
- func (f *File) GetProtocols(backend global.Backend) any
- func (f *File) GetSection(backend global.Backend) any
- func (f *File) GetServer() *ServerSection
- func (f *File) GetServerInsights() *Insights
- func (f *File) GetServerInsightsEnableBlockProfile() bool
- func (f *File) GetServerInsightsEnablePprof() bool
- func (f *File) HasFeature(feature string) bool
- func (f *File) HaveLDAPBackend() bool
- func (f *File) HaveLua() bool
- func (f *File) HaveLuaActions() bool
- func (f *File) HaveLuaFeatures() bool
- func (f *File) HaveLuaFilters() bool
- func (f *File) HaveServer() bool
- func (f *File) LDAPHavePoolOnly() bool
- func (f *File) RetrieveGetterMap() map[global.Backend]GetterHandler
- type GetterHandler
- type IdTokenClaims
- type Insights
- type LDAPAttributeMapping
- type LDAPConf
- type LDAPFilter
- type LDAPScope
- type LDAPSearchProtocol
- func (p *LDAPSearchProtocol) GetAccountField() (string, error)
- func (p *LDAPSearchProtocol) GetAttributes() ([]string, error)
- func (p *LDAPSearchProtocol) GetBaseDN() (string, error)
- func (p *LDAPSearchProtocol) GetCacheName() (string, error)
- func (p *LDAPSearchProtocol) GetListAccountsFilter() (string, error)
- func (p *LDAPSearchProtocol) GetScope() (*LDAPScope, error)
- func (p *LDAPSearchProtocol) GetUserFilter() (string, error)
- type LDAPSection
- type Log
- type LuaAction
- type LuaConf
- type LuaFeature
- type LuaFilter
- type LuaSearchProtocol
- type LuaSection
- type Master
- type MasterUser
- type OIDCCustomClaim
- type Oauth2Client
- type Oauth2CustomScope
- type Oauth2Section
- type Protocol
- type RBL
- type RBLSection
- type Redis
- type RelayDomainsSection
- type Replica
- type Sentinels
- type ServerSection
- type StringSet
- type TLS
- type Verbosity
Constants ¶
This section is empty.
Variables ¶
var ( Matcher language.Matcher DefaultLanguageTags []language.Tag )
Functions ¶
func GetSkipConsent ¶
GetSkipConsent returns a boolean true, if the consent dialog shall be skipped for an OAuth-2 client.
func GetSkipTOTP ¶
GetSkipTOTP returns a boolean true, if TOTP two-factor authentication shall be skipped for an OAuth-2 client.
func ReloadConfigFile ¶
func ReloadConfigFile() (err error)
ReloadConfigFile is a thread safe function to reload a ConfigFile object.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is a password Database container.
func (*Backend) Set ¶
Set updates the backend of the Backend based on the provided value. It returns an error if the value is not valid. Valid values for the backend are "cache", "ldap" and "lua". If the value is valid, the backend field of Backend is updated accordingly. An error of type ErrWrongPassDB is returned if the value is not valid.
type BackendServer ¶
type BackendServer struct { Protocol string `mapstructure:"protocol"` IP string `mapstructure:"ip"` Port int `mapstructure:"port"` TLS bool `mapstructure:"tls"` HAProxyV2 bool `mapstructure:"haproxy_v2"` }
func (*BackendServer) String ¶
func (n *BackendServer) String() string
type BackendServerMonitoring ¶
type BackendServerMonitoring struct {
BackendServers []*BackendServer `mapstructure:"backend_servers"`
}
type BruteForceRule ¶
type BruteForceRule struct { Name string Period uint CIDR uint IPv4 bool IPv6 bool FailedRequests uint `mapstructure:"failed_requests"` }
BruteForceRule is the definition of a brute force rule as defined in the configuration file. See the markdown documentation for a description of the field names.
type BruteForceSection ¶
type BruteForceSection struct { IPWhitelist []string `mapstructure:"ip_whitelist"` Buckets []BruteForceRule `mapstructure:"buckets"` }
func (*BruteForceSection) String ¶
func (b *BruteForceSection) String() string
type Config ¶
type Config struct { // SMTPBackendAddress is the address of the SMTP backend server. SMTPBackendAddress string // SMTPBackendPort is the port of the SMTP backend server. SMTPBackendPort int // IMAPBackendAddress is the address of the IMAP backend server. IMAPBackendAddress string // IMAPBackendPort is the port of the IMAP backend server. IMAPBackendPort int // POP3BackendAddress is the address of the POP3 backend server. POP3BackendAddress string // POP3BackendPort is the port of the IMAP POP3 server. POP3BackendPort int // WaitDelay is the time in seconds to wait between connection attempts. WaitDelay uint8 // MaxLoginAttempts is the maximum number of login attempts. MaxLoginAttempts uint8 // DevMode indicates whether the application is running in developer mode. DevMode bool // MaxActionWorkers is the maximum number of action workers that can be run simultaneously. MaxActionWorkers uint16 // LocalCacheAuthTTL LocalCacheAuthTTL time.Duration }
Config represents overall configuration settings for the application.
var EnvConfig *Config //nolint:gochecknoglobals // System wide configuration
EnvConfig represents the environment configuration for the application It is a pointer to Config type
type DbgModule ¶
type DbgModule struct {
// contains filtered or unexported fields
}
DbgModule represents a debugging module configuration.
func (*DbgModule) Get ¶
Get returns the name of the `DbgModule` instance. The name represents the current debug module. It can be used to identify the debug module when needed.
func (*DbgModule) GetModule ¶
GetModule returns the `module` field of the `DbgModule` struct. It is used to retrieve the current debug module.
Usage:
module := d.GetModule()
Example:
func main() { dbg := &DbgModule{} module := dbg.GetModule() fmt.Println(module) // Output: 0 }
func (*DbgModule) Set ¶
Set updates the debug module based on the provided value. It returns an error if the value is not valid. Valid values for the debug module are "none", "all", "auth", "hydra", "webauthn", "statistics", "whitelist", "ldap", "ldappool", "sql", "cache", "bf", "rbl", "action", "feature", and "lua". If the value is valid, the module and name fields are updated accordingly. An error of type ErrWrongDebugModule is returned if the value is not valid.
type Feature ¶
type Feature struct {
// contains filtered or unexported fields
}
Feature is a container for Nauthilus features.
func (*Feature) Set ¶
Set updates the feature name based on the provided value. It returns an error if the value is not a valid feature name. Valid feature names are "tls_encryption", "rbl", "relay_domains", and "lua". If the value is valid, the name field of the Feature struct is updated accordingly. An error of type ErrWrongFeature is returned if the value is not valid.
type File ¶
type File struct { Server *ServerSection `mapstructure:"server"` RBLs *RBLSection `mapstructure:"realtime_blackhole_lists"` ClearTextList []string `mapstructure:"cleartext_networks"` RelayDomains *RelayDomainsSection `mapstructure:"relay_domains"` BackendServerMonitoring *BackendServerMonitoring `mapstructure:"backend_server_monitoring"` BruteForce *BruteForceSection `mapstructure:"brute_force"` CSRFSecret string `mapstructure:"csrf_secret"` CookieStoreAuthKey string `mapstructure:"cookie_store_auth_key"` CookieStoreEncKey string `mapstructure:"cookie_store_encryption_key"` PasswordNonce string `mapstructure:"password_nonce"` Lua *LuaSection Oauth2 *Oauth2Section LDAP *LDAPSection Other map[string]any `mapstructure:",remain"` Mu sync.Mutex }
var LoadableConfig *File //nolint:gochecknoglobals // System wide configuration from nauthilus.yml file
LoadableConfig is a variable of type *File that represents the configuration file that can be loaded.
func NewConfigFile ¶
NewConfigFile is the constructor for a ConfigFile object.
func (*File) GetAllProtocols ¶
GetAllProtocols returns a unique slice of strings (a Set) for all defined protocols in the database search sections.
func (*File) GetBackendServer ¶
func (f *File) GetBackendServer(protocol string) *BackendServer
GetBackendServer is a method of the File struct. It takes a protocol as an argument and returns a BackendServer. The method iterates over the Backend Servers of the File instance and returns the first server that matches the provided protocol. If no such server is found, an emtpy instance of BackendServer is returned.
func (*File) GetBackendServerIP ¶
GetBackendServerIP is a method for the File struct which attempts to get the IP address of a backend server for a specified protocol. The method first calls GetBackendServer with the given protocol and checks if it returns a non-nil value. If the value is not nil, it retrieves the IP attribute of the backend server. If the returned value is nil, indicating that there is no backend server for the given protocol, the method returns an empty string.
Parameters:
protocol: A string that specifies the protocol for which the backend server's IP address is to be retrieved. This could be "http", "https", etc.
Returns:
A string representing the IP address of the backend server for the given protocol. If there is no backend server for the specified protocol, the method returns an empty string.
func (*File) GetBackendServerMonitoring ¶
func (f *File) GetBackendServerMonitoring() *BackendServerMonitoring
GetBackendServerMonitoring is a method on the File struct. It returns the BackendServerMonitoring field from the File struct.
func (*File) GetBackendServerPort ¶
GetBackendServerPort checks the specific protocol's backend server in the File structure. If the server exists, it returns the port of the server. If the server does not exist, it returns 0.
func (*File) GetBackendServers ¶
func (f *File) GetBackendServers() []*BackendServer
GetBackendServers method operates on a File receiver 'f'. It checks if the BackendServerMonitoring property is not null, it returns a pointer to an array of BackendServers, otherwise, it returns an empty array of BackendServer pointers. This method could be used when trying to get all backend servers of a configuration file.
func (*File) GetBruteForceRules ¶
func (*File) GetBruteForceRules() (rules []BruteForceRule)
GetBruteForceRules is a method on the File struct. It retrieves the brute force rules from the LoadableConfig.BruteForce.Buckets field.
The method checks if LoadableConfig.BruteForce is not nil and if LoadableConfig.BruteForce.Buckets is not empty. If both conditions are met, it assigns LoadableConfig.BruteForce.Buckets to the rules variable and returns it. If the conditions are not met, the method returns an empty []BruteForceRule.
func (*File) GetConfig ¶
GetConfig returns the configuration handler for the specified backend. The configuration handler is determined based on the backend type. If the backend is found, it retrieves the configuration handler associated with it and returns the result of calling the GetterHandler() method on the configuration handler. If the configuration handler is not found, it returns nil.
func (*File) GetLDAPConfigAuthIdlePoolSize ¶
GetLDAPConfigAuthIdlePoolSize is a method that operates on a File struct. It retrieves the 'AuthIdlePoolSize' configuration from the LDAP configuration if it exists. If no such configuration is found or the type assertion for LDAPConf fails, it returns a default global LDAP idle pool size.
func (*File) GetLDAPConfigAuthPoolSize ¶
GetLDAPConfigAuthPoolSize is a method of File struct. It returns the LDAP configuration authentication pool size. If the configuration for LDAP backend is nil or not assertable, it returns the default global.LDAPIdlePoolSize value. Otherwise, it returns the AuthPoolSize from the LDAP configuration.
func (*File) GetLDAPConfigBindDN ¶
GetLDAPConfigBindDN is a method on the File struct. It retrieves the BindDN field from the LDAP configuration in the File's configuration settings. It will return an empty string if either the config can't be retrieved (nil is returned), or in case the type assertion to an LDAPConf object fails.
func (*File) GetLDAPConfigBindPW ¶
GetLDAPConfigBindPW retrieves the binding password from the LDAP Configuration. This method belongs to the File struct and it operates as follows: It retrieves the LDAP configuration using the GetConfig method. If that configuration does not exist, it returns an empty string. If it exists, it attempts to assert this configuration as a pointer to LDAPConf. If this assertion is successful, it returns the BindPW of the LDAPConf. If the assertion fails, it also returns an empty string.
func (*File) GetLDAPConfigLookupIdlePoolSize ¶
GetLDAPConfigLookupIdlePoolSize retrieves the idle pool size for LDAP connections from the config file. If the returned configuration from the config file is nil or if it's not of type *LDAPConf, it will return the default global LDAP idle pool size.
func (*File) GetLDAPConfigLookupPoolSize ¶
GetLDAPConfigLookupPoolSize retrieves the number of connections that should be maintained in the LDAP lookup pool. If the LDAP configuration can be asserted successfully, it returns the LookupPoolSize from the retrieved LDAP configuration. If not, it returns the global constant LDAPIdlePoolSize.
func (*File) GetLDAPConfigSASLExternal ¶
GetLDAPConfigSASLExternal checks if SASL External is enabled in the LDAP configuration. It attempts to fetch the global BackendLDAP configuration using the GetConfig method. If the configuration is found and can be asserted as *LDAPConf, it returns the value of the SASLExternal field. If the configuration is not found or can't be asserted as *LDAPConf, it returns false.
func (*File) GetLDAPConfigServerURIs ¶
GetLDAPConfigServerURIs is a method on the File struct. It returns an array of LDAP server URIs. It first gets the LDAP configuration using the GetConfig method from global.BackendLDAP. If no LDAP configuration is found, it returns an array with a default URI "ldap://localhost". If a valid LDAP configuration is found, it returns the ServerURIs field from the LDAPConf struct. If the configuration is not of type LDAPConf, it also returns an array with a default URI "ldap://localhost". Example usage:
file := &File{} serverURIs := file.GetLDAPConfigServerURIs() for _, uri := range serverURIs { fmt.Println(uri) }
Output:
ldap://localhost ldap://example.com:389
func (*File) GetLDAPConfigStartTLS ¶
GetLDAPConfigStartTLS is a receiver function for the File struct that retrieves LDAP configuration. Specifically, it checks if the configuration recommends starting a TLS (Transport Layer Security) connection. The function returns a boolean value; true if the configuration recommends starting a TLS connection and false otherwise. It first gets the global LDAP configuration by calling the GetConfig function of the File receiver. If the configuration is nil, then the function immediately returns false. If the configuration is not nil, it tries to assert the configuration to be of type LDAPConf. If the assertion is successful (i.e., the configuration is of type LDAPConf), the StartTLS variable of the LDAPConf instance is returned. If the assertion is not successful, the function returns false.
func (*File) GetLDAPConfigTLSCAFile ¶
GetLDAPConfigTLSCAFile is a method on the File struct. It retrieves the TLS CA file path for the LDAP configuration. It first retrieves the LDAP configuration using the GetConfig method, passing in the global.BackendLDAP value. If the LDAP configuration is not found or is not of type *LDAPConf, it returns an empty string. Otherwise, it casts the retrieved configuration to *LDAPConf and returns the TLSCAFile field. If the TLSCAFile field is empty, it also returns an empty string. Example usage: filePath := file.GetLDAPConfigTLSCAFile()
func (*File) GetLDAPConfigTLSClientCert ¶
GetLDAPConfigTLSClientCert is a method on the File struct. It returns the TLS client certificate path from the LDAP configuration in the File struct. If the LDAP configuration is not found or the TLS client certificate is empty, it returns an empty string.
func (*File) GetLDAPConfigTLSClientKey ¶
GetLDAPConfigTLSClientKey is a method on the File struct. It tries to get the LDAP configuration from the file's current configuration. If the configuration is successfully retrieved and is of type LDAPConf, it returns the TLSClientKey from the LDAP configuration.
func (*File) GetLDAPConfigTLSSkipVerify ¶
GetLDAPConfigTLSSkipVerify is a method of the File struct. It attempts to retrieve the LDAP configuration and then checks whether TLSSkipVerify is enabled in the LDAP configuration.
It follows the steps: 1. Get the LDAP specific configuration by calling GetConfig with 'global.BackendLDAP'. 2. If no configuration is found, it defaults to returning false. 3. If a configuration is found, it checks whether it can be asserted to a LDAPConf type. 4. If it is successfully asserted to a LDAPConf type, it returns the value of 'TLSSkipVerify'. 5. If the assertion to LDAPConf is unsuccessful, it defaults to returning false.
Returns: The function returns a boolean indicating whether TLSSkipVerify is enabled (true) or not (false).
func (*File) GetLDAPSearchProtocol ¶
func (f *File) GetLDAPSearchProtocol(protocol string) (*LDAPSearchProtocol, error)
GetLDAPSearchProtocol is a method for the File type. It accepts a string which represents the protocol. The function searches for this protocol in the LDAP protocol list. If it finds it, the method returns a pointer to LDAPSearchProtocol and no error. If it cannot find the protocol, it checks if the default protocol is in use. If not, it returns nil and an error. If the default protocol is used, this method calls itself recursively with the default protocol parameter.
func (*File) GetLuaPackagePath ¶
GetLuaPackagePath is a method on the File struct. It retrieves the Lua package path based on the configuration. If the Lua backend configuration is not found, it returns the global Lua package path. If the Lua backend configuration is found, it returns the package path from the LuaConf struct. If the LuaConf struct is not of type *LuaConf, it also returns the global Lua package path.
func (*File) GetLuaScriptPath ¶
GetLuaScriptPath is a method on the File struct. It returns the Lua script path from the LuaConf field in the File struct. It first calls the GetConfig method with the global.BackendLua parameter to obtain the Lua configuration. If the Lua configuration is nil, it returns an empty string. If the Lua configuration is not nil, it asserts the retrieved configuration as a *LuaConf type. If the assertion is successful, it returns the ScriptPath field from the Lua configuration. If the assertion fails, it returns an empty string.
func (*File) GetLuaSearchProtocol ¶
func (f *File) GetLuaSearchProtocol(protocol string) (*LuaSearchProtocol, error)
GetLuaSearchProtocol is a method on the File struct. It takes a protocol string as input and returns a pointer to a LuaSearchProtocol struct and an error. This method searches for the specified protocol in the search::protocol sections of the Lua configuration. If the protocol is found, it returns the LuaSearchProtocol containing that protocol. If the protocol is not found and the input protocol is not the default protocol, it recursively calls itself with the default protocol as the input. If the protocol is not found and the input protocol is the default protocol, it returns nil and an error indicating that the search::protocol section is missing and there is no default.
func (*File) GetProtocols ¶
GetProtocols returns the protocol handler for the specified backend. The protocol handler is determined based on the backend type. If the backend is found, it retrieves the protocol handler associated with it and returns the result of calling the ProtoHandler() method on the protocol handler. If the protocol handler is not found, it returns nil.
func (*File) GetSection ¶
GetSection is a method on the File struct. It takes a backend of type global.Backend as parameter and returns the corresponding section. The method checks the value of the backend parameter and returns the appropriate section. If the backend is global.BackendLDAP, it returns f.LDAP. If the backend is global.BackendMySQL, global.BackendPostgres, or global.BackendSQL, it returns f.SQL. If the backend is global.BackendLua, it returns f.Lua. For any other value of the backend parameter, it returns nil.
func (*File) GetServer ¶
func (f *File) GetServer() *ServerSection
GetServer is a method on the File struct. It checks if the File struct has a ServerSection. If it does, it returns the ServerSection. Otherwise, it returns nil. Example usage:
server := file.GetServer() if server != nil { // do something with server }
func (*File) GetServerInsights ¶
GetServerInsights is a method on the File struct. It returns the Insights field from the Server struct, which is accessed through the GetServer() method on the File struct. If the File struct does not have a Server, it returns nil.
func (*File) GetServerInsightsEnableBlockProfile ¶
GetServerInsightsEnableBlockProfile is a method on the File struct. It returns the value of the EnableBlockProfile field from the ServerInsights field of the File struct. If the HaveServer method returns false, it will return false.
Example usage:
func enableBlockProfile() { if config.LoadableConfig.GetServerInsightsEnableBlockProfile() { runtime.SetBlockProfileRate(1) } else { runtime.SetBlockProfileRate(-1) } }
func (*File) GetServerInsightsEnablePprof ¶
GetServerInsightsEnablePprof is a method on the File struct. It checks if the File struct has a server and returns the value of EnablePprof from the ServerInsights field of the File struct. If the File struct does not have a server, it returns false.
Example usage:
if config.LoadableConfig.GetServerInsightsEnablePprof() { pprof.Register(router) }
func (*File) HasFeature ¶
HasFeature checks if the given feature exists in the LoadableConfig's Features list
func (*File) HaveLDAPBackend ¶
func (*File) HaveLua ¶
HaveLua is a method on the File struct. It checks if the Lua field in the File struct is not nil. It returns a boolean value indicating whether Lua is present or not.
func (*File) HaveLuaActions ¶
HaveLuaActions is a method on the File struct. It checks if the File struct has Lua actions. It returns true if the File struct has Lua actions, otherwise returns false.
func (*File) HaveLuaFeatures ¶
HaveLuaFeatures is a method on the File struct. It checks if the File struct has Lua features. It returns true if there are Lua features, and false otherwise.
func (*File) HaveLuaFilters ¶
HaveLuaFilters is a method on the File struct. It checks if the File struct has Lua filters. It returns true if there are Lua filters, and false otherwise.
func (*File) HaveServer ¶
HaveServer is a method on the File struct. It returns true if the Server field in the File struct is not nil, indicating that a server exists.
func (*File) LDAPHavePoolOnly ¶
LDAPHavePoolOnly is a method on the File struct. It checks if the LDAP field and LDAP.Config field are not nil, and returns the value of LDAP.Config.PoolOnly. Otherwise, it returns false.
func (*File) RetrieveGetterMap ¶
func (f *File) RetrieveGetterMap() map[global.Backend]GetterHandler
RetrieveGetterMap returns a map of GetterHandler interfaces for each supported backend. It creates a getterMap with a length of 3. If an LDAPSection is found for the LDAP backend, it adds it to the getterMap. If an SQLSection is found for the SQL backend, it adds it to the getterMap. If a LuaSection is found for the Lua backend, it adds it to the getterMap. Finally, it returns the getterMap.
type GetterHandler ¶
GetterHandler is an interface that defines two methods: GetConfig and GetSearch. Any type that implements this interface must provide implementations for both methods. The GetConfig method takes a *File parameter and returns a value of any type. The GetSearch method also takes a *File parameter and returns a value of any type.
type IdTokenClaims ¶
type IdTokenClaims struct { // Scope: profile. Name string GivenName string `mapstructure:"given_name"` FamilyName string `mapstructure:"family_name"` MiddleName string `mapstructure:"middle_name"` NickName string PreferredUserName string `mapstructure:"preferred_username"` Profile string Website string Picture string Gender string Birthdate string ZoneInfo string Locale string UpdatedAt string `mapstructure:"updated_at"` // Scope: email. Email string EmailVerified string `mapstructure:"email_verified"` // Scope: phone. PhoneNumber string `mapstructure:"phone_number"` PhoneNumberVerified string `mapstructure:"phone_number_verified"` // Scope: address. Address string // Scope: groups. Groups string // Scope: user defined. CustomClaims map[string]any `mapstructure:",remain"` }
func (*IdTokenClaims) String ¶
func (i *IdTokenClaims) String() string
type LDAPAttributeMapping ¶
type LDAPAttributeMapping struct { AccountField string `mapstructure:"account_field"` TOTPSecretField string `mapstructure:"totp_secret_field"` TOTPRecoveryField string `mapstructure:"totp_recovery_field"` DisplayNameField string `mapstructure:"display_name_field"` CredentialObject string `mapstructure:"credential_object"` CredentialIDField string `mapstructure:"credential_id_field"` PublicKeyField string `mapstructure:"public_key_field"` UniqueUserIDField string `mapstructure:"unique_user_id_field"` AAGUIDField string `mapstructure:"aaguid_field"` SignCountField string `mapstructure:"sign_count_field"` }
type LDAPConf ¶
type LDAPConf struct { PoolOnly bool `mapstructure:"pool_only"` StartTLS bool TLSSkipVerify bool `mapstructure:"tls_skip_verify"` SASLExternal bool `mapstructure:"sasl_external"` LookupPoolSize int `mapstructure:"lookup_pool_size"` LookupIdlePoolSize int `mapstructure:"lookup_idle_pool_size"` AuthPoolSize int `mapstructure:"auth_pool_size"` AuthIdlePoolSize int `mapstructure:"auth_idle_pool_size"` BindDN string `mapstructure:"bind_dn"` BindPW string `mapstructure:"bind_pw"` TLSCAFile string `mapstructure:"tls_ca_cert"` TLSClientCert string `mapstructure:"tls_client_cert"` TLSClientKey string `mapstructure:"tls_client_key"` ServerURIs []string `mapstructure:"server_uri"` }
type LDAPFilter ¶
type LDAPScope ¶
type LDAPScope struct {
// contains filtered or unexported fields
}
LDAPScope is the search scope for an LDAP server.
type LDAPSearchProtocol ¶
type LDAPSearchProtocol struct { Protocols []string `mapstructure:"protocol"` CacheName string `mapstructure:"cache_name"` BaseDN string `mapstructure:"base_dn"` Scope string LDAPFilter `mapstructure:"filter"` LDAPAttributeMapping `mapstructure:"mapping"` // LDAP result attributes Attributes []string `mapstructure:"attribute"` }
func (*LDAPSearchProtocol) GetAccountField ¶
func (p *LDAPSearchProtocol) GetAccountField() (string, error)
GetAccountField returns the LDAP attribute for an account. It returns a DetailedError, if no value has been configured.
func (*LDAPSearchProtocol) GetAttributes ¶
func (p *LDAPSearchProtocol) GetAttributes() ([]string, error)
GetAttributes returns a list of attributes that are requested from the LDAP server. It returns a DetailedError, if no value has been configured.
func (*LDAPSearchProtocol) GetBaseDN ¶
func (p *LDAPSearchProtocol) GetBaseDN() (string, error)
GetBaseDN returns the base DN that is used for each specific protocol. It returns a DetailedError, if no value has been configured.
func (*LDAPSearchProtocol) GetCacheName ¶
func (p *LDAPSearchProtocol) GetCacheName() (string, error)
GetCacheName returns the Redis cache domain. It returns a DetailedError, if no value has been configured.
func (*LDAPSearchProtocol) GetListAccountsFilter ¶
func (p *LDAPSearchProtocol) GetListAccountsFilter() (string, error)
GetListAccountsFilter returns an LDAP filter which is used to find all user accounts. It returns a DetailedError, if no value has been configured.
func (*LDAPSearchProtocol) GetScope ¶
func (p *LDAPSearchProtocol) GetScope() (*LDAPScope, error)
GetScope returns an LDAP search scope. If no scope was defined, it automatically sets the subtree scope. If a scope has been defined and is unknown, it returns a DetailedError.
func (*LDAPSearchProtocol) GetUserFilter ¶
func (p *LDAPSearchProtocol) GetUserFilter() (string, error)
GetUserFilter returns an LDAP search filter to find a user. It returns a DetailedError, if no value has been configured.
type LDAPSection ¶
type LDAPSection struct { Config *LDAPConf Search []LDAPSearchProtocol }
func (*LDAPSection) GetConfig ¶
func (l *LDAPSection) GetConfig() any
func (*LDAPSection) GetProtocols ¶
func (l *LDAPSection) GetProtocols() any
func (*LDAPSection) String ¶
func (l *LDAPSection) String() string
type LuaAction ¶
type LuaAction struct { ActionType string `mapstructure:"type"` ScriptPath string `mapstructure:"script_path"` }
type LuaConf ¶
type LuaFeature ¶
func (*LuaFeature) String ¶
func (l *LuaFeature) String() string
type LuaSearchProtocol ¶
type LuaSearchProtocol struct { Protocols []string `mapstructure:"protocol"` CacheName string `mapstructure:"cache_name"` }
func (*LuaSearchProtocol) GetCacheName ¶
func (l *LuaSearchProtocol) GetCacheName() (string, error)
GetCacheName returns the Redis cache domain. It returns a DetailedError, if no value has been configured.
type LuaSection ¶
type LuaSection struct { Actions []LuaAction Features []LuaFeature Filters []LuaFilter Config *LuaConf Search []LuaSearchProtocol }
func (*LuaSection) GetConfig ¶
func (l *LuaSection) GetConfig() any
func (*LuaSection) GetProtocols ¶
func (l *LuaSection) GetProtocols() any
func (*LuaSection) String ¶
func (l *LuaSection) String() string
type MasterUser ¶
type OIDCCustomClaim ¶
type Oauth2Client ¶
type Oauth2CustomScope ¶
type Oauth2CustomScope struct { Name string Description string Claims []OIDCCustomClaim Other map[string]any `mapstructure:",remain"` }
type Oauth2Section ¶
type Oauth2Section struct { CustomScopes []Oauth2CustomScope `mapstructure:"custom_scopes"` Clients []Oauth2Client }
func (*Oauth2Section) String ¶
func (o *Oauth2Section) String() string
type Protocol ¶
type Protocol struct {
// contains filtered or unexported fields
}
Protocol is the protocol used between a remote client and a server. This server sets the protocol in an HTTP request header "Auth-Protocol" (Nginx protocol).
func NewProtocol ¶
NewProtocol creates a new Protocol object with the given protocol string. It initializes the name field of the Protocol object.
Example usage: protocol := NewProtocol("http")
type RBLSection ¶
type RBLSection struct { Lists []RBL Threshold int IPWhiteList []string `mapstructure:"ip_whitelist"` }
func (*RBLSection) String ¶
func (r *RBLSection) String() string
type Redis ¶
type Redis struct { DatabaseNmuber int `mapstructure:"database_number"` Prefix string `mapstructure:"prefix"` PoolSize int `mapstructure:"pool_size"` IdlePoolSize int `mapstructure:"idle_pool_size"` TLS TLS `mapstructure:"tls"` PosCacheTTL uint `mapstructure:"positive_cache_ttl"` NegCacheTTL uint `mapstructure:"negative_cache_ttl"` Master Master `mapstructure:"master"` Replica Replica `mapstructure:"replica"` Sentinels Sentinels `mapstructure:"sentinels"` Cluster Cluster `mapstructure:"cluster"` }
type RelayDomainsSection ¶
type RelayDomainsSection struct {
StaticDomains []string `mapstructure:"static"`
}
func (*RelayDomainsSection) String ¶
func (r *RelayDomainsSection) String() string
type ServerSection ¶
type ServerSection struct { Address string `mapstructure:"address"` HAproxyV2 bool `mapstructure:"haproxy_v2"` TLS TLS `mapstructure:"tls"` BasicAuth BasicAuth `mapstructure:"basic_auth"` InstanceName string `mapstructure:"instance_name"` Log Log `maptostructure:"log"` Backends []*Backend `mapstructure:"backends"` Features []*Feature `mapstructure:"features"` BruteForceProtocols []*Protocol `mapstructure:"brute_force_protocols"` HydraAdminUrl string `mapstructure:"ory_hydra_admin_url"` DNS DNS `mapstructure:"dns"` Insights Insights `mapstructure:"insights"` Redis Redis `mapstructure:"redis"` MasterUser MasterUser `mapstructure:"master_user"` }
type StringSet ¶
StringSet is a storage container that ensures unique keys.
func (*StringSet) GetStringSlice ¶
GetStringSlice returns all values for a StringSet as a slice of strings.
type Verbosity ¶
type Verbosity struct {
// contains filtered or unexported fields
}
Verbosity is a type that represents the verbosity details.
func (*Verbosity) Set ¶
Set updates the verbosity level and name based on the provided value. It returns an error if the value is not valid. Valid values for the verbosity level are "none", "error", "warn", "info", and "debug". If the value is valid, the verboseLevel and name fields are updated accordingly. An error of type ErrWrongVerboseLevel is returned if the value is not valid.