🔍 Code Extractor

class WebApplication

Maturity: 50

A data class that encapsulates configuration settings for a web application, including home page URL, logout URL, and redirect URIs for OAuth 2.0 authentication flows.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/applications/web.py
Lines:
5 - 18
Complexity:
simple

Purpose

This class represents web application settings used in Microsoft's authorization service context. It stores and manages URLs required for OAuth 2.0 authentication, including the application's home page, logout endpoint, and redirect URIs where authorization codes and access tokens are sent. It inherits from ClientValue, making it suitable for serialization and transmission in API requests to Microsoft services (likely Microsoft Graph or Azure AD).

Source Code

class WebApplication(ClientValue):
    """Specifies settings for a web application."""

    def __init__(self, home_page_url=None, logout_url=None, redirect_uris=None):
        """
        :param str home_page_url: Home page or landing page of the application.
        :param str logout_url: Specifies the URL that will be used by Microsoft's authorization service to logout an
            user using front-channel, back-channel or SAML logout protocols.
        :param list[str] redirect_uris: Specifies the URLs where user tokens are sent for sign-in, or the redirect
            URIs where OAuth 2.0 authorization codes and access tokens are sent.
        """
        self.homePageUrl = home_page_url
        self.logoutUrl = logout_url
        self.redirectUris = StringCollection(redirect_uris)

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

home_page_url: The home page or landing page URL of the web application. This is typically the main entry point users see when accessing the application. Expected to be a string containing a valid URL or None if not specified.

logout_url: The URL that Microsoft's authorization service will use to logout a user. Supports front-channel, back-channel, or SAML logout protocols. Expected to be a string containing a valid URL or None if not specified.

redirect_uris: A list of URLs where user tokens are sent for sign-in, or where OAuth 2.0 authorization codes and access tokens are sent after successful authentication. Expected to be a list of strings containing valid URLs, or None. This is converted internally to a StringCollection object.

Return Value

Instantiation returns a WebApplication object with three attributes: homePageUrl (str or None), logoutUrl (str or None), and redirectUris (StringCollection object). The class does not define any methods that return values beyond the constructor.

Class Interface

Attributes

Name Type Description Scope
homePageUrl str or None Stores the home page or landing page URL of the web application instance
logoutUrl str or None Stores the URL used by Microsoft's authorization service for user logout operations instance
redirectUris StringCollection A collection of redirect URIs where OAuth 2.0 authorization codes and access tokens are sent. Initialized from the redirect_uris parameter passed to the constructor instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue
from office365.runtime.types.collections import StringCollection

Usage Example

from office365.runtime.client_value import ClientValue
from office365.runtime.types.collections import StringCollection

class WebApplication(ClientValue):
    def __init__(self, home_page_url=None, logout_url=None, redirect_uris=None):
        self.homePageUrl = home_page_url
        self.logoutUrl = logout_url
        self.redirectUris = StringCollection(redirect_uris)

# Create a web application configuration
web_app = WebApplication(
    home_page_url='https://myapp.example.com',
    logout_url='https://myapp.example.com/logout',
    redirect_uris=[
        'https://myapp.example.com/auth/callback',
        'https://myapp.example.com/signin-oidc'
    ]
)

# Access the attributes
print(web_app.homePageUrl)  # 'https://myapp.example.com'
print(web_app.logoutUrl)    # 'https://myapp.example.com/logout'
print(web_app.redirectUris) # StringCollection with the redirect URIs

# Create with minimal configuration
minimal_app = WebApplication(redirect_uris=['https://localhost:8080/callback'])
print(minimal_app.homePageUrl)  # None

Best Practices

  • Always provide at least one redirect URI when configuring OAuth 2.0 applications, as this is typically required for authentication flows
  • Ensure all URLs are valid and use HTTPS in production environments for security
  • The redirect_uris parameter accepts None or a list; passing an empty list is valid and will create an empty StringCollection
  • This class is immutable after instantiation - to modify settings, create a new instance
  • This class is typically used as part of a larger application registration or configuration object in Microsoft Graph API calls
  • The class inherits from ClientValue, which likely provides serialization capabilities for API requests - do not manually serialize
  • All parameters are optional, allowing flexible configuration based on application requirements
  • The homePageUrl should point to the publicly accessible landing page of your application
  • The logoutUrl must be registered with Microsoft's authorization service to function properly in logout flows

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class ApiApplication 76.6% similar

    A data class representing configuration settings for an application that implements a web API, specifically for Azure AD application registration.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/applications/api.py
  • class SpaApplication 76.1% similar

    A class representing configuration settings for a single-page application (SPA), specifically managing redirect URIs used in OAuth/authentication flows.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/applications/spa.py
  • class PublicClientApplication 72.6% similar

    A configuration class that specifies settings for public client applications such as mobile apps, desktop applications, or other non-web clients that cannot securely store client secrets.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/applications/public_client.py
  • class Application 61.1% similar

    Represents an Azure Active Directory (Azure AD) application registration, providing methods to manage application credentials, certificates, passwords, and publisher verification.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/applications/application.py
  • class WebApplication_v1 59.5% similar

    Represents a SharePoint Web Application entity, providing access to web application properties, sites collection, and lookup functionality.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/administration/web_application.py
← Back to Browse