<spanid="vmware-vapi-security-package"></span><h1>vmware.vapi.security package<aclass="headerlink"href="#module-vmware.vapi.security"title="Permalink to this headline">¶</a></h1>
<divclass="section"id="subpackages">
<h2>Subpackages<aclass="headerlink"href="#subpackages"title="Permalink to this headline">¶</a></h2>
<spanid="vmware-vapi-security-privilege-module"></span><h2>vmware.vapi.security.privilege module<aclass="headerlink"href="#module-vmware.vapi.security.privilege"title="Permalink to this headline">¶</a></h2>
<emclass="property">class </em><codeclass="descclassname">vmware.vapi.security.privilege.</code><codeclass="descname">PrivilegeValidator</code><aclass="headerlink"href="#vmware.vapi.security.privilege.PrivilegeValidator"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">validate</code><spanclass="sig-paren">(</span><em>user_identity</em>, <em>required_privileges</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#vmware.vapi.security.privilege.PrivilegeValidator.validate"title="Permalink to this definition">¶</a></dt>
<dd><p>Validate the privileges required for a given user identity</p>
<codeclass="descclassname">vmware.vapi.security.privilege.</code><codeclass="descname">get_privilege_validator</code><spanclass="sig-paren">(</span><em>privilege_validator=None</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#vmware.vapi.security.privilege.get_privilege_validator"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the singleton PrivilegeValidator instance</p>
<spanid="vmware-vapi-security-session-module"></span><h2>vmware.vapi.security.session module<aclass="headerlink"href="#module-vmware.vapi.security.session"title="Permalink to this headline">¶</a></h2>
<emclass="property">class </em><codeclass="descclassname">vmware.vapi.security.session.</code><codeclass="descname">SessionSecurityContextParser</code><aclass="headerlink"href="#vmware.vapi.security.session.SessionSecurityContextParser"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">build</code><spanclass="sig-paren">(</span><em>request</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#vmware.vapi.security.session.SessionSecurityContextParser.build"title="Permalink to this definition">¶</a></dt>
<dd><p>Build the security context if the request has the header
that contains the session identifier or a cookie that has
the session identifier.</p>
<p>The method will first check for session identifier in the cookie,
if it is not present, then it will check in the HTTP headers.
The session security context is created based on the first session
<codeclass="descclassname">vmware.vapi.security.session.</code><codeclass="descname">create_session_security_context</code><spanclass="sig-paren">(</span><em>session_id</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#vmware.vapi.security.session.create_session_security_context"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a security context for Session Id based authentication
<spanid="vmware-vapi-security-sso-module"></span><h2>vmware.vapi.security.sso module<aclass="headerlink"href="#module-vmware.vapi.security.sso"title="Permalink to this headline">¶</a></h2>
<codeclass="descname">encode</code><spanclass="sig-paren">(</span><em>o</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#vmware.vapi.security.sso.JSONCanonicalEncoder.encode"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="descclassname">vmware.vapi.security.sso.</code><codeclass="descname">JSONCanonicalizer</code><aclass="headerlink"href="#vmware.vapi.security.sso.JSONCanonicalizer"title="Permalink to this definition">¶</a></dt>
<emclass="property">static </em><codeclass="descname">canonicalize</code><spanclass="sig-paren">(</span><em>input_message</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#vmware.vapi.security.sso.JSONCanonicalizer.canonicalize"title="Permalink to this definition">¶</a></dt>
<emclass="property">static </em><codeclass="descname">canonicalize_py_obj</code><spanclass="sig-paren">(</span><em>py_obj</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#vmware.vapi.security.sso.JSONCanonicalizer.canonicalize_py_obj"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="descclassname">vmware.vapi.security.sso.</code><codeclass="descname">JSONSSOSigner</code><aclass="headerlink"href="#vmware.vapi.security.sso.JSONSSOSigner"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">process</code><spanclass="sig-paren">(</span><em>input_message</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#vmware.vapi.security.sso.JSONSSOSigner.process"title="Permalink to this definition">¶</a></dt>
<dd><p>Sign the input JSON request message.</p>
<p>The message is signed using user’s private key. The digest and saml
token is then added to the security context block of the execution
context. A timestamp is also added to guard against replay attacks</p>
<emclass="property">class </em><codeclass="descclassname">vmware.vapi.security.sso.</code><codeclass="descname">JSONSSOVerifier</code><aclass="headerlink"href="#vmware.vapi.security.sso.JSONSSOVerifier"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">process</code><spanclass="sig-paren">(</span><em>input_message</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#vmware.vapi.security.sso.JSONSSOVerifier.process"title="Permalink to this definition">¶</a></dt>
<dd><p>Verify the input JSON message.</p>
<p>For verification, we need 4 things:</p>
<olclass="arabic simple">
<li>algorithm: extracted from security context</li>
</ol>
<p>2. certificate: public key of the principal embedded in the
SAML token is used
3. digest: value field from signature block
4. canonical msg: signature block is removed from the request
<codeclass="descclassname">vmware.vapi.security.sso.</code><codeclass="descname">create_saml_bearer_security_context</code><spanclass="sig-paren">(</span><em>token</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#vmware.vapi.security.sso.create_saml_bearer_security_context"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a security context for SAML bearer token based
<codeclass="descclassname">vmware.vapi.security.sso.</code><codeclass="descname">create_saml_security_context</code><spanclass="sig-paren">(</span><em>token</em>, <em>private_key</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#vmware.vapi.security.sso.create_saml_security_context"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a security context for SAML token based
<li><strong>private_key</strong> (<codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">str</span></code>) – Absolute file path of the private key of the user</li>
<spanid="vmware-vapi-security-user-password-module"></span><h2>vmware.vapi.security.user_password module<aclass="headerlink"href="#module-vmware.vapi.security.user_password"title="Permalink to this headline">¶</a></h2>
<emclass="property">class </em><codeclass="descclassname">vmware.vapi.security.user_password.</code><codeclass="descname">UserPasswordSecurityContextParser</code><aclass="headerlink"href="#vmware.vapi.security.user_password.UserPasswordSecurityContextParser"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">build</code><spanclass="sig-paren">(</span><em>request</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#vmware.vapi.security.user_password.UserPasswordSecurityContextParser.build"title="Permalink to this definition">¶</a></dt>
<dd><p>Build the security context if the request has authorization
header that contains base64 encoded string of username/password.</p>
<p>If the request authorization header doesn’t have the username/password,
<codeclass="descclassname">vmware.vapi.security.user_password.</code><codeclass="descname">create_user_password_security_context</code><spanclass="sig-paren">(</span><em>user_name</em>, <em>password</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#vmware.vapi.security.user_password.create_user_password_security_context"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a security context for Username-Password based authentication
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.