Skip to content

Feat/enhanced login #789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
May 9, 2025

Conversation

ChiefStief
Copy link
Collaborator

@ChiefStief ChiefStief commented May 5, 2025

Requirements List

Description List

  • Added branded styles to the user pools using managed login

Testing List

  • For API configuration changes: CDK tests added/updated in backend/compact-connect/tests/unit/test_api.py
  • Code review
  • Deploy to your sandbox and see if everything is looking good

Closes #719

Summary by CodeRabbit

  • New Features

    • Added support for customizing AWS Cognito managed login UI branding, allowing tailored styles and branding for different user groups.
    • Introduced separate configuration files for staff and provider login UI themes, supporting both light and dark modes.
    • Enabled custom branding assets (logos, backgrounds, favicons) for login interfaces.
  • Chores

    • Refactored login branding management into a dedicated stack to improve maintainability and deployment efficiency.

Copy link
Contributor

coderabbitai bot commented May 5, 2025

"""

Walkthrough

Support for AWS Cognito managed login UI branding is added. New methods are introduced to the UserPool class for encoding branding assets and applying them to a user pool client. JSON configuration files define style settings. The managed login styling responsibility is moved from ProviderUsers and StaffUsers stacks to a new dedicated ManagedLoginStack. The BackendStage is updated to include this new stack.

Changes

File(s) Change Summary
backend/compact-connect/common_constructs/user_pool.py Added methods to encode image assets to base64, prepare branding asset properties, and apply managed login UI branding to a user pool client.
backend/compact-connect/resources/provider_managed_login_style_settings.json Added a comprehensive JSON configuration file specifying UI style settings for provider-managed login components.
backend/compact-connect/resources/staff_managed_login_style_settings.json Added a comprehensive JSON configuration file specifying UI style settings for staff-managed login components.
backend/compact-connect/stacks/persistent_stack/provider_users.py Removed managed login styling logic; added comment that styling is now handled in ManagedLoginStack.
backend/compact-connect/stacks/persistent_stack/staff_users.py Added comment that managed login styling is now handled in ManagedLoginStack.
backend/compact-connect/pipeline/backend_stage.py Added instantiation of new ManagedLoginStack between PersistentStack and IngestStack.
backend/compact-connect/stacks/managed_login_stack.py Added new ManagedLoginStack class that manages loading style settings, preparing branding assets, and creating managed login branding resources for staff and provider user pools.
backend/compact-connect/stacks/api_stack/v1_api/api_model.py Fixed syntax error in JSON schema definition by adding missing closing parenthesis.
backend/compact-connect/stacks/persistent_stack/compact_configuration_upload.py Refactored ValueError message formatting for better readability without changing logic.

Sequence Diagram(s)

sequenceDiagram
    participant ManagedLoginStack
    participant PersistentStack
    participant UserPool
    participant UserPoolClient
    participant Branding JSON
    participant Image Files

    ManagedLoginStack->>Branding JSON: Load style settings for staff and provider
    ManagedLoginStack->>PersistentStack: Request branding assets preparation
    PersistentStack->>UserPool: prepare_assets_for_managed_login_ui()
    UserPool->>Image Files: Read and encode images to base64
    UserPool->>PersistentStack: Return branding assets
    ManagedLoginStack->>UserPoolClient: Create CfnManagedLoginBranding with assets and settings
    ManagedLoginStack->>UserPoolClient: Add dependency for resource creation order
Loading

Assessment against linked issues

Objective Addressed Explanation
Backend support for enhanced login page styling (#719)
Add "back to dashboard" button (#719) No changes related to UI buttons observed in the code.

Poem

🐇 Hop, hop, the styles align,
With colors bright and logos fine.
Branding baked with base64,
Managed login shines once more!
From JSON scripts to coded art,
A rabbit’s joy in every part!
🌈✨
"""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 978c1f5 and ff68f04.

