feat: add support for database cert, key, ca-cert
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"log"
|
||||
"reflect"
|
||||
|
||||
"github.com/authorizerdev/authorizer/server/db"
|
||||
"github.com/authorizerdev/authorizer/server/db/models"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// StringSliceContains checks if a string slice contains a particular string
|
||||
@@ -19,23 +14,6 @@ func StringSliceContains(s []string, e string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// SaveSessionInDB saves sessions generated for a given user with meta information
|
||||
// Do not store token here as that could be security breach
|
||||
func SaveSessionInDB(c *gin.Context, userId string) {
|
||||
sessionData := models.Session{
|
||||
UserID: userId,
|
||||
UserAgent: GetUserAgent(c.Request),
|
||||
IP: GetIP(c.Request),
|
||||
}
|
||||
|
||||
err := db.Provider.AddSession(sessionData)
|
||||
if err != nil {
|
||||
log.Println("=> error saving session in db:", err)
|
||||
} else {
|
||||
log.Println("=> session saved in db:", sessionData)
|
||||
}
|
||||
}
|
||||
|
||||
// RemoveDuplicateString removes duplicate strings from a string slice
|
||||
func RemoveDuplicateString(strSlice []string) []string {
|
||||
allKeys := make(map[string]bool)
|
||||
|
Reference in New Issue
Block a user