diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..882ebd79 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,45 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +# Describe the bug +A clear and concise description of what the bug is. + +# Expected behavior +A clear and concise description of what you expected to happen. + +# How does this bug make you feel? +_Share a gif from [giphy](https://giphy.com/) to tells us how you'd feel_ + +--- + +# Debugging information + +## Steps to reproduce +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +## Screenshots +If applicable, add screenshots to help explain your problem. + +## Logs + +If applicable, add logs to help the engineer debug the problem. + +--- + +# Tasks + +_To be filled in by the engineer picking up the issue_ + +- [ ] Task 1 +- [ ] Task 2 +- [ ] ... diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..3496fc82 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,32 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +# Motivation + +A clear and concise description of why this feature would be useful and the value it would bring. +Explain any alternatives considered and why they are not sufficient. + +# How would you feel if this feature request was implemented? + +_Share a gif from [giphy](https://giphy.com/) to tells us how you'd feel. Format: ![alt_text](https://media.giphy.com/media/xxx/giphy.gif)_ + +# Requirements + +A list of requirements to consider this feature delivered +- Requirement 1 +- Requirement 2 +- ... + +# Tasks + +_To be filled in by the engineer picking up the issue_ + +- [ ] Task 1 +- [ ] Task 2 +- [ ] ... diff --git a/.github/ISSUE_TEMPLATE/subtask.md b/.github/ISSUE_TEMPLATE/subtask.md new file mode 100644 index 00000000..9f86c843 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/subtask.md @@ -0,0 +1,22 @@ +--- +name: Sub task +about: A sub task +title: '' +labels: subtask +assignees: '' + +--- + +Required by + +# Description + +A clear and concise description of what this subtask is. + +# Tasks + +_To be filled in by the engineer picking up the subtask + +- [ ] Task 1 +- [ ] Task 2 +- [ ] ... diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..8cc23880 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,38 @@ +## Purpose + +* ... + +## 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 + + diff --git a/.github/workflows/pr-title-checker.yml b/.github/workflows/pr-title-checker.yml new file mode 100644 index 00000000..debfc53f --- /dev/null +++ b/.github/workflows/pr-title-checker.yml @@ -0,0 +1,22 @@ +name: "PR Title Checker" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + merge_group: + +permissions: + pull-requests: read + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + if: ${{ github.event_name != 'merge_group' }} + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index 45ed398c..c8438f61 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Follow the quick deploy steps on the deployment guide to deploy this solution to [Click here to launch the deployment guide](./content-gen/docs/DEPLOYMENT.md)

