class ApiAuthenticationConfigurationBase
Base class for holding authentication configuration information when calling APIs, serving as a parent class for various authentication types.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/authentication/configuration_base.py
5 - 21
simple
Purpose
ApiAuthenticationConfigurationBase is an abstract base class that provides a foundation for different API authentication mechanisms. It inherits from ClientValue and is designed to be extended by specific authentication types such as basic authentication, PKCS12 certificate authentication, and client certificate authentication. The class maintains an ordered collection of authentication-related strings that can be used by derived classes to store authentication parameters or configuration details.
Source Code
class ApiAuthenticationConfigurationBase(ClientValue):
"""
The base type to hold authentication information for calling an API.
Derived types include:
- basicAuthentication for HTTP basic authentication
- pkcs12certificate for client certificate authentication (used for API connector create or upload)
- clientCertificateAuthentication for client certificate authentication (used for fetching the client
certificates of an API connector)
"""
def __init__(self, order=None):
"""
:param list[str] order:
"""
self.order = StringCollection(order)
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
order: Optional list of strings that represents an ordered collection of authentication-related values. This parameter is converted to a StringCollection object upon initialization. Can be None if no initial order is needed. The specific meaning of these strings depends on the derived authentication type.
Return Value
Instantiation returns an ApiAuthenticationConfigurationBase object (or more commonly, an instance of a derived class). The object contains an 'order' attribute of type StringCollection that holds the authentication configuration strings. This base class itself doesn't return values from methods as it only defines the constructor.
Class Interface
Methods
__init__(self, order=None)
Purpose: Initializes the authentication configuration base object with an optional ordered collection of authentication parameters
Parameters:
order: Optional list of strings representing ordered authentication configuration values, defaults to None
Returns: None (constructor)
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
order |
StringCollection | A collection of strings representing ordered authentication configuration parameters. Initialized from the order parameter passed to __init__, converted to StringCollection type for consistent handling within the Office365 SDK | instance |
Dependencies
office365
Required Imports
from office365.runtime.client_value import ClientValue
from office365.runtime.types.collections import StringCollection
Usage Example
# This is a base class and typically not instantiated directly
# Instead, use derived classes for specific authentication types
# Example of base class instantiation (for demonstration):
from office365.runtime.client_value import ClientValue
from office365.runtime.types.collections import StringCollection
class ApiAuthenticationConfigurationBase(ClientValue):
def __init__(self, order=None):
self.order = StringCollection(order)
# Create instance with no order
auth_config = ApiAuthenticationConfigurationBase()
# Create instance with ordered authentication parameters
auth_config_with_order = ApiAuthenticationConfigurationBase(
order=['param1', 'param2', 'param3']
)
# Access the order attribute
print(auth_config_with_order.order)
# Typical usage would be through derived classes:
# basic_auth = BasicAuthentication(username='user', password='pass')
# cert_auth = Pkcs12Certificate(certificate_path='cert.p12', password='certpass')
Best Practices
- This is a base class and should not be instantiated directly in production code; instead, use one of its derived classes (basicAuthentication, pkcs12certificate, clientCertificateAuthentication)
- When creating derived classes, ensure they properly call the parent __init__ method using super() to initialize the order attribute
- The order parameter should contain strings relevant to the specific authentication mechanism being implemented
- Since this inherits from ClientValue, instances can be serialized and used in API requests within the Office365 SDK context
- Keep authentication credentials secure and never hardcode sensitive information; use environment variables or secure credential stores
- The StringCollection type ensures that the order attribute maintains proper collection behavior consistent with the Office365 SDK patterns
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class ClientCertificateAuthentication 78.0% similar
-
class BasicAuthentication 75.9% similar
-
class AuthenticationProvider 66.3% similar
-
class ApiApplication 61.0% similar
-
class Authentication 56.9% similar