📒 Files selected for processing (6)
  • backend/compact-connect/common_constructs/user_pool.py (5 hunks)
  • backend/compact-connect/pipeline/backend_stage.py (2 hunks)
  • backend/compact-connect/stacks/api_stack/v1_api/api_model.py (1 hunks)
  • backend/compact-connect/stacks/managed_login_stack.py (1 hunks)
  • backend/compact-connect/stacks/persistent_stack/compact_configuration_upload.py (1 hunks)
  • backend/compact-connect/stacks/persistent_stack/provider_users.py (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • backend/compact-connect/stacks/persistent_stack/compact_configuration_upload.py
  • backend/compact-connect/stacks/api_stack/v1_api/api_model.py
  • backend/compact-connect/stacks/persistent_stack/provider_users.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • backend/compact-connect/pipeline/backend_stage.py
  • backend/compact-connect/stacks/managed_login_stack.py
  • backend/compact-connect/common_constructs/user_pool.py
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: TestPython
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ChiefStief ChiefStief marked this pull request as ready for review May 7, 2025 18:24
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (6)
backend/compact-connect/common_constructs/user_pool.py (3)

229-246: Well-structured method for applying managed login styles.

The method correctly creates a CfnManagedLoginBranding resource and sets up the proper dependency relationship with the user pool client. This ensures that the client resource is created before the branding is applied.

I notice that the resource ID is hardcoded as 'MyCfnManagedLoginBranding', which could cause conflicts if multiple login branding resources are created within the same construct scope.

Consider making the identifier more specific:

-        login_branding = CfnManagedLoginBranding(self, 'MyCfnManagedLoginBranding',
+        login_branding = CfnManagedLoginBranding(self, f'{user_pool_client.node.id}ManagedLoginBranding',

247-281: Well-designed asset preparation method.

The method handles different types of assets appropriately (favicon, logo, background) and has a good optional parameter design for the background file path. The implementation follows AWS documentation guidelines as noted in the comment.

Two suggestions for improvement:

  1. Consider adding error handling for missing files:
    def prepare_assets_for_managed_login_ui(
        self,
        ico_filepath: str,
        logo_filepath: str,
        background_file_path: str | None = None
    ):
+        # Validate file existence
+        for filepath in [ico_filepath, logo_filepath]:
+            if not os.path.exists(filepath):
+                raise ValueError(f"Required file not found: {filepath}")
+        
+        if background_file_path and not os.path.exists(background_file_path):
+            raise ValueError(f"Background file not found: {background_file_path}")

        # options found: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-managedloginbranding-assettype.html#cfn-cognito-managedloginbranding-assettype-category
  1. The method would benefit from a docstring explaining the purpose and parameters.

283-287: Simple and effective utility method.

This method correctly handles binary file reading and base64 encoding.

Consider adding error handling for file operations.

    def convert_img_to_base_64(self, file_path: str):
+        """
+        Converts an image file to a base64 encoded string.
+        
+        Args:
+            file_path: Path to the image file to convert
+            
+        Returns:
+            Base64 encoded string representation of the image file
+            
+        Raises:
+            FileNotFoundError: If the file does not exist
+            IOError: If there is an issue reading the file
+        """
        with open(file_path, 'rb') as binary_file:
            binary_file_data = binary_file.read()
            base64_encoded_data = base64.b64encode(binary_file_data)
            return base64_encoded_data.decode('utf-8')
backend/compact-connect/stacks/persistent_stack/provider_users.py (1)

76-88: Well-structured implementation of managed login styling.

The implementation follows a clean approach:

  1. Load styling settings from JSON file
  2. Prepare the branding assets
  3. Apply styles and assets to the user pool client

The code leverages the new methods added to the UserPool class effectively.

Two considerations for further improvement:

  1. Consider adding error handling for the file loading operation:
-        with open('resources/provider_managed_login_style_settings.json') as f:
-            branding_settings = json.load(f)
+        try:
+            with open('resources/provider_managed_login_style_settings.json') as f:
+                branding_settings = json.load(f)
+        except (FileNotFoundError, json.JSONDecodeError) as e:
+            self.node.add_warning(f"Could not load branding settings: {str(e)}. Using default branding.")
+            branding_settings = {}
  1. Consider making the asset paths configurable rather than hardcoded:
        branding_assets = self.prepare_assets_for_managed_login_ui(
-            ico_filepath='resources/assets/favicon.ico',
-            logo_filepath='resources/assets/compact-connect-logo.png'
+            ico_filepath=self.node.try_get_context('branding_favicon') or 'resources/assets/favicon.ico',
+            logo_filepath=self.node.try_get_context('branding_logo') or 'resources/assets/compact-connect-logo.png'
        )
backend/compact-connect/stacks/persistent_stack/staff_users.py (1)

74-87: Effective implementation of managed login styling for staff users.

The implementation properly:

  1. Loads styling settings from a staff-specific JSON file
  2. Prepares branding assets including a background image
  3. Applies styles and assets to the staff UI client

The implementation is consistent with the approach used for provider users.

Two considerations for improvement:

  1. The file loading code is duplicated between this class and ProviderUsers. Consider extracting a utility method in the parent UserPool class:
# In UserPool class:
+    def load_branding_settings(self, file_path):
+        """Load branding settings from a JSON file with error handling"""
+        try:
+            with open(file_path) as f:
+                return json.load(f)
+        except (FileNotFoundError, json.JSONDecodeError) as e:
+            self.node.add_warning(f"Could not load branding settings from {file_path}: {str(e)}. Using default branding.")
+            return {}

# Then in StaffUsers:
-        with open('resources/staff_managed_login_style_settings.json') as f:
-            branding_settings = json.load(f)
+        branding_settings = self.load_branding_settings('resources/staff_managed_login_style_settings.json')
  1. Consider making the asset paths configurable to improve flexibility:
        branding_assets = self.prepare_assets_for_managed_login_ui(
-            ico_filepath='resources/assets/favicon.ico',
-            logo_filepath='resources/assets/compact-connect-logo.png',
-            background_file_path='resources/assets/staff-background.png'
+            ico_filepath=self.node.try_get_context('staff_branding_favicon') or 'resources/assets/favicon.ico',
+            logo_filepath=self.node.try_get_context('staff_branding_logo') or 'resources/assets/compact-connect-logo.png',
+            background_file_path=self.node.try_get_context('staff_branding_background') or 'resources/assets/staff-background.png'
        )
backend/compact-connect/resources/provider_managed_login_style_settings.json (1)

1-449: Comprehensive styling configuration for the managed login UI.

The JSON configuration provides detailed styling for all UI components in both light and dark modes, adhering to what appears to be a consistent design system.

A few observations:

  1. Color values are specified without the "#" prefix (e.g., "ffffffff" instead of "#ffffffff"). This is likely required by AWS Cognito's API, but it would be helpful to add a comment in the related code explaining this requirement.

  2. Some color values appear to include alpha channels (8 characters instead of 6), but others might not have fully specified alpha values. Ensure all color specifications follow the same format as required by AWS Cognito.

  3. Consider adding a comment or documentation about how to update or modify these styles in the future, including any tools or design system references that were used to generate these values.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7a293d6 and d8dcc06.

⛔ Files ignored due to path filters (3)
  • backend/compact-connect/resources/assets/compact-connect-logo.png is excluded by !**/*.png
  • backend/compact-connect/resources/assets/favicon.ico is excluded by !**/*.ico
  • backend/compact-connect/resources/assets/staff-background.png is excluded by !**/*.png
📒 Files selected for processing (4)
  • backend/compact-connect/common_constructs/user_pool.py (5 hunks)
  • backend/compact-connect/resources/provider_managed_login_style_settings.json (1 hunks)
  • backend/compact-connect/stacks/persistent_stack/provider_users.py (2 hunks)
  • backend/compact-connect/stacks/persistent_stack/staff_users.py (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
backend/compact-connect/stacks/persistent_stack/staff_users.py (1)
backend/compact-connect/common_constructs/user_pool.py (2)
  • prepare_assets_for_managed_login_ui (247-281)
  • add_managed_login_styles (229-245)
backend/compact-connect/stacks/persistent_stack/provider_users.py (1)
backend/compact-connect/common_constructs/user_pool.py (2)
  • prepare_assets_for_managed_login_ui (247-281)
  • add_managed_login_styles (229-245)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: TestPython
🔇 Additional comments (4)
backend/compact-connect/common_constructs/user_pool.py (3)

1-1: Appropriate import added for base64 encoding.

The addition of the base64 module is necessary for the new image encoding functionality.


10-10: Required Cognito imports added.

Adding CfnManagedLoginBranding and making UserPoolClient explicit are necessary for the new managed login UI styling functionality.

Also applies to: 25-25


130-131: Good parameter design with optional UI scopes.

Making the ui_scopes parameter optional with a default value of None is a good practice, ensuring backward compatibility.

backend/compact-connect/stacks/persistent_stack/provider_users.py (1)

3-4: Appropriate import added for JSON handling.

The import of the json module is necessary for loading style settings from the configuration file.

Copy link
Collaborator

@landonshumway-ia landonshumway-ia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Through local testing, it looks like you need to set the managed login version when calling the self.add_domain( in the UserPool common construct.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (5)
backend/compact-connect/stacks/persistent_stack/provider_users.py (1)

3-4: Remove unused import.

The json import is no longer used after moving the managed login styling logic to the ManagedLoginStack.

-import json
🧰 Tools
🪛 Ruff (0.8.2)

3-3: json imported but unused

Remove unused import: json

(F401)

backend/compact-connect/stacks/managed_login_stack.py (4)

16-26: Constructor has unused parameters.

The environment_name and environment_context parameters are declared but not used in the implementation.

If these parameters are not needed, consider removing them or documenting why they're included for future use:

def __init__(
    self,
    scope: Construct,
    construct_id: str,
    *,
    persistent_stack: PersistentStack,
-   environment_name: str,
-   environment_context: dict,
    **kwargs,
) -> None:
    super().__init__(scope, construct_id, **kwargs)

If they're kept for future use or API consistency, add a comment explaining this.

🧰 Tools
🪛 Ruff (0.8.2)

22-22: Unused method argument: environment_name

(ARG002)


23-23: Unused method argument: environment_context

(ARG002)


34-60: Consider making file paths more robust.

The implementation uses relative file paths which may be fragile if the working directory changes during execution.

Consider using a more robust approach to locate resource files, such as:

- with open('resources/staff_managed_login_style_settings.json') as f:
+ import os
+ # Add this where appropriate, e.g., as a class method or in __init__
+ def get_resource_path(self, filename):
+     """Get absolute path to a resource file."""
+     base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+     return os.path.join(base_dir, 'resources', filename)
+ 
+ # Then use it in your methods
+ with open(self.get_resource_path('staff_managed_login_style_settings.json')) as f:
🧰 Tools
🪛 Ruff (0.8.2)

39-39: Blank line contains whitespace

Remove whitespace from blank line

(W293)


46-46: Blank line contains whitespace

Remove whitespace from blank line

(W293)


49-49: Trailing whitespace

Remove trailing whitespace

(W291)


58-58: Blank line contains whitespace

Remove whitespace from blank line

(W293)


34-87: Consider reducing code duplication.

The methods _create_managed_login_for_staff_users and _create_managed_login_for_provider_users have significant duplication.

Extract common logic into a helper method:

def _create_managed_login(self, 
                         user_type: str,
                         user_pool_group,
                         style_settings_file: str,
                         assets_config: dict):
    """
    Create managed login branding for a user pool
    
    Args:
        user_type: String identifier ('Staff' or 'Provider')
        user_pool_group: The user pool group (staff_users or provider_users)
        style_settings_file: Path to style settings JSON
        assets_config: Dictionary of asset file paths
    """
    # Load the style settings
    with open(style_settings_file) as f:
        branding_settings = json.load(f)
        
    # Prepare the assets
    branding_assets = user_pool_group.prepare_assets_for_managed_login_ui(**assets_config)
    
    # Create the managed login branding
    login_branding = CfnManagedLoginBranding(
        self, 
        f'{user_type}ManagedLoginBranding',
        user_pool_id=user_pool_group.user_pool_id,
        assets=branding_assets,
        client_id=user_pool_group.ui_client.user_pool_client_id,
        return_merged_resources=False,
        settings=branding_settings,
        use_cognito_provided_values=False
    )
    
    # Add dependency on the UI client
    login_branding.add_dependency(user_pool_group.ui_client.node.default_child)
    
    return login_branding

Then call it from your initialization:

def __init__(self, ...):
    # ...
    self._create_managed_login(
        'Staff',
        persistent_stack.staff_users,
        'resources/staff_managed_login_style_settings.json',
        {
            'ico_filepath': 'resources/assets/favicon.ico',
            'logo_filepath': 'resources/assets/compact-connect-logo.png',
            'background_file_path': 'resources/assets/staff-background.png'
        }
    )
    
    self._create_managed_login(
        'Provider',
        persistent_stack.provider_users,
        'resources/provider_managed_login_style_settings.json',
        {
            'ico_filepath': 'resources/assets/favicon.ico',
            'logo_filepath': 'resources/assets/compact-connect-logo.png'
        }
    )
🧰 Tools
🪛 Ruff (0.8.2)

39-39: Blank line contains whitespace

Remove whitespace from blank line

(W293)


46-46: Blank line contains whitespace

Remove whitespace from blank line

(W293)


49-49: Trailing whitespace

Remove trailing whitespace

(W291)


58-58: Blank line contains whitespace

Remove whitespace from blank line

(W293)


67-67: Blank line contains whitespace

Remove whitespace from blank line

(W293)


73-73: Blank line contains whitespace

Remove whitespace from blank line

(W293)


76-76: Trailing whitespace

Remove trailing whitespace

(W291)


85-85: Blank line contains whitespace

Remove whitespace from blank line

(W293)


49-49: Remove trailing whitespace.

There's trailing whitespace on lines 49 and 76.

-            self, 
+            self,

Also applies to: 76-76

🧰 Tools
🪛 Ruff (0.8.2)

49-49: Trailing whitespace

Remove trailing whitespace

(W291)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between acd24fd and c8b142c.

📒 Files selected for processing (5)
  • backend/compact-connect/common_constructs/user_pool.py (6 hunks)
  • backend/compact-connect/pipeline/backend_stage.py (2 hunks)
  • backend/compact-connect/stacks/managed_login_stack.py (1 hunks)
  • backend/compact-connect/stacks/persistent_stack/provider_users.py (2 hunks)
  • backend/compact-connect/stacks/persistent_stack/staff_users.py (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • backend/compact-connect/stacks/persistent_stack/staff_users.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • backend/compact-connect/common_constructs/user_pool.py
🧰 Additional context used
🧬 Code Graph Analysis (1)
backend/compact-connect/pipeline/backend_stage.py (1)
backend/compact-connect/stacks/managed_login_stack.py (1)
  • ManagedLoginStack (8-87)
🪛 Ruff (0.8.2)
backend/compact-connect/stacks/managed_login_stack.py

11-11: Blank line contains whitespace

Remove whitespace from blank line

(W293)


22-22: Unused method argument: environment_name

(ARG002)


23-23: Unused method argument: environment_context

(ARG002)


30-30: Blank line contains whitespace

Remove whitespace from blank line

(W293)


39-39: Blank line contains whitespace

Remove whitespace from blank line

(W293)


46-46: Blank line contains whitespace

Remove whitespace from blank line

(W293)


49-49: Trailing whitespace

Remove trailing whitespace

(W291)


58-58: Blank line contains whitespace

Remove whitespace from blank line

(W293)


67-67: Blank line contains whitespace

Remove whitespace from blank line

(W293)


73-73: Blank line contains whitespace

Remove whitespace from blank line

(W293)


76-76: Trailing whitespace

Remove trailing whitespace

(W291)


85-85: Blank line contains whitespace

Remove whitespace from blank line

(W293)

backend/compact-connect/stacks/persistent_stack/provider_users.py

3-3: json imported but unused

Remove unused import: json

(F401)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: TestPython
🔇 Additional comments (6)
backend/compact-connect/pipeline/backend_stage.py (2)

9-9: Added import for the new ManagedLoginStack.

The import is correctly placed with other stack imports.


39-47: Correctly integrates the new ManagedLoginStack.

The stack is properly instantiated between the PersistentStack and IngestStack, with all necessary parameters passed. This follows the same pattern as other stacks in the file.

backend/compact-connect/stacks/persistent_stack/provider_users.py (1)

76-78: Clear comment explaining architectural change.

Good documentation explaining that managed login styling has been moved to reduce CloudFormation template size.

backend/compact-connect/stacks/managed_login_stack.py (3)

8-15: Well-documented new stack class.

The class documentation clearly explains the purpose of this new stack and its benefits in relation to CloudFormation template size limits.

🧰 Tools
🪛 Ruff (0.8.2)

11-11: Blank line contains whitespace

Remove whitespace from blank line

(W293)


53-57: CfnManagedLoginBranding configuration looks good.

The managed login branding is configured correctly with user pool ID, client ID, assets, and settings. The explicit setting of return_merged_resources=False and use_cognito_provided_values=False ensures consistent behavior.


60-60: Good dependency management.

Adding an explicit dependency on the UI client ensures proper deployment order, preventing potential race conditions during CloudFormation deployment.

Also applies to: 87-87

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
backend/compact-connect/stacks/managed_login_stack.py (4)

11-11: Remove whitespace from blank line.

This blank line contains whitespace which should be removed.

-    
+
🧰 Tools
🪛 Ruff (0.8.2)

11-11: Blank line contains whitespace

Remove whitespace from blank line

(W293)


40-48: Consider parameterizing file paths.

The file paths for assets are hardcoded. Consider making them configurable via environment variables or configuration files to improve flexibility.


51-60: Remove unused variable assignment.

The variable staff_login_branding is assigned but never used.

-        staff_login_branding = CfnManagedLoginBranding(
+        CfnManagedLoginBranding(
🧰 Tools
🪛 Ruff (0.8.2)

51-51: Local variable staff_login_branding is assigned to but never used

Remove assignment to unused variable staff_login_branding

(F841)


75-84: Remove unused variable assignment.

The variable provider_login_branding is assigned but never used.

-        provider_login_branding = CfnManagedLoginBranding(
+        CfnManagedLoginBranding(
🧰 Tools
🪛 Ruff (0.8.2)

75-75: Local variable provider_login_branding is assigned to but never used

Remove assignment to unused variable provider_login_branding

(F841)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c8b142c and 978c1f5.

📒 Files selected for processing (1)
  • backend/compact-connect/stacks/managed_login_stack.py (1 hunks)
🧰 Additional context used
🪛 Ruff (0.8.2)
backend/compact-connect/stacks/managed_login_stack.py

11-11: Blank line contains whitespace

Remove whitespace from blank line

(W293)


51-51: Local variable staff_login_branding is assigned to but never used

Remove assignment to unused variable staff_login_branding

(F841)


75-75: Local variable provider_login_branding is assigned to but never used

Remove assignment to unused variable provider_login_branding

(F841)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: TestPython
🔇 Additional comments (3)
backend/compact-connect/stacks/managed_login_stack.py (3)

8-19: Well-structured stack with clear documentation!

The creation of a separate stack for managing Cognito branding assets is a smart approach to avoid CloudFormation template size limits. I particularly appreciate the documentation that explains how to obtain the style settings JSON data.

🧰 Tools
🪛 Ruff (0.8.2)

11-11: Blank line contains whitespace

Remove whitespace from blank line

(W293)


31-35: LGTM!

The initialization code cleanly separates the creation of managed login branding for different user groups.


69-72: Note the absence of background image for provider users.

Unlike the staff users configuration, the provider users don't have a background image. If this is intentional, it might be worth adding a comment explaining this difference.

Copy link
Collaborator

@landonshumway-ia landonshumway-ia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just deployed it and verified everything in my sandbox. This is ready for your review @jlkravitz

@landonshumway-ia landonshumway-ia requested a review from jlkravitz May 8, 2025 14:50
Copy link
Collaborator

@jlkravitz jlkravitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isabeleliassen Good to merge after #790

@jlkravitz jlkravitz requested a review from isabeleliassen May 9, 2025 00:09
@isabeleliassen isabeleliassen merged commit 08532b9 into csg-org:development May 9, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backend for nice login page
4 participants