mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-05 20:31:42 +02:00
Rename "private_key" to "certificate_key"
This commit is contained in:
parent
aecf64fc03
commit
d5d4cb9e63
6 changed files with 9 additions and 10 deletions
|
@ -188,12 +188,12 @@ ErrorOr<std::string> AuthInfo::getToken(const std::string& username, const std::
|
||||||
jwt.setIat(now);
|
jwt.setIat(now);
|
||||||
jwt.setExp(now + 10h);
|
jwt.setExp(now + 10h);
|
||||||
jwt.setSub(username);
|
jwt.setSub(username);
|
||||||
std::ifstream ifs(settings_.ssl.private_key);
|
std::ifstream ifs(settings_.ssl.certificate_key);
|
||||||
std::string private_key((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
|
std::string certificate_key((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
|
||||||
if (!ifs.good())
|
if (!ifs.good())
|
||||||
return ErrorCode{std::make_error_code(std::errc::io_error), "Failed to read private key file"};
|
return ErrorCode{std::make_error_code(std::errc::io_error), "Failed to read private key file"};
|
||||||
// TODO tls: eroor handling
|
// TODO tls: eroor handling
|
||||||
std::optional<std::string> token = jwt.getToken(private_key);
|
std::optional<std::string> token = jwt.getToken(certificate_key);
|
||||||
if (!token.has_value())
|
if (!token.has_value())
|
||||||
return ErrorCode{AuthErrc::failed_to_create_token};
|
return ErrorCode{AuthErrc::failed_to_create_token};
|
||||||
return token.value();
|
return token.value();
|
||||||
|
|
|
@ -55,10 +55,10 @@ ControlServer::ControlServer(boost::asio::io_context& io_context, const ServerSe
|
||||||
return pw;
|
return pw;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!ssl.certificate.empty() && !ssl.private_key.empty())
|
if (!ssl.certificate.empty() && !ssl.certificate_key.empty())
|
||||||
{
|
{
|
||||||
ssl_context_.use_certificate_chain_file(ssl.certificate);
|
ssl_context_.use_certificate_chain_file(ssl.certificate);
|
||||||
ssl_context_.use_private_key_file(ssl.private_key, boost::asio::ssl::context::pem);
|
ssl_context_.use_private_key_file(ssl.certificate_key, boost::asio::ssl::context::pem);
|
||||||
}
|
}
|
||||||
// ssl_context_.use_tmp_dh_file("dh4096.pem");
|
// ssl_context_.use_tmp_dh_file("dh4096.pem");
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "control_session_http.hpp"
|
#include "control_session_http.hpp"
|
||||||
|
|
||||||
// local headers
|
// local headers
|
||||||
#include "authinfo.hpp"
|
|
||||||
#include "common/aixlog.hpp"
|
#include "common/aixlog.hpp"
|
||||||
#include "common/utils/file_utils.hpp"
|
#include "common/utils/file_utils.hpp"
|
||||||
#include "control_session_ws.hpp"
|
#include "control_session_ws.hpp"
|
||||||
|
|
|
@ -57,9 +57,9 @@
|
||||||
# certificate =
|
# certificate =
|
||||||
|
|
||||||
# Private key file in PEM format
|
# Private key file in PEM format
|
||||||
# private_key =
|
# certificate_key =
|
||||||
|
|
||||||
# Password for decryption of the private_key (only needed for encrypted private_key file)
|
# Password for decryption of the certificate_key (only needed for encrypted certificate_key file)
|
||||||
# key_password =
|
# key_password =
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct ServerSettings
|
||||||
struct Ssl
|
struct Ssl
|
||||||
{
|
{
|
||||||
std::string certificate{""};
|
std::string certificate{""};
|
||||||
std::string private_key{""};
|
std::string certificate_key{""};
|
||||||
std::string key_password{""};
|
std::string key_password{""};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
// SSL settings
|
// SSL settings
|
||||||
conf.add<Value<string>>("", "ssl.certificate", "certificate file (PEM format)", settings.ssl.certificate, &settings.ssl.certificate);
|
conf.add<Value<string>>("", "ssl.certificate", "certificate file (PEM format)", settings.ssl.certificate, &settings.ssl.certificate);
|
||||||
conf.add<Value<string>>("", "ssl.private_key", "private key file (PEM format)", settings.ssl.private_key, &settings.ssl.private_key);
|
conf.add<Value<string>>("", "ssl.certificate_key", "private key file (PEM format)", settings.ssl.certificate_key, &settings.ssl.certificate_key);
|
||||||
conf.add<Value<string>>("", "ssl.key_password", "key password (for encrypted private key)", settings.ssl.key_password, &settings.ssl.key_password);
|
conf.add<Value<string>>("", "ssl.key_password", "key password (for encrypted private key)", settings.ssl.key_password, &settings.ssl.key_password);
|
||||||
|
|
||||||
// Users setting
|
// Users setting
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue