Files
tgstation-server/_windows_system_identity_8cs_source.html

201 lines
34 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>tgstation-server: src/Tgstation.Server.Host/Security/WindowsSystemIdentity.cs Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">tgstation-server<span id="projectnumber">&#160;6.19.3</span>
</div>
<div id="projectbrief">The /tg/station 13 server suite</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function() { init_codefold(0); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_34761767c1c3cd212f9d2f80ea0828a8.html">Tgstation.Server.Host</a></li><li class="navelem"><a class="el" href="dir_c5451d9d233744a5b09a29938f0cda9a.html">Security</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle"><div class="title">WindowsSystemIdentity.cs</div></div>
</div><!--header-->
<div class="contents">
<a href="_windows_system_identity_8cs.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">using </span>System;</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">using </span>System.DirectoryServices.AccountManagement;</div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="keyword">using </span>System.Runtime.Versioning;</div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="keyword">using </span>System.Security.Principal;</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="keyword">using </span>System.Threading;</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span><span class="keyword">using </span>System.Threading.Tasks;</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span> </div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="keyword">using </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_host_1_1_i_o.html">Tgstation.Server.Host.IO</a>;</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> </div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_host_1_1_security.html">Tgstation.Server.Host.Security</a></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span>{</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> [SupportedOSPlatform(<span class="stringliteral">&quot;windows&quot;</span>)]</div>
<div class="foldopen" id="foldopen00016" data-start="{" data-end="};">
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html"> 16</a></span> <span class="keyword">sealed</span> <span class="keyword">class </span><a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html">WindowsSystemIdentity</a> : <a class="code hl_interface" href="interface_tgstation_1_1_server_1_1_host_1_1_security_1_1_i_system_identity.html">ISystemIdentity</a></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> {</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a5335d4436713401b2872d14752f1ba7b"> 19</a></span> <span class="keyword">public</span> <span class="keywordtype">string</span> <a class="code hl_property" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a5335d4436713401b2872d14752f1ba7b">Uid</a> =&gt; (<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a6da5cb51cb3b48b354447adf409768f9">userPrincipal</a>?.Sid ?? <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aebf4b00a090db02c7accde161a1412fc">identity</a>!.User!).ToString(); <span class="comment">// we kno user isn&#39;t null because it can only be the case when anonymous (checked in this constructor)</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> </div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a7bbd8a3a43a6a2864b3348ae7f9438b9"> 22</a></span> <span class="keyword">public</span> <span class="keywordtype">string</span> <a class="code hl_property" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a7bbd8a3a43a6a2864b3348ae7f9438b9">Username</a> =&gt; <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a6da5cb51cb3b48b354447adf409768f9">userPrincipal</a>?.Name ?? <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aebf4b00a090db02c7accde161a1412fc">identity</a>!.Name;</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> </div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#ae0e95b11dc35386e5a276bd9b24b3312"> 25</a></span> <span class="keyword">public</span> <span class="keywordtype">bool</span> <a class="code hl_property" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#ae0e95b11dc35386e5a276bd9b24b3312">CanCreateSymlinks</a> =&gt; <a class="code hl_property" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#af46556b5e4bec84ac9d0ceb6d2a33620">IsSuperUser</a>;</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> </div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#af46556b5e4bec84ac9d0ceb6d2a33620"> 28</a></span> <span class="keyword">public</span> <span class="keywordtype">bool</span> <a class="code hl_property" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#af46556b5e4bec84ac9d0ceb6d2a33620">IsSuperUser</a> =&gt; <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#ae1cd8b087cfdb5277f4c99c0afce96b3">isAdmin</a> ?? <span class="keywordflow">throw</span> <span class="keyword">new</span> NotSupportedException();</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> </div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aebf4b00a090db02c7accde161a1412fc"> 33</a></span> readonly WindowsIdentity? <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aebf4b00a090db02c7accde161a1412fc">identity</a>;</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> </div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a6da5cb51cb3b48b354447adf409768f9"> 38</a></span> readonly UserPrincipal? <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a6da5cb51cb3b48b354447adf409768f9">userPrincipal</a>;</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> </div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#ae1cd8b087cfdb5277f4c99c0afce96b3"> 43</a></span> readonly <span class="keywordtype">bool</span>? <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#ae1cd8b087cfdb5277f4c99c0afce96b3">isAdmin</a>;</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> </div>
<div class="foldopen" id="foldopen00049" data-start="{" data-end="}">
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a6b20afd81a3b07e0ef1f89fc134652ad"> 49</a></span> <span class="keyword">public</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a6b20afd81a3b07e0ef1f89fc134652ad">WindowsSystemIdentity</a>(WindowsIdentity <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aebf4b00a090db02c7accde161a1412fc">identity</a>)</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> {</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> this.identity = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aebf4b00a090db02c7accde161a1412fc">identity</a> ?? <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentNullException(nameof(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aebf4b00a090db02c7accde161a1412fc">identity</a>));</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aebf4b00a090db02c7accde161a1412fc">identity</a>.IsAnonymous)</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentException($<span class="stringliteral">&quot;Cannot use anonymous {nameof(WindowsIdentity)} as a {nameof(WindowsSystemIdentity)}!&quot;</span>, nameof(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aebf4b00a090db02c7accde161a1412fc">identity</a>));</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> </div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#ae1cd8b087cfdb5277f4c99c0afce96b3">isAdmin</a> = <span class="keyword">new</span> WindowsPrincipal(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aebf4b00a090db02c7accde161a1412fc">identity</a>).IsInRole(WindowsBuiltInRole.Administrator);</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> }</div>
</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> </div>
<div class="foldopen" id="foldopen00062" data-start="{" data-end="}">
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a8a3ea6f579bf33bbba407c615140998d"> 62</a></span> <span class="keyword">public</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a8a3ea6f579bf33bbba407c615140998d">WindowsSystemIdentity</a>(UserPrincipal <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a6da5cb51cb3b48b354447adf409768f9">userPrincipal</a>)</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> {</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> this.userPrincipal = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a6da5cb51cb3b48b354447adf409768f9">userPrincipal</a> ?? <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentNullException(nameof(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a6da5cb51cb3b48b354447adf409768f9">userPrincipal</a>));</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> }</div>
</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> </div>
<div class="foldopen" id="foldopen00068" data-start="{" data-end="}">
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a69861e38af0e65778b2e6e5692fd87a4"> 68</a></span> <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a69861e38af0e65778b2e6e5692fd87a4">Dispose</a>()</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> {</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aebf4b00a090db02c7accde161a1412fc">identity</a> != <span class="keyword">null</span>)</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aebf4b00a090db02c7accde161a1412fc">identity</a>.Dispose();</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <span class="keywordflow">else</span></div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> {</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> var context = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a6da5cb51cb3b48b354447adf409768f9">userPrincipal</a>!.Context;</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a6da5cb51cb3b48b354447adf409768f9">userPrincipal</a>.Dispose();</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> context.Dispose();</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> }</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> }</div>
</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> </div>
<div class="foldopen" id="foldopen00081" data-start="{" data-end="}">
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aa3df6c34f2e2c1a5755b21595bc6f1a5"> 81</a></span> <span class="keyword">public</span> <a class="code hl_interface" href="interface_tgstation_1_1_server_1_1_host_1_1_security_1_1_i_system_identity.html">ISystemIdentity</a> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aa3df6c34f2e2c1a5755b21595bc6f1a5">Clone</a>()</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> {</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aebf4b00a090db02c7accde161a1412fc">identity</a> != <span class="keyword">null</span>)</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> {</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <span class="comment">// var newIdentity = (WindowsIdentity)identity.Clone(); //doesn&#39;t work because of https://github.com/dotnet/corefx/issues/31841</span></div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> var newIdentity = <span class="keyword">new</span> WindowsIdentity(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aebf4b00a090db02c7accde161a1412fc">identity</a>.Token); <span class="comment">// the handle is cloned internally</span></div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> </div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html">WindowsSystemIdentity</a>(newIdentity);</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> }</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> </div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <span class="comment">// can&#39;t clone a UP, shouldn&#39;t be trying to anyway, cloning is for impersonation</span></div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <span class="keywordflow">throw</span> <span class="keyword">new</span> NotSupportedException(<span class="stringliteral">&quot;Cannot clone a UserPrincipal based WindowsSystemIdentity!&quot;</span>);</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> }</div>
</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> </div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aaa070f717bb19b6d85f0253d7820bc75"> 96</a></span> <span class="keyword">public</span> Task <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aaa070f717bb19b6d85f0253d7820bc75">RunImpersonated</a>(Action action, CancellationToken cancellationToken) =&gt; Task.Factory.StartNew(</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> () =&gt;</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> {</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> ArgumentNullException.ThrowIfNull(action);</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aebf4b00a090db02c7accde161a1412fc">identity</a> == <span class="keyword">null</span>)</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <span class="keywordflow">throw</span> <span class="keyword">new</span> NotSupportedException(<span class="stringliteral">&quot;Impersonate using a UserPrincipal based WindowsSystemIdentity!&quot;</span>);</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> WindowsIdentity.RunImpersonated(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aebf4b00a090db02c7accde161a1412fc">identity</a>.AccessToken, action);</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> },</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> cancellationToken,</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> <a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_default_i_o_manager.html">DefaultIOManager</a>.<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_default_i_o_manager.html#ac6dfeef4e622bb46047169215099995d">BlockingTaskCreationOptions</a>,</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> TaskScheduler.Current);</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> }</div>
</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span>}</div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_default_i_o_manager_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_default_i_o_manager.html">Tgstation.Server.Host.IO.DefaultIOManager</a></div><div class="ttdoc">IIOManager that resolves paths to Environment.CurrentDirectory.</div><div class="ttdef"><b>Definition</b> <a href="_default_i_o_manager_8cs_source.html#l00018">DefaultIOManager.cs:19</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_default_i_o_manager_html_ac6dfeef4e622bb46047169215099995d"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_i_o_1_1_default_i_o_manager.html#ac6dfeef4e622bb46047169215099995d">Tgstation.Server.Host.IO.DefaultIOManager.BlockingTaskCreationOptions</a></div><div class="ttdeci">const TaskCreationOptions BlockingTaskCreationOptions</div><div class="ttdoc">The TaskCreationOptions used to spawn Tasks for potentially long running, blocking operations.</div><div class="ttdef"><b>Definition</b> <a href="_default_i_o_manager_8cs_source.html#l00033">DefaultIOManager.cs:33</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html">Tgstation.Server.Host.Security.WindowsSystemIdentity</a></div><div class="ttdoc">ISystemIdentity for windows systems.</div><div class="ttdef"><b>Definition</b> <a href="_windows_system_identity_8cs_source.html#l00016">WindowsSystemIdentity.cs:17</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity_html_a5335d4436713401b2872d14752f1ba7b"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a5335d4436713401b2872d14752f1ba7b">Tgstation.Server.Host.Security.WindowsSystemIdentity.Uid</a></div><div class="ttdeci">string Uid</div><div class="ttdoc">A unique identifier for the user.</div><div class="ttdef"><b>Definition</b> <a href="_windows_system_identity_8cs_source.html#l00019">WindowsSystemIdentity.cs:19</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity_html_a69861e38af0e65778b2e6e5692fd87a4"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a69861e38af0e65778b2e6e5692fd87a4">Tgstation.Server.Host.Security.WindowsSystemIdentity.Dispose</a></div><div class="ttdeci">void Dispose()</div><div class="ttdef"><b>Definition</b> <a href="_windows_system_identity_8cs_source.html#l00068">WindowsSystemIdentity.cs:68</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity_html_a6b20afd81a3b07e0ef1f89fc134652ad"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a6b20afd81a3b07e0ef1f89fc134652ad">Tgstation.Server.Host.Security.WindowsSystemIdentity.WindowsSystemIdentity</a></div><div class="ttdeci">WindowsSystemIdentity(WindowsIdentity identity)</div><div class="ttdoc">Initializes a new instance of the WindowsSystemIdentity class.</div><div class="ttdef"><b>Definition</b> <a href="_windows_system_identity_8cs_source.html#l00049">WindowsSystemIdentity.cs:49</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity_html_a6da5cb51cb3b48b354447adf409768f9"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a6da5cb51cb3b48b354447adf409768f9">Tgstation.Server.Host.Security.WindowsSystemIdentity.userPrincipal</a></div><div class="ttdeci">readonly? UserPrincipal userPrincipal</div><div class="ttdoc">The UserPrincipal for the WindowsSystemIdentity.</div><div class="ttdef"><b>Definition</b> <a href="_windows_system_identity_8cs_source.html#l00038">WindowsSystemIdentity.cs:38</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity_html_a7bbd8a3a43a6a2864b3348ae7f9438b9"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a7bbd8a3a43a6a2864b3348ae7f9438b9">Tgstation.Server.Host.Security.WindowsSystemIdentity.Username</a></div><div class="ttdeci">string Username</div><div class="ttdoc">The user's name.</div><div class="ttdef"><b>Definition</b> <a href="_windows_system_identity_8cs_source.html#l00022">WindowsSystemIdentity.cs:22</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity_html_a8a3ea6f579bf33bbba407c615140998d"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#a8a3ea6f579bf33bbba407c615140998d">Tgstation.Server.Host.Security.WindowsSystemIdentity.WindowsSystemIdentity</a></div><div class="ttdeci">WindowsSystemIdentity(UserPrincipal userPrincipal)</div><div class="ttdoc">Initializes a new instance of the WindowsSystemIdentity class.</div><div class="ttdef"><b>Definition</b> <a href="_windows_system_identity_8cs_source.html#l00062">WindowsSystemIdentity.cs:62</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity_html_aa3df6c34f2e2c1a5755b21595bc6f1a5"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aa3df6c34f2e2c1a5755b21595bc6f1a5">Tgstation.Server.Host.Security.WindowsSystemIdentity.Clone</a></div><div class="ttdeci">ISystemIdentity Clone()</div><div class="ttdoc">Clone the ISystemIdentity creating another copy that must have IDisposable.Dispose called on it....</div><div class="ttdef"><b>Definition</b> <a href="_windows_system_identity_8cs_source.html#l00081">WindowsSystemIdentity.cs:81</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity_html_aaa070f717bb19b6d85f0253d7820bc75"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aaa070f717bb19b6d85f0253d7820bc75">Tgstation.Server.Host.Security.WindowsSystemIdentity.RunImpersonated</a></div><div class="ttdeci">Task RunImpersonated(Action action, CancellationToken cancellationToken)</div><div class="ttdoc">Runs a given action in the context of the ISystemIdentity.A Task representing the running operation.</div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity_html_ae0e95b11dc35386e5a276bd9b24b3312"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#ae0e95b11dc35386e5a276bd9b24b3312">Tgstation.Server.Host.Security.WindowsSystemIdentity.CanCreateSymlinks</a></div><div class="ttdeci">bool CanCreateSymlinks</div><div class="ttdoc">If this system identity has permissions to create symlinks.</div><div class="ttdef"><b>Definition</b> <a href="_windows_system_identity_8cs_source.html#l00025">WindowsSystemIdentity.cs:25</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity_html_ae1cd8b087cfdb5277f4c99c0afce96b3"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#ae1cd8b087cfdb5277f4c99c0afce96b3">Tgstation.Server.Host.Security.WindowsSystemIdentity.isAdmin</a></div><div class="ttdeci">readonly? bool isAdmin</div><div class="ttdoc">Backing field for IsSuperUser.</div><div class="ttdef"><b>Definition</b> <a href="_windows_system_identity_8cs_source.html#l00043">WindowsSystemIdentity.cs:43</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity_html_aebf4b00a090db02c7accde161a1412fc"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#aebf4b00a090db02c7accde161a1412fc">Tgstation.Server.Host.Security.WindowsSystemIdentity.identity</a></div><div class="ttdeci">readonly? WindowsIdentity identity</div><div class="ttdoc">The WindowsIdentity for the WindowsSystemIdentity.</div><div class="ttdef"><b>Definition</b> <a href="_windows_system_identity_8cs_source.html#l00033">WindowsSystemIdentity.cs:33</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity_html_af46556b5e4bec84ac9d0ceb6d2a33620"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_security_1_1_windows_system_identity.html#af46556b5e4bec84ac9d0ceb6d2a33620">Tgstation.Server.Host.Security.WindowsSystemIdentity.IsSuperUser</a></div><div class="ttdeci">bool IsSuperUser</div><div class="ttdoc">Is this identity a SuperUser for the OS. See Administrator on Windows or root on Linux.</div><div class="ttdef"><b>Definition</b> <a href="_windows_system_identity_8cs_source.html#l00028">WindowsSystemIdentity.cs:28</a></div></div>
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_security_1_1_i_system_identity_html"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_security_1_1_i_system_identity.html">Tgstation.Server.Host.Security.ISystemIdentity</a></div><div class="ttdoc">Represents a user on the current global::System.Runtime.InteropServices.OSPlatform.</div><div class="ttdef"><b>Definition</b> <a href="_i_system_identity_8cs_source.html#l00010">ISystemIdentity.cs:11</a></div></div>
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_host_1_1_i_o_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_host_1_1_i_o.html">Tgstation.Server.Host.IO</a></div><div class="ttdef"><b>Definition</b> <a href="_buffered_file_stream_provider_8cs_source.html#l00008">BufferedFileStreamProvider.cs:9</a></div></div>
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_host_1_1_security_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_host_1_1_security.html">Tgstation.Server.Host.Security</a></div><div class="ttdef"><b>Definition</b> <a href="_authentication_context_8cs_source.html#l00007">AuthenticationContext.cs:8</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
</small></address>
</body>
</html>