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:
@@ -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()
|
||||
|
@@ -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
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user