Updating JWT to use certificates

This commit is contained in:
2026-04-02 17:04:13 -04:00
parent 571aab64bb
commit 22a23c0062
6 changed files with 20 additions and 67 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"io"
"libshared"
"log"
"net/http"
"strings"
@@ -90,7 +91,7 @@ func getRoleToken(w http.ResponseWriter, r *http.Request) {
log.Println("Authentication would taken place here")
// Check if policy with the same name already exists for the account
checkExisting := pool.QueryRow(context.Background(),
checkExisting := libshared.Pool.QueryRow(context.Background(),
"SELECT FROM roles WHERE accountid = $1 AND rolename = $2",
claims.Account, role.RoleName)
log.Println("checkExisting:", role.RoleName)
@@ -100,7 +101,7 @@ func getRoleToken(w http.ResponseWriter, r *http.Request) {
return
}
usertoken, err := createJWT(secret, claims.Account, role.RoleName)
usertoken, err := libshared.CreateJWT(privateKey, claims.Account, role.RoleName, "role")
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return