Updating JWT to use certificates
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user