mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-25 12:59:06 +01:00
Move data structures to config package
This commit is contained in:
parent
937e72954d
commit
b7907d33aa
@ -80,7 +80,8 @@ type Authentication struct {
|
|||||||
LocalAuth *LocalAuthenticator
|
LocalAuth *LocalAuthenticator
|
||||||
}
|
}
|
||||||
|
|
||||||
func Init(db *sqlx.DB, configs map[string]interface{}) (*Authentication, error) {
|
func Init(db *sqlx.DB,
|
||||||
|
configs map[string]interface{}) (*Authentication, error) {
|
||||||
auth := &Authentication{}
|
auth := &Authentication{}
|
||||||
auth.db = db
|
auth.db = db
|
||||||
_, err := db.Exec(`
|
_, err := db.Exec(`
|
||||||
|
@ -9,10 +9,25 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/ClusterCockpit/cc-backend/internal/auth"
|
|
||||||
"github.com/ClusterCockpit/cc-backend/internal/graph/model"
|
"github.com/ClusterCockpit/cc-backend/internal/graph/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type LdapConfig struct {
|
||||||
|
Url string `json:"url"`
|
||||||
|
UserBase string `json:"user_base"`
|
||||||
|
SearchDN string `json:"search_dn"`
|
||||||
|
UserBind string `json:"user_bind"`
|
||||||
|
UserFilter string `json:"user_filter"`
|
||||||
|
SyncInterval string `json:"sync_interval"` // Parsed using time.ParseDuration.
|
||||||
|
SyncDelOldUsers bool `json:"sync_del_old_users"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type JWTAuthConfig struct {
|
||||||
|
// Specifies for how long a session or JWT shall be valid
|
||||||
|
// as a string parsable by time.ParseDuration().
|
||||||
|
MaxAge int64 `json:"max-age"`
|
||||||
|
}
|
||||||
|
|
||||||
type Cluster struct {
|
type Cluster struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
FilterRanges *model.FilterRanges `json:"filterRanges"`
|
FilterRanges *model.FilterRanges `json:"filterRanges"`
|
||||||
@ -51,8 +66,8 @@ type ProgramConfig struct {
|
|||||||
DisableArchive bool `json:"disable-archive"`
|
DisableArchive bool `json:"disable-archive"`
|
||||||
|
|
||||||
// For LDAP Authentication and user synchronisation.
|
// For LDAP Authentication and user synchronisation.
|
||||||
LdapConfig *auth.LdapConfig `json:"ldap"`
|
LdapConfig *LdapConfig `json:"ldap"`
|
||||||
JwtConfig *auth.JWTAuthConfig `json:"jwts"`
|
JwtConfig *JWTAuthConfig `json:"jwts"`
|
||||||
|
|
||||||
// If 0 or empty, the session/token does not expire!
|
// If 0 or empty, the session/token does not expire!
|
||||||
SessionMaxAge string `json:"session-max-age"`
|
SessionMaxAge string `json:"session-max-age"`
|
||||||
|
Loading…
Reference in New Issue
Block a user