-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
45 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,10 +47,16 @@ <h2>Examples<a class="headerlink" href="#examples" title="Link to this heading"> | |
<p>Simple example:</p> | ||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">stanford.green.kerberos</span> <span class="kn">import</span> <span class="n">KerberosTicket</span> | ||
|
||
<span class="n">keytab_path</span> <span class="o">=</span> <span class="s2">"/etc/krb5.keytab"</span> | ||
<span class="n">principal</span> <span class="o">=</span> <span class="s2">"host/[email protected]"</span> | ||
|
||
<span class="n">kt</span> <span class="o">=</span> <span class="n">KerberosTicket</span><span class="p">(</span><span class="n">keytab_path</span><span class="p">,</span> <span class="n">principal</span><span class="p">,</span> <span class="n">age_limit_seconds</span><span class="o">=</span><span class="mi">30</span><span class="p">)</span> | ||
<span class="n">kt</span><span class="o">.</span><span class="n">create_ticket_file</span><span class="p">()</span> | ||
<span class="c1"># You now have a valid Kerberos context with the Kerberos ticket</span> | ||
<span class="c1"># file pointed to by the KRB5CCNAME environment variable.</span> | ||
|
||
<span class="c1"># Clean up the ticket file:</span> | ||
<span class="n">kt</span><span class="o">.</span><span class="n">cleanup</span><span class="p">()</span> | ||
</pre></div> | ||
</div> | ||
</section> | ||
|
@@ -64,7 +70,7 @@ <h2>Examples<a class="headerlink" href="#examples" title="Link to this heading"> | |
<dl class="py method"> | ||
<dt class="sig sig-object py" id="stanford.green.kerberos.KerberosTicket.cleanup"> | ||
<span class="sig-name descname"><span class="pre">cleanup</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#stanford.green.kerberos.KerberosTicket.cleanup" title="Link to this definition">¶</a></dt> | ||
<dd><p>Remove the kerberos ticket and lock files.</p> | ||
<dd><p>Remove the Kerberos ticket and lock files.</p> | ||
</dd></dl> | ||
|
||
<dl class="py method"> | ||
|
@@ -76,9 +82,7 @@ <h2>Examples<a class="headerlink" href="#examples" title="Link to this heading"> | |
<span class="target" id="index-0"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">KRB5CCNAME</span></code> to point to the Kerberos ticket file.</p> | ||
<p>The path to the ticket file comes from <code class="docutils literal notranslate"><span class="pre">self.keytab_path</span></code>.</p> | ||
<p>This method only creates the ticket file if it can acquire the | ||
ticket lock file. Given that creating a Kerberos ticket file takes less | ||
than a second (under normal circumstances), putting a 10-second | ||
timeout on acquiring the lock file is more than sufficient.</p> | ||
ticket lock file.</p> | ||
</dd></dl> | ||
|
||
<dl class="py method"> | ||
|
@@ -90,7 +94,8 @@ <h2>Examples<a class="headerlink" href="#examples" title="Link to this heading"> | |
<li><p>it does not already exist;</p></li> | ||
<li><p>it <em>does</em> exist but is empty;</p></li> | ||
<li><p>it <em>does</em> exist but is too old. The ticket file is too old if | ||
the current ticket file is more than <code class="docutils literal notranslate"><span class="pre">self.age_limit_seconds</span></code> old.</p></li> | ||
the current ticket file is more than <code class="docutils literal notranslate"><span class="pre">self.age_limit_seconds</span></code> | ||
seconds old.</p></li> | ||
</ul> | ||
</dd> | ||
</dl> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.