Skip to content

feat: enable or disable authentication based on an environment variable#126

Merged
Harsh-Microsoft merged 2 commits intodevfrom
psl-hb-authEnabledFlag
May 7, 2025
Merged

feat: enable or disable authentication based on an environment variable#126
Harsh-Microsoft merged 2 commits intodevfrom
psl-hb-authEnabledFlag

Conversation

@Harsh-Microsoft
Copy link
Copy Markdown
Contributor

Purpose

This pull request introduces a new feature to enable or disable authentication dynamically based on an environment variable (REACT_APP_AUTH_ENABLED). The changes ensure that authentication logic is only applied when the feature is enabled, improving configurability and flexibility for different deployment scenarios.

Authentication Feature Toggle:

  • Environment Variable Addition: Added REACT_APP_AUTH_ENABLED to the .env file to toggle authentication. Defaults to true if not explicitly set. (src/ContentProcessorWeb/.env, src/ContentProcessorWeb/.envR14-R15)
  • Header Component Update: Introduced the authEnabled variable in Header.tsx to conditionally render the tools section in the header only when authentication is enabled. (src/ContentProcessorWeb/src/Components/Header/Header.tsx, [1] [2] [3]
  • Authentication Wrapper Update: Updated AuthWrapper.tsx to skip authentication checks and directly render children when authentication is disabled. Adjusted the useEffect dependency array and added fallback logic for unauthenticated states. (src/ContentProcessorWeb/src/msal-auth/AuthWrapper.tsx, src/ContentProcessorWeb/src/msal-auth/AuthWrapper.tsxR13-R23)

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

What to Check

Verify that the following are valid

  • ...

Other Information

@Harsh-Microsoft Harsh-Microsoft merged commit 573efa2 into dev May 7, 2025
5 checks passed
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.3.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@Prajwal-Microsoft Prajwal-Microsoft deleted the psl-hb-authEnabledFlag branch June 25, 2025 05:11
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.

2 participants