-| [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/microsoft/document-generation-solution-accelerator) | [![Open in Dev Containers](https://img.shields.io/static/v1?style=for-the-badge&label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/document-generation-solution-accelerator) | [![Open in Visual Studio Code Web](https://img.shields.io/static/v1?style=for-the-badge&label=Visual%20Studio%20Code%20(Web)&message=Open&color=blue&logo=visualstudiocode&logoColor=white)](https://vscode.dev/azure/?vscode-azure-exp=foundry&agentPayload=eyJiYXNlVXJsIjogImh0dHBzOi8vcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbS9taWNyb3NvZnQvZG9jdW1lbnQtZ2VuZXJhdGlvbi1zb2x1dGlvbi1hY2NlbGVyYXRvci9yZWZzL2hlYWRzL21haW4vY29udGVudC1nZW4vaW5mcmEvdnNjb2RlX3dlYiIsICJpbmRleFVybCI6ICIvaW5kZXguanNvbiIsICJ2YXJpYWJsZXMiOiB7ImFnZW50SWQiOiAiIiwgImNvbm5lY3Rpb25TdHJpbmciOiAiIiwgInRocmVhZElkIjogIiIsICJ1c2VyTWVzc2FnZSI6ICIiLCAicGxheWdyb3VuZE5hbWUiOiAiIiwgImxvY2F0aW9uIjogIiIsICJzdWJzY3JpcHRpb25JZCI6ICIiLCAicmVzb3VyY2VJZCI6ICIiLCAicHJvamVjdFJlc291cmNlSWQiOiAiIiwgImVuZHBvaW50IjogIiJ9LCAiY29kZVJvdXRlIjogWyJhaS1wcm9qZWN0cy1zZGsiLCAicHl0aG9uIiwgImRlZmF1bHQtYXp1cmUtYXV0aCIsICJlbmRwb2ludCJdfQ==) | +| [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/microsoft/content-generation-solution-accelerator) | [![Open in Dev Containers](https://img.shields.io/static/v1?style=for-the-badge&label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/content-generation-solution-accelerator) | [![Open in Visual Studio Code Web](https://img.shields.io/static/v1?style=for-the-badge&label=Visual%20Studio%20Code%20(Web)&message=Open&color=blue&logo=visualstudiocode&logoColor=white)](https://vscode.dev/azure/?vscode-azure-exp=foundry&agentPayload=eyJiYXNlVXJsIjogImh0dHBzOi8vcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbS9taWNyb3NvZnQvY29udGVudC1nZW5lcmF0aW9uLXNvbHV0aW9uLWFjY2VsZXJhdG9yL3JlZnMvaGVhZHMvbWFpbi9jb250ZW50LWdlbi9pbmZyYS92c2NvZGVfd2ViIiwgImluZGV4VXJsIjogIi9pbmRleC5qc29uIiwgInZhcmlhYmxlcyI6IHsiYWdlbnRJZCI6ICIiLCAiY29ubmVjdGlvblN0cmluZyI6ICIiLCAidGhyZWFkSWQiOiAiIiwgInVzZXJNZXNzYWdlIjogIiIsICJwbGF5Z3JvdW5kTmFtZSI6ICIiLCAibG9jYXRpb24iOiAiIiwgInN1YnNjcmlwdGlvbklkIjogIiIsICJyZXNvdXJjZUlkIjogIiIsICJwcm9qZWN0UmVzb3VyY2VJZCI6ICIiLCAiZW5kcG9pbnQiOiAiIn0sICJjb2RlUm91dGUiOiBbImFpLXByb2plY3RzLXNkayIsICJweXRob24iLCAiZGVmYXVsdC1henVyZS1hdXRoIiwgImVuZHBvaW50Il19) | |---|---|---|
@@ -190,7 +190,7 @@ Check out similar solution accelerators ## Provide feedback -Have questions, find a bug, or want to request a feature? [Submit a new issue](https://github.com/microsoft/document-generation-solution-accelerator/issues) on this repo and we'll connect. +Have questions, find a bug, or want to request a feature? [Submit a new issue](https://github.com/microsoft/content-generation-solution-accelerator/issues) on this repo and we'll connect.
diff --git a/content-gen/docs/AppAuthentication.md b/content-gen/docs/AppAuthentication.md new file mode 100644 index 00000000..2d97aece --- /dev/null +++ b/content-gen/docs/AppAuthentication.md @@ -0,0 +1,32 @@ +# Set Up Authentication in Azure App Service + +This document provides step-by-step instructions to configure Azure App Registrations for a front-end application. + +## Prerequisites + +- Access to **Microsoft Entra ID** +- Necessary permissions to create and manage **App Registrations** + +## Step 1: Add Authentication in Azure App Service configuration +1. Click on `Authentication` from left menu. + + ![Authentication](images/AppAuthentication.png) + +2. Click on `+ Add identity provider` to see a list of identity providers. + + ![Authentication Identity](images/AppAuthenticationIdentity.png) + +3. Click on `Identity Provider` dropdown to see a list of identity providers. + + ![Add Provider](images/AppAuthIdentityProvider.png) + +4. Select the first option `Microsoft Entra Id` from the drop-down list and select `client secret expiration` under App registration. +> NOTE: If `Create new app registration` is disabled, then go to [Create new app registration](create_new_app_registration.md) and come back to this step to complete the app authentication. + + ![Add Provider](images/AppAuthIdentityProviderAdd.png) + +5. Accept the default values and click on `Add` button to go back to the previous page with the identity provider added. + + ![Add Provider](images/AppAuthIdentityProviderAdded.png) + +6. You have successfully added app authentication, and now required to log in to access the application. diff --git a/content-gen/docs/DEPLOYMENT.md b/content-gen/docs/DEPLOYMENT.md index a12a7dc8..7100cf40 100644 --- a/content-gen/docs/DEPLOYMENT.md +++ b/content-gen/docs/DEPLOYMENT.md @@ -31,7 +31,7 @@ This will allow the scripts to run for the current session without permanently c Pick from the options below to see step-by-step instructions for GitHub Codespaces, VS Code Dev Containers, VS Code Web, and Local Environments. -| [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/microsoft/document-generation-solution-accelerator) | [![Open in Dev Containers](https://img.shields.io/static/v1?style=for-the-badge&label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/document-generation-solution-accelerator) | [![Open in Visual Studio Code Web](https://img.shields.io/static/v1?style=for-the-badge&label=Visual%20Studio%20Code%20(Web)&message=Open&color=blue&logo=visualstudiocode&logoColor=white)](https://vscode.dev/azure/?vscode-azure-exp=foundry&agentPayload=eyJiYXNlVXJsIjogImh0dHBzOi8vcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbS9taWNyb3NvZnQvZG9jdW1lbnQtZ2VuZXJhdGlvbi1zb2x1dGlvbi1hY2NlbGVyYXRvci9yZWZzL2hlYWRzL21haW4vY29udGVudC1nZW4vaW5mcmEvdnNjb2RlX3dlYiIsICJpbmRleFVybCI6ICIvaW5kZXguanNvbiIsICJ2YXJpYWJsZXMiOiB7ImFnZW50SWQiOiAiIiwgImNvbm5lY3Rpb25TdHJpbmciOiAiIiwgInRocmVhZElkIjogIiIsICJ1c2VyTWVzc2FnZSI6ICIiLCAicGxheWdyb3VuZE5hbWUiOiAiIiwgImxvY2F0aW9uIjogIiIsICJzdWJzY3JpcHRpb25JZCI6ICIiLCAicmVzb3VyY2VJZCI6ICIiLCAicHJvamVjdFJlc291cmNlSWQiOiAiIiwgImVuZHBvaW50IjogIiJ9LCAiY29kZVJvdXRlIjogWyJhaS1wcm9qZWN0cy1zZGsiLCAicHl0aG9uIiwgImRlZmF1bHQtYXp1cmUtYXV0aCIsICJlbmRwb2ludCJdfQ==) | +| [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/microsoft/content-generation-solution-accelerator) | [![Open in Dev Containers](https://img.shields.io/static/v1?style=for-the-badge&label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/content-generation-solution-accelerator) | [![Open in Visual Studio Code Web](https://img.shields.io/static/v1?style=for-the-badge&label=Visual%20Studio%20Code%20(Web)&message=Open&color=blue&logo=visualstudiocode&logoColor=white)](https://vscode.dev/azure/?vscode-azure-exp=foundry&agentPayload=eyJiYXNlVXJsIjogImh0dHBzOi8vcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbS9taWNyb3NvZnQvY29udGVudC1nZW5lcmF0aW9uLXNvbHV0aW9uLWFjY2VsZXJhdG9yL3JlZnMvaGVhZHMvbWFpbi9jb250ZW50LWdlbi9pbmZyYS92c2NvZGVfd2ViIiwgImluZGV4VXJsIjogIi9pbmRleC5qc29uIiwgInZhcmlhYmxlcyI6IHsiYWdlbnRJZCI6ICIiLCAiY29ubmVjdGlvblN0cmluZyI6ICIiLCAidGhyZWFkSWQiOiAiIiwgInVzZXJNZXNzYWdlIjogIiIsICJwbGF5Z3JvdW5kTmFtZSI6ICIiLCAibG9jYXRpb24iOiAiIiwgInN1YnNjcmlwdGlvbklkIjogIiIsICJyZXNvdXJjZUlkIjogIiIsICJwcm9qZWN0UmVzb3VyY2VJZCI6ICIiLCAiZW5kcG9pbnQiOiAiIn0sICJjb2RlUm91dGUiOiBbImFpLXByb2plY3RzLXNkayIsICJweXRob24iLCAiZGVmYXVsdC1henVyZS1hdXRoIiwgImVuZHBvaW50Il19) | |---|---|---|
@@ -43,7 +43,7 @@ You can run this solution using GitHub Codespaces. The button will open a web-ba 1. Open the solution accelerator (this may take several minutes): - [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/microsoft/document-generation-solution-accelerator) + [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/microsoft/content-generation-solution-accelerator) 2. Accept the default values on the create Codespaces page. 3. Open a terminal window if it is not already open. @@ -61,7 +61,7 @@ You can run this solution in VS Code Dev Containers, which will open the project 1. Start Docker Desktop (install it if not already installed). 2. Open the project: - [![Open in Dev Containers](https://img.shields.io/static/v1?style=for-the-badge&label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/document-generation-solution-accelerator) + [![Open in Dev Containers](https://img.shields.io/static/v1?style=for-the-badge&label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/content-generation-solution-accelerator) 3. In the VS Code window that opens, once the project files show up (this may take several minutes), open a terminal window. 4. Continue with the [deploying steps](#deploying-with-azd). @@ -77,7 +77,7 @@ You can run this solution using VS Code Web, which provides a browser-based deve 1. Open the solution accelerator: - [![Open in Visual Studio Code Web](https://img.shields.io/static/v1?style=for-the-badge&label=Visual%20Studio%20Code%20(Web)&message=Open&color=blue&logo=visualstudiocode&logoColor=white)](https://vscode.dev/azure/?vscode-azure-exp=foundry&agentPayload=eyJiYXNlVXJsIjogImh0dHBzOi8vcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbS9taWNyb3NvZnQvZG9jdW1lbnQtZ2VuZXJhdGlvbi1zb2x1dGlvbi1hY2NlbGVyYXRvci9yZWZzL2hlYWRzL21haW4vY29udGVudC1nZW4vaW5mcmEvdnNjb2RlX3dlYiIsICJpbmRleFVybCI6ICIvaW5kZXguanNvbiIsICJ2YXJpYWJsZXMiOiB7ImFnZW50SWQiOiAiIiwgImNvbm5lY3Rpb25TdHJpbmciOiAiIiwgInRocmVhZElkIjogIiIsICJ1c2VyTWVzc2FnZSI6ICIiLCAicGxheWdyb3VuZE5hbWUiOiAiIiwgImxvY2F0aW9uIjogIiIsICJzdWJzY3JpcHRpb25JZCI6ICIiLCAicmVzb3VyY2VJZCI6ICIiLCAicHJvamVjdFJlc291cmNlSWQiOiAiIiwgImVuZHBvaW50IjogIiJ9LCAiY29kZVJvdXRlIjogWyJhaS1wcm9qZWN0cy1zZGsiLCAicHl0aG9uIiwgImRlZmF1bHQtYXp1cmUtYXV0aCIsICJlbmRwb2ludCJdfQ==) + [![Open in Visual Studio Code Web](https://img.shields.io/static/v1?style=for-the-badge&label=Visual%20Studio%20Code%20(Web)&message=Open&color=blue&logo=visualstudiocode&logoColor=white)](https://vscode.dev/azure/?vscode-azure-exp=foundry&agentPayload=eyJiYXNlVXJsIjogImh0dHBzOi8vcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbS9taWNyb3NvZnQvY29udGVudC1nZW5lcmF0aW9uLXNvbHV0aW9uLWFjY2VsZXJhdG9yL3JlZnMvaGVhZHMvbWFpbi9jb250ZW50LWdlbi9pbmZyYS92c2NvZGVfd2ViIiwgImluZGV4VXJsIjogIi9pbmRleC5qc29uIiwgInZhcmlhYmxlcyI6IHsiYWdlbnRJZCI6ICIiLCAiY29ubmVjdGlvblN0cmluZyI6ICIiLCAidGhyZWFkSWQiOiAiIiwgInVzZXJNZXNzYWdlIjogIiIsICJwbGF5Z3JvdW5kTmFtZSI6ICIiLCAibG9jYXRpb24iOiAiIiwgInN1YnNjcmlwdGlvbklkIjogIiIsICJyZXNvdXJjZUlkIjogIiIsICJwcm9qZWN0UmVzb3VyY2VJZCI6ICIiLCAiZW5kcG9pbnQiOiAiIn0sICJjb2RlUm91dGUiOiBbImFpLXByb2plY3RzLXNkayIsICJweXRob24iLCAiZGVmYXVsdC1henVyZS1hdXRoIiwgImVuZHBvaW50Il19) 2. Sign in with your Azure account when prompted. 3. Select the subscription where you want to deploy the solution. @@ -113,7 +113,7 @@ If you're not using one of the above options for opening the project, then you'l 2. Clone the repository or download the project code via command-line: ```shell - azd init -t microsoft/document-generation-solution-accelerator/ + azd init -t microsoft/content-generation-solution-accelerator/ ``` 3. Open the project folder in your terminal or editor. diff --git a/content-gen/docs/create_new_app_registration.md b/content-gen/docs/create_new_app_registration.md new file mode 100644 index 00000000..7dcf2c40 --- /dev/null +++ b/content-gen/docs/create_new_app_registration.md @@ -0,0 +1,35 @@ +# Creating a new App Registration + +1. Click on `Home` and select `Microsoft Entra ID`. + +![Microsoft Entra ID](images/MicrosoftEntraID.png) + +2. Click on `App registrations`. + +![App registrations](images/Appregistrations.png) + +3. Click on `+ New registration`. + +![New Registrations](images/NewRegistration.png) + +4. Provide the `Name`, select supported account types as `Accounts in this organizational directory only(Contoso only - Single tenant)`, select platform as `Web`, enter/select the `URL` and register. + +![Add Details](images/AddDetails.png) + +5. After application is created successfully, then click on `Add a Redirect URL`. + +![Redirect URL](images/AddRedirectURL.png) + +6. Click on `+ Add a platform`. + +![+ Add platform](images/AddPlatform.png) + +7. Click on `Web`. + +![Web](images/Web.png) + +8. Enter the `web app URL` (Provide the app service name in place of XXXX) and Save. Then go back to [Set Up Authentication in Azure App Service](AppAuthentication.md) Step 1 page and follow from _Point 4_ choose `Pick an existing app registration in this directory` from the Add an Identity Provider page and provide the newly registered App Name. + +E.g. <>.azurewebsites.net/.auth/login/aad/callback>> + +![Add Details](images/WebAppURL.png) diff --git a/content-gen/docs/images/AddDetails.png b/content-gen/docs/images/AddDetails.png new file mode 100644 index 00000000..f36b596f Binary files /dev/null and b/content-gen/docs/images/AddDetails.png differ diff --git a/content-gen/docs/images/AddPlatform.png b/content-gen/docs/images/AddPlatform.png new file mode 100644 index 00000000..6c74919b Binary files /dev/null and b/content-gen/docs/images/AddPlatform.png differ diff --git a/content-gen/docs/images/AddRedirectURL.png b/content-gen/docs/images/AddRedirectURL.png new file mode 100644 index 00000000..d5cbcfac Binary files /dev/null and b/content-gen/docs/images/AddRedirectURL.png differ diff --git a/content-gen/docs/images/AppAuthIdentityProvider.png b/content-gen/docs/images/AppAuthIdentityProvider.png new file mode 100644 index 00000000..ca9ea30f Binary files /dev/null and b/content-gen/docs/images/AppAuthIdentityProvider.png differ diff --git a/content-gen/docs/images/AppAuthIdentityProviderAdd.png b/content-gen/docs/images/AppAuthIdentityProviderAdd.png new file mode 100644 index 00000000..17ccf135 Binary files /dev/null and b/content-gen/docs/images/AppAuthIdentityProviderAdd.png differ diff --git a/content-gen/docs/images/AppAuthIdentityProviderAdded.png b/content-gen/docs/images/AppAuthIdentityProviderAdded.png new file mode 100644 index 00000000..ea94ce81 Binary files /dev/null and b/content-gen/docs/images/AppAuthIdentityProviderAdded.png differ diff --git a/content-gen/docs/images/AppAuthentication.png b/content-gen/docs/images/AppAuthentication.png new file mode 100644 index 00000000..e2a8ca00 Binary files /dev/null and b/content-gen/docs/images/AppAuthentication.png differ diff --git a/content-gen/docs/images/AppAuthenticationIdentity.png b/content-gen/docs/images/AppAuthenticationIdentity.png new file mode 100644 index 00000000..79f45812 Binary files /dev/null and b/content-gen/docs/images/AppAuthenticationIdentity.png differ diff --git a/content-gen/docs/images/Appregistrations.png b/content-gen/docs/images/Appregistrations.png new file mode 100644 index 00000000..af2d3ae4 Binary files /dev/null and b/content-gen/docs/images/Appregistrations.png differ diff --git a/content-gen/docs/images/MicrosoftEntraID.png b/content-gen/docs/images/MicrosoftEntraID.png new file mode 100644 index 00000000..1f24b89d Binary files /dev/null and b/content-gen/docs/images/MicrosoftEntraID.png differ diff --git a/content-gen/docs/images/NewRegistration.png b/content-gen/docs/images/NewRegistration.png new file mode 100644 index 00000000..288f9af5 Binary files /dev/null and b/content-gen/docs/images/NewRegistration.png differ diff --git a/content-gen/docs/images/Web.png b/content-gen/docs/images/Web.png new file mode 100644 index 00000000..35f84645 Binary files /dev/null and b/content-gen/docs/images/Web.png differ diff --git a/content-gen/docs/images/WebAppURL.png b/content-gen/docs/images/WebAppURL.png new file mode 100644 index 00000000..40c6740e Binary files /dev/null and b/content-gen/docs/images/WebAppURL.png differ diff --git a/content-gen/docs/images/create_new_app_registration.md b/content-gen/docs/images/create_new_app_registration.md new file mode 100644 index 00000000..7dcf2c40 --- /dev/null +++ b/content-gen/docs/images/create_new_app_registration.md @@ -0,0 +1,35 @@ +# Creating a new App Registration + +1. Click on `Home` and select `Microsoft Entra ID`. + +![Microsoft Entra ID](images/MicrosoftEntraID.png) + +2. Click on `App registrations`. + +![App registrations](images/Appregistrations.png) + +3. Click on `+ New registration`. + +![New Registrations](images/NewRegistration.png) + +4. Provide the `Name`, select supported account types as `Accounts in this organizational directory only(Contoso only - Single tenant)`, select platform as `Web`, enter/select the `URL` and register. + +![Add Details](images/AddDetails.png) + +5. After application is created successfully, then click on `Add a Redirect URL`. + +![Redirect URL](images/AddRedirectURL.png) + +6. Click on `+ Add a platform`. + +![+ Add platform](images/AddPlatform.png) + +7. Click on `Web`. + +![Web](images/Web.png) + +8. Enter the `web app URL` (Provide the app service name in place of XXXX) and Save. Then go back to [Set Up Authentication in Azure App Service](AppAuthentication.md) Step 1 page and follow from _Point 4_ choose `Pick an existing app registration in this directory` from the Add an Identity Provider page and provide the newly registered App Name. + +E.g. <>.azurewebsites.net/.auth/login/aad/callback>> + +![Add Details](images/WebAppURL.png) diff --git a/content-gen/src/app/frontend/src/App.tsx b/content-gen/src/app/frontend/src/App.tsx index a0556a17..fd1de0de 100644 --- a/content-gen/src/app/frontend/src/App.tsx +++ b/content-gen/src/app/frontend/src/App.tsx @@ -17,17 +17,11 @@ import { ChatHistory } from './components/ChatHistory'; import type { ChatMessage, CreativeBrief, Product, GeneratedContent } from './types'; import ContosoLogo from './styles/images/contoso.svg'; -interface UserInfo { - user_principal_id: string; - user_name: string; - auth_provider: string; - is_authenticated: boolean; -} - function App() { const [conversationId, setConversationId] = useState(() => uuidv4()); const [userId, setUserId] = useState(''); + const [userName, setUserName] = useState(''); const [messages, setMessages] = useState([]); const [isLoading, setIsLoading] = useState(false); const [generationStatus, setGenerationStatus] = useState(''); @@ -72,18 +66,32 @@ function App() { fetchConfig(); }, []); - // Fetch current user on mount + // Fetch current user on mount - using /.auth/me (Azure App Service built-in auth endpoint) useEffect(() => { const fetchUser = async () => { try { - const response = await fetch('/api/user'); + const response = await fetch('/.auth/me'); if (response.ok) { - const user: UserInfo = await response.json(); - setUserId(user.user_principal_id || 'anonymous'); + const payload = await response.json(); + + // Extract user ID from objectidentifier claim + const userClaims = payload[0]?.user_claims || []; + const objectIdClaim = userClaims.find( + (claim: { typ: string; val: string }) => + claim.typ === 'http://schemas.microsoft.com/identity/claims/objectidentifier' + ); + setUserId(objectIdClaim?.val || 'anonymous'); + + // Extract display name from 'name' claim + const nameClaim = userClaims.find( + (claim: { typ: string; val: string }) => claim.typ === 'name' + ); + setUserName(nameClaim?.val || ''); } } catch (err) { console.error('Error fetching user:', err); setUserId('anonymous'); + setUserName(''); } }; fetchUser(); @@ -725,17 +733,6 @@ function App() { } }, [confirmedBrief, selectedProducts, conversationId]); - // Get user initials for avatar - const getUserInitials = () => { - if (!userId) return 'U'; - // If we have a name, use first letter of first and last name - const parts = userId.split('@')[0].split('.'); - if (parts.length >= 2) { - return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase(); - } - return userId[0].toUpperCase(); - }; - return (
{/* Header */} @@ -764,8 +761,7 @@ function App() { /> diff --git a/content-gen/src/backend/app.py b/content-gen/src/backend/app.py index aecdf7f8..3fe4ffc6 100644 --- a/content-gen/src/backend/app.py +++ b/content-gen/src/backend/app.py @@ -76,19 +76,6 @@ async def health_check(): }) -# ==================== User Info Endpoint ==================== - -@app.route("/api/user", methods=["GET"]) -async def get_current_user(): - """ - Get the current authenticated user info. - - Returns user details from EasyAuth headers, or empty values if not authenticated. - """ - user = get_authenticated_user() - return jsonify(user) - - # ==================== Chat Endpoints ==================== @app.route("/api/chat", methods=["POST"]) diff --git a/docs/images/readme/solution_architecture.png b/docs/images/readme/solution_architecture.png index 0ddd5e9e..9fd59be5 100644 Binary files a/docs/images/readme/solution_architecture.png and b/docs/images/readme/solution_architecture.png differ