Skip to content

Commit

Permalink
address pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gitri-ms committed Aug 12, 2023
1 parent 3419e87 commit 82dbb02
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,15 @@ By default, Chat Copilot runs locally without authentication, using a guest user
### Instructions
1. Create an [application registration](https://learn.microsoft.com/azure/active-directory/develop/quickstart-register-app) for the frontend web app, using the values below
- `Supported account types`: "_Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)_"
- `Supported account types`: "_Accounts in this organizational directory only ({YOUR TENANT} only - Single tenant)_"
- `Redirect URI (optional)`: _Single-page application (SPA)_ and use _http://localhost:3000_.
2. Create a second [application registration](https://learn.microsoft.com/azure/active-directory/develop/quickstart-register-app) for the backend web api, using the values below:
- `Supported account types`: "_Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)_"
- `Supported account types`: "_Accounts in this organizational directory only ({YOUR TENANT} only - Single tenant)_"
- Do **not** configure a `Redirect URI (optional)`
> NOTE: Other account types can be used to allow multitenant and personal Microsoft accounts to use your application if you desire. Doing so may result in more users and therefore higher costs.
> Take note of the `Application (client) ID` for both app registrations as you will need them in future steps.
3. Expose an API within the second app registration
Expand All @@ -145,7 +146,7 @@ By default, Chat Copilot runs locally without authentication, using a guest user
2. Add an _Application ID URI_
1. This will generate an `api://` URI with a generated for you
1. This will generate an `api://` URI
2. Click _Save_ to store the generated URI
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ You will need two Azure Active Directory (AAD) application registrations -- one
1. Select *Expose an API* from the menu

2. Add an *Application ID URI*
1. This will generate an `api://` URI with a generated for you
1. This will generate an `api://` URI

2. Click *Save* to store the generated URI

Expand Down
9 changes: 2 additions & 7 deletions webapi/Controllers/ChatHistoryController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,15 @@ public async Task<IActionResult> GetChatSessionByIdAsync(Guid chatId)
/// <summary>
/// Get all chat sessions associated with the logged in user. Return an empty list if no chats are found.
/// </summary>
/// <param name="userId">The user id.</param>
/// <returns>A list of chat sessions. An empty list if the user is not in any chat session.</returns>
[HttpGet]
[Route("chatSession/getAllChats/{userId:regex(([[a-z0-9]]+-)+[[a-z0-9]]+\\.([[a-z0-9]]+-)+[[a-z0-9]]+)}")]
[Route("chatSession/getAllChats/{userId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status403Forbidden)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<IActionResult> GetAllChatSessionsAsync(string userId)
{
// TODO: [Issue #141] Remove this once we remove userId from route
if (!userId.Equals(this._authInfo.UserId, StringComparison.Ordinal))
{
return this.Forbid("User id does not match request.");
}

// Get all participants that belong to the user.
// Then get all the chats from the list of participants.
var chatParticipants = await this._participantRepository.FindByUserIdAsync(this._authInfo.UserId);
Expand Down
2 changes: 1 addition & 1 deletion webapp/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ REACT_APP_BACKEND_URI=https://localhost:40443/
# To enable authorization using Azure Active Directory, uncomment the following variables
# See paragraph "(Optional) Enable backend authorization via Azure AD" in README.md for details and setup
# REACT_APP_AUTH_TYPE=AzureAd
# REACT_APP_AAD_AUTHORITY=https://login.microsoftonline.com/common
# REACT_APP_AAD_AUTHORITY=https://login.microsoftonline.com/{YOUR_TENANT_ID}
# REACT_APP_AAD_CLIENT_ID=
# Authorization scopes to access webapi when using Azure AD authorization.
# REACT_APP_AAD_API_SCOPE=
Expand Down
2 changes: 2 additions & 0 deletions webapp/src/libs/auth/AuthHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const enum AuthType {
AAD = 'AzureAd',
}

// This is the default user information when authentication is set to 'None'.
// It must match what is defined in PassthroughAuthenticationHandler.cs on the backend.
export const DefaultChatUser: IChatUser = {
id: 'c05c61eb-65e4-4223-915a-fe72b0c9ece1',
emailAddress: '[email protected]',
Expand Down

0 comments on commit 82dbb02

Please sign in to comment.