1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-09-09 03:08:57 +00:00

Use JWT_PRIVATE_KEY (#697)

Co-authored-by: 杨赫然 <heran.yang@seafile.com>
This commit is contained in:
feiniks
2024-09-10 15:43:25 +08:00
committed by GitHub
parent 594bed8c41
commit f0c95b4e77
3 changed files with 2 additions and 12 deletions

View File

@@ -46,8 +46,6 @@ var (
// notification server
EnableNotification bool
NotificationURL string
// notification options
PrivateKey string
// GROUP options
GroupTableName string
@@ -107,11 +105,6 @@ func LoadFileServerOptions(centralDir string) {
if EnableNotification {
var notifServer string
var notifPort uint32
if section, err := config.GetSection("notification"); err == nil {
if key, err := section.GetKey("jwt_private_key"); err == nil {
PrivateKey = key.String()
}
}
if section, err := config.GetSection("notification"); err == nil {
if key, err := section.GetKey("host"); err == nil {
notifServer = key.String()

View File

@@ -771,7 +771,7 @@ func genJWTToken(repoID, user string) (string, error) {
}
token := jwt.NewWithClaims(jwt.GetSigningMethod("HS256"), &claims)
tokenString, err := token.SignedString([]byte(option.PrivateKey))
tokenString, err := token.SignedString([]byte(seahubPK))
if err != nil {
err := fmt.Errorf("failed to gen jwt token for repo %s", repoID)
return "", err

View File

@@ -204,10 +204,7 @@ seafile_session_new(const char *central_config_dir,
"notification", "port",
NULL);
notif_server_private_key = g_key_file_get_string (config,
"notification", "jwt_private_key",
NULL);
session->notif_server_private_key = notif_server_private_key;
session->notif_server_private_key = g_strdup (private_key);
}
if (load_database_config (session) < 0) {