@@ -169,6 +169,7 @@ func validateFactors(db *storage.Connection, user *models.User, newFactorName st
169
169
170
170
func (a * API ) enrollPhoneFactor (w http.ResponseWriter , r * http.Request , params * EnrollFactorParams ) error {
171
171
ctx := r .Context ()
172
+ config := a .config
172
173
user := getUser (ctx )
173
174
session := getSession (ctx )
174
175
db := a .db .WithContext (ctx )
@@ -208,7 +209,7 @@ func (a *API) enrollPhoneFactor(w http.ResponseWriter, r *http.Request, params *
208
209
if terr := tx .Create (factor ); terr != nil {
209
210
return terr
210
211
}
211
- if terr := models .NewAuditLogEntry (r , tx , user , models .EnrollFactorAction , r .RemoteAddr , map [string ]interface {}{
212
+ if terr := models .NewAuditLogEntry (config . AuditLog , r , tx , user , models .EnrollFactorAction , r .RemoteAddr , map [string ]interface {}{
212
213
"factor_id" : factor .ID ,
213
214
"factor_type" : factor .FactorType ,
214
215
}); terr != nil {
@@ -230,6 +231,7 @@ func (a *API) enrollPhoneFactor(w http.ResponseWriter, r *http.Request, params *
230
231
func (a * API ) enrollWebAuthnFactor (w http.ResponseWriter , r * http.Request , params * EnrollFactorParams ) error {
231
232
ctx := r .Context ()
232
233
user := getUser (ctx )
234
+ config := a .config
233
235
session := getSession (ctx )
234
236
db := a .db .WithContext (ctx )
235
237
@@ -242,7 +244,7 @@ func (a *API) enrollWebAuthnFactor(w http.ResponseWriter, r *http.Request, param
242
244
if terr := tx .Create (factor ); terr != nil {
243
245
return terr
244
246
}
245
- if terr := models .NewAuditLogEntry (r , tx , user , models .EnrollFactorAction , r .RemoteAddr , map [string ]interface {}{
247
+ if terr := models .NewAuditLogEntry (config . AuditLog , r , tx , user , models .EnrollFactorAction , r .RemoteAddr , map [string ]interface {}{
246
248
"factor_id" : factor .ID ,
247
249
"factor_type" : factor .FactorType ,
248
250
}); terr != nil {
@@ -311,7 +313,7 @@ func (a *API) enrollTOTPFactor(w http.ResponseWriter, r *http.Request, params *E
311
313
return terr
312
314
}
313
315
314
- if terr := models .NewAuditLogEntry (r , tx , user , models .EnrollFactorAction , r .RemoteAddr , map [string ]interface {}{
316
+ if terr := models .NewAuditLogEntry (config . AuditLog , r , tx , user , models .EnrollFactorAction , r .RemoteAddr , map [string ]interface {}{
315
317
"factor_id" : factor .ID ,
316
318
}); terr != nil {
317
319
return terr
@@ -435,7 +437,7 @@ func (a *API) challengePhoneFactor(w http.ResponseWriter, r *http.Request) error
435
437
return terr
436
438
}
437
439
438
- if terr := models .NewAuditLogEntry (r , tx , user , models .CreateChallengeAction , r .RemoteAddr , map [string ]interface {}{
440
+ if terr := models .NewAuditLogEntry (config . AuditLog , r , tx , user , models .CreateChallengeAction , r .RemoteAddr , map [string ]interface {}{
439
441
"factor_id" : factor .ID ,
440
442
"factor_status" : factor .Status ,
441
443
}); terr != nil {
@@ -467,7 +469,7 @@ func (a *API) challengeTOTPFactor(w http.ResponseWriter, r *http.Request) error
467
469
if terr := factor .WriteChallengeToDatabase (tx , challenge ); terr != nil {
468
470
return terr
469
471
}
470
- if terr := models .NewAuditLogEntry (r , tx , user , models .CreateChallengeAction , r .RemoteAddr , map [string ]interface {}{
472
+ if terr := models .NewAuditLogEntry (config . AuditLog , r , tx , user , models .CreateChallengeAction , r .RemoteAddr , map [string ]interface {}{
471
473
"factor_id" : factor .ID ,
472
474
"factor_status" : factor .Status ,
473
475
}); terr != nil {
@@ -672,7 +674,7 @@ func (a *API) verifyTOTPFactor(w http.ResponseWriter, r *http.Request, params *V
672
674
673
675
err = db .Transaction (func (tx * storage.Connection ) error {
674
676
var terr error
675
- if terr = models .NewAuditLogEntry (r , tx , user , models .VerifyFactorAction , r .RemoteAddr , map [string ]interface {}{
677
+ if terr = models .NewAuditLogEntry (config . AuditLog , r , tx , user , models .VerifyFactorAction , r .RemoteAddr , map [string ]interface {}{
676
678
"factor_id" : factor .ID ,
677
679
"challenge_id" : challenge .ID ,
678
680
"factor_type" : factor .FactorType ,
@@ -811,7 +813,7 @@ func (a *API) verifyPhoneFactor(w http.ResponseWriter, r *http.Request, params *
811
813
812
814
err = db .Transaction (func (tx * storage.Connection ) error {
813
815
var terr error
814
- if terr = models .NewAuditLogEntry (r , tx , user , models .VerifyFactorAction , r .RemoteAddr , map [string ]interface {}{
816
+ if terr = models .NewAuditLogEntry (config . AuditLog , r , tx , user , models .VerifyFactorAction , r .RemoteAddr , map [string ]interface {}{
815
817
"factor_id" : factor .ID ,
816
818
"challenge_id" : challenge .ID ,
817
819
"factor_type" : factor .FactorType ,
@@ -855,6 +857,7 @@ func (a *API) verifyPhoneFactor(w http.ResponseWriter, r *http.Request, params *
855
857
856
858
func (a * API ) verifyWebAuthnFactor (w http.ResponseWriter , r * http.Request , params * VerifyFactorParams ) error {
857
859
ctx := r .Context ()
860
+ config := a .config
858
861
user := getUser (ctx )
859
862
factor := getFactor (ctx )
860
863
db := a .db .WithContext (ctx )
@@ -910,7 +913,7 @@ func (a *API) verifyWebAuthnFactor(w http.ResponseWriter, r *http.Request, param
910
913
var token * AccessTokenResponse
911
914
err = db .Transaction (func (tx * storage.Connection ) error {
912
915
var terr error
913
- if terr = models .NewAuditLogEntry (r , tx , user , models .VerifyFactorAction , r .RemoteAddr , map [string ]interface {}{
916
+ if terr = models .NewAuditLogEntry (config . AuditLog , r , tx , user , models .VerifyFactorAction , r .RemoteAddr , map [string ]interface {}{
914
917
"factor_id" : factor .ID ,
915
918
"challenge_id" : challenge .ID ,
916
919
"factor_type" : factor .FactorType ,
@@ -991,6 +994,7 @@ func (a *API) VerifyFactor(w http.ResponseWriter, r *http.Request) error {
991
994
func (a * API ) UnenrollFactor (w http.ResponseWriter , r * http.Request ) error {
992
995
var err error
993
996
ctx := r .Context ()
997
+ config := a .config
994
998
user := getUser (ctx )
995
999
factor := getFactor (ctx )
996
1000
session := getSession (ctx )
@@ -1009,7 +1013,7 @@ func (a *API) UnenrollFactor(w http.ResponseWriter, r *http.Request) error {
1009
1013
if terr := tx .Destroy (factor ); terr != nil {
1010
1014
return terr
1011
1015
}
1012
- if terr = models .NewAuditLogEntry (r , tx , user , models .UnenrollFactorAction , r .RemoteAddr , map [string ]interface {}{
1016
+ if terr = models .NewAuditLogEntry (config . AuditLog , r , tx , user , models .UnenrollFactorAction , r .RemoteAddr , map [string ]interface {}{
1013
1017
"factor_id" : factor .ID ,
1014
1018
"factor_status" : factor .Status ,
1015
1019
"session_id" : session .ID ,
0 commit comments