feat: audit login (#5925)

* added migration for api key resource

* sort of working

* auditing login

* passing  the correct user id

* added and fixed tests

* gen documentation

* formatting and lint

* lint

* audit Github oauth and write tests

* audit oauth and write  tests

* added defer fn for login error auditing

* fixed test

* feat: audit logout (#5998)

* Update coderd/userauth.go

Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>

* fix test

* bypassing diff generation if login/logout

* lint

---------

Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
This commit is contained in:
Kira Pilot
2023-02-06 15:12:50 -05:00
committed by GitHub
co-authored by Steven Masley
parent 060eeed5c3
commit 46fe59f5e7
29 changed files with 679 additions and 259 deletions
+7 -1
View File
@@ -144,6 +144,8 @@ const (
AuditActionDelete AuditAction = "delete"
AuditActionStart AuditAction = "start"
AuditActionStop AuditAction = "stop"
AuditActionLogin AuditAction = "login"
AuditActionLogout AuditAction = "logout"
)
func (e *AuditAction) Scan(src interface{}) error {
@@ -187,7 +189,9 @@ func (e AuditAction) Valid() bool {
AuditActionWrite,
AuditActionDelete,
AuditActionStart,
AuditActionStop:
AuditActionStop,
AuditActionLogin,
AuditActionLogout:
return true
}
return false
@@ -200,6 +204,8 @@ func AllAuditActionValues() []AuditAction {
AuditActionDelete,
AuditActionStart,
AuditActionStop,
AuditActionLogin,
AuditActionLogout,
}
}