Documentation
¶
Index ¶
- Constants
- Variables
- func AddUserInfo(userInfo *auth.UserInfo) error
- func CheckDatabaseRegister(s string, id *common.Reference) bool
- func CheckUserExist(user string) *auth.UserInfo
- func DumpStat()
- func GetAdaDataDir() string
- func GetAllViews() []string
- func GetInstallation() []string
- func InitBatchRepository(dbRef *common.Reference, dbPassword, tablename string) bool
- func InitBatchWatcherThread()
- func InitStoreInfo(ref *common.Reference, password, tablename string)
- func InitUserInfo(ref *common.Reference, password, tablename string)
- func LoadConfig(watch bool, loaderInterface services.ConfigInterface) error
- func LoadMessages()
- func LoadedConfig()
- func QueryUser(user string) *auth.UserInfo
- func RegisterConfigUpdates(f func())
- type Admin
- type BatchEntry
- type CommonConfig
- type Context
- func (sc *Context) AddRoles(r []string)
- func (sc *Context) Created() time.Time
- func (sc *Context) Deadline() (deadline time.Time, ok bool)
- func (sc *Context) Done() <-chan struct{}
- func (sc *Context) EMail() string
- func (sc *Context) Err() error
- func (sc *Context) GetData(key string) any
- func (sc *Context) LastLogin() time.Time
- func (sc *Context) LongName() string
- func (sc *Context) Name() string
- func (sc *Context) Permission() *auth.User
- func (sc *Context) Picture() string
- func (sc *Context) Remote() string
- func (sc *Context) Roles() []string
- func (sc *Context) SendAuditError(started time.Time, err error)
- func (sc *Context) Session() interface{}
- func (sc *Context) SetLongName(longName string)
- func (sc *Context) SetRemote(r string)
- func (sc *Context) SetSession(s interface{})
- func (sc *Context) StoreData(key string, value any)
- func (sc *Context) UUID() string
- func (sc *Context) UpdateLastLogin()
- func (sc *Context) User() *auth.UserInfo
- func (sc *Context) UserName() string
- func (sc *Context) Value(key any) any
- type Database
- type DatabaseAccess
- type DatabaseConfig
- type DatabaseMap
- type DatabaseRegister
- type Directory
- type ErrorType
- type FileTransferConfig
- type Location
- type LoginService
- type Mapping
- type RestServer
- type Server
- type Service
- type SessionConfig
- type StatisticConfig
- type StoreJWTHandler
- func (st *StoreJWTHandler) InvalidateUUID(uuid string, elapsed time.Time) bool
- func (st *StoreJWTHandler) Range(f func(uuid, value any) bool) error
- func (st *StoreJWTHandler) Store(principal auth.PrincipalInterface, user, pass string) (err error)
- func (st *StoreJWTHandler) UUIDInfo(uuid string) (*auth.SessionInfo, error)
- func (st *StoreJWTHandler) ValidateUUID(claims *auth.JWTClaims) (auth.PrincipalInterface, bool)
- type TaskConfig
Constants ¶
const ( // DefaultConfigFileEnv default environment name to search configuration file at DefaultConfigFileEnv = "SERVER_CONFIG" // InstallationDirName directory name of product installation location InstallationDirName = "." // ServiceName servoce name of product ServiceName = "clutronapi" )
const DefaultRole = "Reader"
DefaultRole default role for automatic added user
Variables ¶
var AddLocation = func(name, location string) error { if name != "" && os.ExpandEnv(location) != "" { services.ServerMessage("Add location %s at %s", name, location) } return nil }
AddLocation add location, only needed in active server
Audit callback function to be enabled
var CurrentConfig = ""
CurrentConfig current config name
var DeleteUUID = false
DeleteUUID delete UUID after regular time frame
var InitAdmin func(*RestServer)
InitAdmin init Adabas admin function, only need in active server
var InitDirectAccess func(*RestServer)
InitDirectAccess init Adabas direct access function, only need in active server
Functions ¶
func AddUserInfo ¶
AddUserInfo add user if not already exists and create if not available
func CheckDatabaseRegister ¶
CheckDatabaseRegister check database register
func CheckUserExist ¶
CheckUserExist check user already exists and create if not available
func InitBatchRepository ¶
InitBatchRepository init batch repository
func InitBatchWatcherThread ¶
func InitBatchWatcherThread()
InitBatchWatcherThread initialize batch watcher
func InitStoreInfo ¶
InitStoreInfo init session info storage
func InitUserInfo ¶
InitUserInfo init user info evaluation
func LoadConfig ¶
func LoadConfig(watch bool, loaderInterface services.ConfigInterface) error
LoadConfig load xml configuration file The components are used to load and inject the configuration
func RegisterConfigUpdates ¶
func RegisterConfigUpdates(f func())
RegisterConfigUpdates register configuration trigger function
Types ¶
type Admin ¶
type Admin struct {
Role string `yaml:"role,omitempty"`
UseRole bool `yaml:"use_role,omitempty"`
NoModification bool `yaml:"NoModification,omitempty"`
}
Admin suite installation
type BatchEntry ¶
BatchEntry entry of batch repository
func BatchSelect ¶
func BatchSelect(batchname string) (*BatchEntry, error)
BatchSelect search for batchname in an batch repository
type CommonConfig ¶
type CommonConfig struct {
Version string `yaml:"version"`
ConfigWatcher bool `yaml:"configWatcher,omitempty"`
MaxBinaryBufferSize int `yaml:"maxBinaryBufferSize,omitempty"`
StatisticTimer bool `yaml:"statisticTimer,omitempty"`
AppURL string `yaml:"AppURL,omitempty"`
}
CommonConfig server config base
type Context ¶
type Context struct {
// User string
Pass string
Auth struct {
Roles []string
Remote string
Session interface{}
}
Token string
CurrentRequest *http.Request
// contains filtered or unexported fields
}
Context server context
func NewContext
deprecated
func NewContextUserInfo ¶
NewContextUserInfo new server context with user information and password
func (*Context) Permission ¶
Permission return user permission
func (*Context) SendAuditError ¶
SendAuditError send audit error in context
func (*Context) Session ¶
func (sc *Context) Session() interface{}
Session session info interface function
func (*Context) SetLongName ¶
SetLongName set long name of user
func (*Context) SetSession ¶
func (sc *Context) SetSession(s interface{})
SetSession set session info interface function
func (*Context) UpdateLastLogin ¶
func (sc *Context) UpdateLastLogin()
UpdateLastLogin set last login of user
type Database ¶
type Database struct {
Driver string `yaml:"driver"`
User string `yaml:"user,omitempty"`
Password string `yaml:"password,omitempty"`
Target string `yaml:"target,omitempty"`
Table string `yaml:"table,omitempty"`
Tables []string `yaml:"tables,omitempty"`
Enabled bool `yaml:"enabled,omitempty"`
AuthenticationGlobal bool `yaml:"global_authentication,omitempty"`
}
Database database
func (*Database) RegisterDatabase ¶
RegisterDatabase register database for table
type DatabaseAccess ¶
type DatabaseAccess struct {
Global bool `yaml:"global,omitempty"`
Database []Database `yaml:"databases,omitempty"`
}
DatabaseAccess database access
type DatabaseConfig ¶
type DatabaseConfig struct {
Mapping Mapping `yaml:"modelling"`
DatabaseAccess DatabaseAccess `yaml:"access"`
SessionInfo *SessionConfig `yaml:"sessionInfo"`
UserInfo *Database `yaml:"userInfo"`
BatchRepository *Database `yaml:"batchRepository"`
}
DatabaseConfig database modelling and access
type DatabaseMap ¶
type DatabaseMap struct {
Name string `yaml:"Name"`
SrcDatabase string `yaml:"Database"`
SQL string `yaml:"SQL"`
SrcTable string `yaml:"SourceTable"`
SrcField string `yaml:"SourceField"`
DestTable string `yaml:"DestinationTable"`
DestField string `yaml:"DestinationField"`
}
DatabaseMap database modelling configuration
type DatabaseRegister ¶
type DatabaseRegister struct {
Reference *common.Reference
Database *Database
// contains filtered or unexported fields
}
DatabaseRegister database register
func SearchTable ¶
func SearchTable(table string) (*DatabaseRegister, error)
SearchTable search table ref ID
type FileTransferConfig ¶
type FileTransferConfig struct {
Admin Admin `yaml:"Admin"`
Directories struct {
Role string `yaml:"role,omitempty"`
UseRole bool `yaml:"use_role,omitempty"`
Directory []Directory `yaml:"directory"`
} `yaml:"directories"`
}
FileTransferConfig file transfer config
type Location ¶
type Location struct {
Location string `yaml:"location"`
}
Location location attribute
type LoginService ¶
type LoginService struct {
Type string `yaml:"type,omitempty"`
Module string `yaml:"module,omitempty"`
Administrators string `yaml:"administrators,omitempty"`
Users string `yaml:"users,omitempty"`
AuthenticationServer []*auth.AuthenticationServer `yaml:"authenticationServer,omitempty"`
}
LoginService login service
type Mapping ¶
type Mapping struct {
CacheUpdater int `yaml:"cacheTimer,omitempty"`
DatabaseMap []DatabaseMap `yaml:"Modeling"`
}
Mapping Adabas Maps
type RestServer ¶
type RestServer struct {
Common CommonConfig `yaml:"rest-server"`
Server Server `yaml:"server"`
Database DatabaseConfig `yaml:"database"`
Tasks TaskConfig `yaml:"tasks"`
FileTransfer FileTransferConfig `yaml:"fileTransfer"`
Metrics []*Database
}
RestServer Rest server main node configuration structure containing all referenced parameters reflected to the configuration file.
var Viewer *RestServer
Viewer containing server config
func (*RestServer) CloseConfig ¶
func (viewer *RestServer) CloseConfig()
CloseConfig close configuration watcher
func (*RestServer) InitSecurityInfrastructure ¶
func (viewer *RestServer) InitSecurityInfrastructure()
InitSecurityInfrastructure init configruation data
type Server ¶
type Server struct {
Service []*Service `yaml:"service"`
WebToken *auth.WebToken `yaml:"JWT,omitempty"`
LoginService LoginService `yaml:"login"`
Prefix string `yaml:"prefix,omitempty"`
Content string `yaml:"content,omitempty"`
Plugins string `yaml:"plugins,omitempty"`
LogLocation *services.Logging `yaml:"location"`
Shutdown struct {
Passcode yaml.Node `yaml:"passcode,omitempty"`
} `yaml:"shutdown"`
}
Server REST server main configuration parameter
type Service ¶
type Service struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
Type string `yaml:"type"`
Certificate string `yaml:"certificate,omitempty"`
Key string `yaml:"key,omitempty"`
MaxHeaderSize flagext.ByteSize `yaml:"maxHeaderSize"`
ReadTimeout time.Duration `yaml:"readTimeout"`
WriteTimeout time.Duration `yaml:"writeTimeout"`
KeepAlive int `yaml:"keepAive"`
ListenLimit int `yaml:"listenLimit"`
CleanupTimeout time.Duration `yaml:"cleanupTimeout"`
TLSCACertificate string `yaml:"TLSCaCertificate"`
TLSCertificate string
TLSCertificateKey string
}
Service service entry
type SessionConfig ¶
type SessionConfig struct {
DeleteUUID bool `yaml:"deleteUUID"`
Database *Database `yaml:"database"`
}
SessionConfig session configuration
type StatisticConfig ¶
type StatisticConfig struct {
Metrics *DatabaseAccess `yaml:"metrics"`
}
StatisticConfig statistics configuration
type StoreJWTHandler ¶
type StoreJWTHandler struct {
}
StoreJWTHandler store session in a database store
func (*StoreJWTHandler) InvalidateUUID ¶
func (st *StoreJWTHandler) InvalidateUUID(uuid string, elapsed time.Time) bool
InvalidateUUID invalidate UUID entry and given elapsed time
func (*StoreJWTHandler) Range ¶
func (st *StoreJWTHandler) Range(f func(uuid, value any) bool) error
Range go through all session entries
func (*StoreJWTHandler) Store ¶
func (st *StoreJWTHandler) Store(principal auth.PrincipalInterface, user, pass string) (err error)
Store store entry for given input
func (*StoreJWTHandler) UUIDInfo ¶
func (st *StoreJWTHandler) UUIDInfo(uuid string) (*auth.SessionInfo, error)
UUIDInfo get UUID info User information
func (*StoreJWTHandler) ValidateUUID ¶
func (st *StoreJWTHandler) ValidateUUID(claims *auth.JWTClaims) (auth.PrincipalInterface, bool)
ValidateUUID validate JWT claims are in UUID session list