AuthenticationChain processor
Bases: object
Implementations of this interface are used to chain authentication when there is intermediary between the client and the server i.e. an aggregator node.
Returns the next security context based on the current context
Parameters: | ctx (vmware.vapi.core.SecurityContext) – Current security context |
---|---|
Return type: | vmware.vapi.core.SecurityContext |
Returns: | Next security context |
AuthenticationChain processor lib
Returns the next security context based on the current context
Parameters: | ctx (vmware.vapi.core.SecurityContext) – Current security context |
---|---|
Return type: | vmware.vapi.core.SecurityContext |
Returns: | Next security context |
Session Security Helper
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 |
SSO Security Helper
Bases: json.encoder.JSONEncoder
Custom JSON Encoder class to canonicalize dictionary and list objects
Constructor for JSONEncoder, with sensible defaults.
If skipkeys is False, then it is a TypeError to attempt encoding of keys that are not str, int, long, float or None. If skipkeys is True, such items are simply skipped.
If ensure_ascii is True, the output is guaranteed to be str objects with all incoming unicode characters escaped. If ensure_ascii is false, the output will be unicode object.
If check_circular is True, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place.
If allow_nan is True, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats.
If sort_keys is True, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis.
If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation.
If specified, separators should be a (item_separator, key_separator) tuple. The default is (‘, ‘, ‘: ‘). To get the most compact JSON representation you should specify (‘,’, ‘:’) to eliminate whitespace.
If specified, default is a function that gets called for objects that can’t otherwise be serialized. It should return a JSON encodable version of the object or raise a TypeError.
If encoding is not None, then all input strings will be transformed into unicode using that encoding prior to JSON-encoding. The default is UTF-8.
Bases: object
This class is responsible for transforming JSON messages into their canonical representation.
Link to the IEFT proposal: https://datatracker.ietf.org/doc/draft-staykov-hu-json-canonical-form/
Bases: vmware.vapi.protocol.common.lib.RequestProcessor
This class is used for signing JSON request messages
Sign the input JSON request message.
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
Sample input security context: {
‘schemeId’: ‘SAML_TOKEN’, ‘privateKey’: <PRIVATE_KEY>, ‘samlToken’: <SAML_TOKEN>, ‘signatureAlgorithm’: <ALGORITHM>,
}
Security context block before signing: {
‘schemeId’: ‘SAML_TOKEN’, ‘signatureAlgorithm’: <ALGORITHM>, ‘timestamp’: {
‘created’: ‘2012-10-26T12:24:18.941Z’, ‘expires’: ‘2012-10-26T12:44:18.941Z’,}
}
Security context block after signing: {
‘schemeId’: ‘SAML_TOKEN’, ‘signatureAlgorithm’: <ALGORITHM>, ‘signature’: {
‘samlToken’: <SAML_TOKEN>, ‘value’: <DIGEST>} ‘timestamp’: {
‘created’: ‘2012-10-26T12:24:18.941Z’, ‘expires’: ‘2012-10-26T12:44:18.941Z’,}
}
Bases: vmware.vapi.protocol.common.lib.RequestProcessor
This class is used to verify the authenticity of the request message by verifying the digest present in the security context block.
Verify the input JSON message.
For verification, we need 4 things: 1. algorithm: extracted from security context 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 and the remaining part is canonicalized
Sample input security context: {
‘schemeId’: ‘SAML_TOKEN’, ‘signatureAlgorithm’: <ALGORITHM>, ‘signature’: {
‘samlToken’: <SAML_TOKEN>, ‘value’: <DIGEST>} ‘timestamp’: {
‘created’: ‘2012-10-26T12:24:18.941Z’, ‘expires’: ‘2012-10-26T12:44:18.941Z’,}
}
Parameters: | input_message (str) – Input JSON request message |
---|---|
Return type: | str |
Returns: | JSON request message after signature verification |
Create a security context for SAML bearer token based authentication scheme
Parameters: | token (str) – SAML Token |
---|
Create a security context for SAML token based authentication scheme
Parameters: |
|
---|---|
Return type: | |
Returns: | Newly created security context |
User password Security Helper
Create a security context for Username-Password based authentication scheme
Parameters: |
|
---|---|
Return type: | |
Returns: | Newly created security context |