🔍 Code Extractor

class SocialIdentityProvider

Maturity: 50

A class representing social identity providers for Azure Active Directory (Azure AD) and Azure AD B2C tenants, providing access to OAuth client credentials and provider type information.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/identities/providers/social_identity.py
Lines:
4 - 35
Complexity:
simple

Purpose

This class extends IdentityProviderBase to represent social identity providers used for external authentication in Azure AD environments. It provides read-only access to OAuth client credentials (client ID and secret) and the identity provider type (e.g., Google, Facebook, Microsoft). The class is designed for managing and querying social identity provider configurations in both B2B and B2C scenarios within Azure AD tenants.

Source Code

class SocialIdentityProvider(IdentityProviderBase):
    """
    Represents social identity providers with External Identities for both Azure Active Directory (Azure AD)
    tenant and an Azure AD B2C tenant.
    """

    @property
    def client_id(self):
        """
        The client identifier for the application obtained when registering the application with the identity provider.
        :rtype: str or None
        """
        return self.properties.get("clientId", None)

    @property
    def client_secret(self):
        """
        The client secret for the application that is obtained when the application is registered
        with the identity provider. This is write-only. A read operation returns ****.
        :rtype: str or None
        """
        return self.properties.get("clientSecret", None)

    @property
    def identity_provider_type(self):
        """
        For a B2B scenario, possible values: Google, Facebook.
        For a B2C scenario, possible values: Microsoft, Google, Amazon, LinkedIn, Facebook, GitHub, Twitter, Weibo,
        QQ, WeChat.
        :rtype: str or None
        """
        return self.properties.get("identityProviderType", None)

Parameters

Name Type Default Kind
bases IdentityProviderBase -

Parameter Details

__init__: The constructor parameters are inherited from IdentityProviderBase. Typically accepts properties dictionary or context information for initializing the identity provider instance with data from Azure AD.

Return Value

Instantiation returns a SocialIdentityProvider object that provides property-based access to identity provider configuration. The properties (client_id, client_secret, identity_provider_type) return strings or None if the property is not set in the underlying properties dictionary.

Class Interface

Methods

@property client_id(self) -> str | None property

Purpose: Returns the OAuth client identifier for the application registered with the identity provider

Returns: The client ID as a string, or None if not set in properties

@property client_secret(self) -> str | None property

Purpose: Returns the OAuth client secret for the application. This is write-only in Azure AD; read operations return masked values (****).

Returns: The client secret as a string (typically masked as ****), or None if not set in properties

@property identity_provider_type(self) -> str | None property

Purpose: Returns the type of social identity provider. Valid values depend on B2B or B2C scenario.

Returns: The provider type as a string (e.g., 'Google', 'Facebook', 'Microsoft', 'LinkedIn', 'GitHub', 'Twitter', 'Amazon', 'Weibo', 'QQ', 'WeChat'), or None if not set

Attributes

Name Type Description Scope
properties dict Dictionary containing the identity provider configuration data, inherited from IdentityProviderBase. Keys include 'clientId', 'clientSecret', and 'identityProviderType'. instance

Dependencies

  • office365

Required Imports

from office365.directory.identities.providers.base import IdentityProviderBase
from office365.directory.identities.providers.social import SocialIdentityProvider

Usage Example

# Assuming you have an authenticated Office365 client context
from office365.directory.identities.providers.social import SocialIdentityProvider

# Typically obtained from Azure AD API query
# Example: provider = context.identity_providers.get().execute_query()

# Create instance with properties dictionary
properties = {
    'clientId': 'abc123-client-id',
    'clientSecret': '****',
    'identityProviderType': 'Google'
}

# Instantiate (usually done internally by the Office365 SDK)
provider = SocialIdentityProvider()
provider.properties = properties

# Access provider information
client_id = provider.client_id  # Returns: 'abc123-client-id'
provider_type = provider.identity_provider_type  # Returns: 'Google'
client_secret = provider.client_secret  # Returns: '****' (write-only, masked on read)

# Check provider type for B2B or B2C scenarios
if provider.identity_provider_type in ['Google', 'Facebook']:
    print('B2B or B2C provider')
if provider.identity_provider_type in ['Microsoft', 'LinkedIn', 'GitHub']:
    print('B2C provider')

Best Practices

  • This class is typically instantiated by the Office365 SDK when querying identity providers from Azure AD, not manually created by users
  • The client_secret property is write-only in Azure AD; read operations return masked values (****)
  • Use the identity_provider_type property to determine which scenario (B2B or B2C) and which specific provider is configured
  • For B2B scenarios, valid provider types are: Google, Facebook
  • For B2C scenarios, valid provider types are: Microsoft, Google, Amazon, LinkedIn, Facebook, GitHub, Twitter, Weibo, QQ, WeChat
  • All properties return None if the corresponding key is not present in the underlying properties dictionary
  • This class inherits from IdentityProviderBase, so additional methods and properties may be available from the base class
  • The class uses a properties dictionary pattern for data storage, accessed via the inherited properties attribute

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class IdentityProviderBase 85.3% similar

    Represents identity providers with External Identities for both Azure Active Directory tenant and Azure AD B2C tenant, providing access to identity provider properties.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/identities/providers/base.py
  • class BuiltInIdentityProvider 84.3% similar

    A class representing built-in identity providers with External Identities for an Azure Active Directory tenant, specifically for B2B scenarios.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/identities/providers/builtin_identity.py
  • class IdentityProvider 82.5% similar

    Represents an Azure Active Directory (Azure AD) identity provider entity with client credentials for OAuth authentication.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/identities/provider.py
  • class IdentityProviderBaseCollection 69.0% similar

    A collection class for managing IdentityProviderBase entities in Microsoft Graph API, providing methods to query and retrieve identity provider information.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/identities/providers/base_collection.py
  • class ObjectIdentity 67.8% similar

    Represents an identity used to sign in to a user account, encapsulating sign-in type, issuer, and issuer-assigned identifier information.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/identities/object_identity.py
← Back to Browse