vmware.vapi.security package

Submodules

vmware.vapi.security.session module

Session Security Helper

class vmware.vapi.security.session.SessionSecurityContextParser

Bases: vmware.vapi.security.rest.SecurityContextParser

Security context parser used by the REST presentation layer that builds a security context if the REST request has session identifier either in the header or in the cookie.

Initialize SessionSecurityContextParser

build(request)

Build the security context if the request has the header that contains the session identifier or a cookie that has the session identifier.

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 identifier it finds.

Parameters

request (werkzeug.wrappers.Request) – Request object

Return type

vmware.vapi.core.SecurityContext or None

Returns

Security context object

vmware.vapi.security.session.create_session_security_context(session_id)

Create a security context for Session Id based authentication scheme

Parameters

session_id (str) – Session ID

Return type

vmware.vapi.core.SecurityContext

Returns

Newly created security context

vmware.vapi.security.sso module

vmware.vapi.security.user_password module

User password Security Helper

class vmware.vapi.security.user_password.UserPasswordSecurityContextParser

Bases: vmware.vapi.security.rest.SecurityContextParser

Security context parser used by the REST presentation layer that builds a security context if the REST request has username/password credentials in the HTTP header.

Initialize UserPasswordSecurityContextParser

build(request)

Build the security context if the request has authorization header that contains base64 encoded string of username/password.

If the request authorization header doesn’t have the username/password, this method returns None.

Parameters

request (werkzeug.wrappers.Request) – Request object

Return type

vmware.vapi.core.SecurityContext or None

Returns

Security context object

vmware.vapi.security.user_password.create_user_password_security_context(user_name, password)

Create a security context for Username-Password based authentication scheme

Parameters
  • user_name (str) – Name of the user

  • password (str) – Password of the user

Return type

vmware.vapi.core.SecurityContext

Returns

Newly created security context