feat(authentication): disabled users in yaml file (#4193)
Allows setting users as disabled.pull/4194/head
parent
b993c290b0
commit
d610874be4
|
@ -31,21 +31,25 @@ users:
|
||||||
groups:
|
groups:
|
||||||
- admins
|
- admins
|
||||||
- dev
|
- dev
|
||||||
|
disabled: false
|
||||||
harry:
|
harry:
|
||||||
displayname: "Harry Potter"
|
displayname: "Harry Potter"
|
||||||
password: "$argon2id$v=19$m=65536,t=3,p=2$BpLnfgDsc2WD8F2q$o/vzA4myCqZZ36bUGsDY//8mKUYNZZaR0t4MFFSs+iM"
|
password: "$argon2id$v=19$m=65536,t=3,p=2$BpLnfgDsc2WD8F2q$o/vzA4myCqZZ36bUGsDY//8mKUYNZZaR0t4MFFSs+iM"
|
||||||
email: harry.potter@authelia.com
|
email: harry.potter@authelia.com
|
||||||
groups: []
|
groups: []
|
||||||
|
disabled: false
|
||||||
bob:
|
bob:
|
||||||
displayname: "Bob Dylan"
|
displayname: "Bob Dylan"
|
||||||
password: "$argon2id$v=19$m=65536,t=3,p=2$BpLnfgDsc2WD8F2q$o/vzA4myCqZZ36bUGsDY//8mKUYNZZaR0t4MFFSs+iM"
|
password: "$argon2id$v=19$m=65536,t=3,p=2$BpLnfgDsc2WD8F2q$o/vzA4myCqZZ36bUGsDY//8mKUYNZZaR0t4MFFSs+iM"
|
||||||
email: bob.dylan@authelia.com
|
email: bob.dylan@authelia.com
|
||||||
groups:
|
groups:
|
||||||
- dev
|
- dev
|
||||||
|
disabled: false
|
||||||
james:
|
james:
|
||||||
displayname: "James Dean"
|
displayname: "James Dean"
|
||||||
password: "$argon2id$v=19$m=65536,t=3,p=2$BpLnfgDsc2WD8F2q$o/vzA4myCqZZ36bUGsDY//8mKUYNZZaR0t4MFFSs+iM"
|
password: "$argon2id$v=19$m=65536,t=3,p=2$BpLnfgDsc2WD8F2q$o/vzA4myCqZZ36bUGsDY//8mKUYNZZaR0t4MFFSs+iM"
|
||||||
email: james.dean@authelia.com
|
email: james.dean@authelia.com
|
||||||
|
disabled: false
|
||||||
```
|
```
|
||||||
|
|
||||||
## Passwords
|
## Passwords
|
||||||
|
|
|
@ -145,6 +145,10 @@ func (m *DatabaseModel) ReadToFileUserDatabase(db *FileUserDatabase) (err error)
|
||||||
var udm *DatabaseUserDetails
|
var udm *DatabaseUserDetails
|
||||||
|
|
||||||
for user, details := range m.Users {
|
for user, details := range m.Users {
|
||||||
|
if details.Disabled {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if udm, err = details.ToDatabaseUserDetailsModel(user); err != nil {
|
if udm, err = details.ToDatabaseUserDetailsModel(user); err != nil {
|
||||||
return fmt.Errorf("failed to parse hash for user '%s': %w", user, err)
|
return fmt.Errorf("failed to parse hash for user '%s': %w", user, err)
|
||||||
}
|
}
|
||||||
|
@ -206,6 +210,7 @@ type UserDetailsModel struct {
|
||||||
DisplayName string `yaml:"displayname" valid:"required"`
|
DisplayName string `yaml:"displayname" valid:"required"`
|
||||||
Email string `yaml:"email"`
|
Email string `yaml:"email"`
|
||||||
Groups []string `yaml:"groups"`
|
Groups []string `yaml:"groups"`
|
||||||
|
Disabled bool `yaml:"disabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDatabaseUserDetailsModel converts a UserDetailsModel into a *DatabaseUserDetails.
|
// ToDatabaseUserDetailsModel converts a UserDetailsModel into a *DatabaseUserDetails.
|
||||||
|
|
Loading…
Reference in New Issue