mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:58:51 +02:00
allow passing of OAuth client secret to DS on command-line
This commit is contained in:
parent
86f3cf2a75
commit
1c2032790a
2 changed files with 8 additions and 2 deletions
|
@ -153,15 +153,20 @@ bool DomainServer::optionallyReadX509KeyAndCertificate() {
|
||||||
bool DomainServer::optionallySetupOAuth() {
|
bool DomainServer::optionallySetupOAuth() {
|
||||||
const QString OAUTH_PROVIDER_URL_OPTION = "oauth-provider";
|
const QString OAUTH_PROVIDER_URL_OPTION = "oauth-provider";
|
||||||
const QString OAUTH_CLIENT_ID_OPTION = "oauth-client-id";
|
const QString OAUTH_CLIENT_ID_OPTION = "oauth-client-id";
|
||||||
|
const QString OAUTH_CLIENT_SECRET_ENV = "DOMAIN_SERVER_CLIENT_SECRET";
|
||||||
const QString REDIRECT_HOSTNAME_OPTION = "hostname";
|
const QString REDIRECT_HOSTNAME_OPTION = "hostname";
|
||||||
|
|
||||||
_oauthProviderURL = QUrl(_argumentVariantMap.value(OAUTH_PROVIDER_URL_OPTION).toString());
|
_oauthProviderURL = QUrl(_argumentVariantMap.value(OAUTH_PROVIDER_URL_OPTION).toString());
|
||||||
_oauthClientID = _argumentVariantMap.value(OAUTH_CLIENT_ID_OPTION).toString();
|
_oauthClientID = _argumentVariantMap.value(OAUTH_CLIENT_ID_OPTION).toString();
|
||||||
|
_oauthClientSecret = QProcessEnvironment::systemEnvironment().value(OAUTH_CLIENT_SECRET_ENV);
|
||||||
QString oauthRedirectHostname = _argumentVariantMap.value(REDIRECT_HOSTNAME_OPTION).toString();
|
QString oauthRedirectHostname = _argumentVariantMap.value(REDIRECT_HOSTNAME_OPTION).toString();
|
||||||
|
|
||||||
if (!_oauthProviderURL.isEmpty() || !oauthRedirectHostname.isEmpty() || !_oauthClientID.isEmpty()) {
|
if (!_oauthProviderURL.isEmpty() || !oauthRedirectHostname.isEmpty() || !_oauthClientID.isEmpty()) {
|
||||||
if (_oauthProviderURL.isEmpty() || oauthRedirectHostname.isEmpty() || _oauthClientID.isEmpty()) {
|
if (_oauthProviderURL.isEmpty()
|
||||||
qDebug() << "Missing OAuth provider URL or hostname. domain-server will now quit.";
|
|| oauthRedirectHostname.isEmpty()
|
||||||
|
|| _oauthClientID.isEmpty()
|
||||||
|
|| _oauthClientSecret.isEmpty()) {
|
||||||
|
qDebug() << "Missing OAuth provider URL, hostname, client ID, or client secret. domain-server will now quit.";
|
||||||
QMetaObject::invokeMethod(this, "quit", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(this, "quit", Qt::QueuedConnection);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -99,6 +99,7 @@ private:
|
||||||
|
|
||||||
QUrl _oauthProviderURL;
|
QUrl _oauthProviderURL;
|
||||||
QString _oauthClientID;
|
QString _oauthClientID;
|
||||||
|
QString _oauthClientSecret;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_DomainServer_h
|
#endif // hifi_DomainServer_h
|
||||||
|
|
Loading…
Reference in a new issue