mirror of
https://github.com/unraid/api.git
synced 2026-01-06 16:49:49 -06:00
feat: unraid single sign on with account app
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?
|
||||
|
||||
/**
|
||||
* Caveats to get the SSO login button to display
|
||||
*
|
||||
* /usr/local/emhttp/auth-request.php must be updated to include the exact URLs of anything that is being loaded.
|
||||
* Otherwise, the request for the asset will be blocked and redirected to /login.
|
||||
*
|
||||
* The modification of these files should be done via the plugin's install script.
|
||||
*/
|
||||
require_once("$docroot/plugins/dynamix.my.servers/include/state.php");
|
||||
require_once("$docroot/plugins/dynamix.my.servers/include/web-components-extractor.php");
|
||||
|
||||
$serverState = new ServerState();
|
||||
|
||||
$wcExtractor = new WebComponentsExtractor();
|
||||
echo $wcExtractor->getScriptTagHtml();
|
||||
?>
|
||||
|
||||
<unraid-i18n-host>
|
||||
<unraid-sso-button server="<?= $serverState->getServerStateJsonForHtmlAttr() ?>"></unraid-sso-button>
|
||||
</unraid-i18n-host>
|
||||
@@ -53,6 +53,10 @@ class ServerState
|
||||
"nokeyserver" => 'NO_KEY_SERVER',
|
||||
"withdrawn" => 'WITHDRAWN',
|
||||
];
|
||||
/**
|
||||
* SSO Sub IDs from the my servers config file.
|
||||
*/
|
||||
private $ssoSubIds = '';
|
||||
private $osVersion;
|
||||
private $osVersionBranch;
|
||||
private $rebootDetails;
|
||||
@@ -193,6 +197,7 @@ class ServerState
|
||||
$this->registered = !empty($this->myServersFlashCfg['remote']['apikey']) && $this->connectPluginInstalled;
|
||||
$this->registeredTime = $this->myServersFlashCfg['remote']['regWizTime'] ?? '';
|
||||
$this->username = $this->myServersFlashCfg['remote']['username'] ?? '';
|
||||
$this->ssoSubIds = $this->myServersFlashCfg['remote']['ssoSubIds'] ?? '';
|
||||
}
|
||||
|
||||
private function getConnectKnownOrigins() {
|
||||
@@ -321,6 +326,7 @@ class ServerState
|
||||
"uptime" => 1000 * (time() - round(strtok(exec("cat /proc/uptime"), ' '))),
|
||||
"username" => $this->username,
|
||||
"wanFQDN" => @$this->nginxCfg['NGINX_WANFQDN'] ?? '',
|
||||
"ssoSubIds" => $this->ssoSubIds
|
||||
];
|
||||
|
||||
if ($this->combinedKnownOrigins) {
|
||||
|
||||
Reference in New Issue
Block a user