@MrStonedOne MitM requested changes.

This commit is contained in:
Dominion
2023-04-05 00:16:26 -04:00
parent 55a015bf31
commit b60b6ffc3f
4 changed files with 10 additions and 2 deletions
+1
View File
@@ -173,6 +173,7 @@ Security:
ClientSecret: "..."
RedirectUrl: "..."
ServerUrl: "..."
UserInformationUrlOverride: "..." # For power users, leave out of configuration for most cases. Not supported by GitHub provider.
```
The following providers use the `RedirectUrl` setting:
+1 -1
View File
@@ -4,7 +4,7 @@
<Import Project="ControlPanelVersion.props" />
<PropertyGroup>
<TgsCoreVersion>5.7.3</TgsCoreVersion>
<TgsConfigVersion>4.4.0</TgsConfigVersion>
<TgsConfigVersion>4.5.0</TgsConfigVersion>
<TgsApiVersion>9.9.0</TgsApiVersion>
<TgsApiLibraryVersion>10.3.0</TgsApiLibraryVersion>
<TgsClientVersion>11.3.0</TgsClientVersion>
@@ -16,5 +16,10 @@ namespace Tgstation.Server.Host.Configuration
/// The authentication server URL. Not used by all providers.
/// </summary>
public Uri RedirectUrl { get; set; }
/// <summary>
/// User information URL override. Not supported by the <see cref="Api.Models.OAuthProvider.GitHub"/> provider.
/// </summary>
public Uri UserInformationUrlOverride { get; set; }
}
}
@@ -121,7 +121,9 @@ namespace Tgstation.Server.Host.Security.OAuth
}
Logger.LogTrace("Getting user details...");
using var userInformationRequest = new HttpRequestMessage(HttpMethod.Get, UserInformationUrl);
var userInfoUrl = OAuthConfiguration?.UserInformationUrlOverride ?? UserInformationUrl;
using var userInformationRequest = new HttpRequestMessage(HttpMethod.Get, userInfoUrl);
userInformationRequest.Headers.Authorization = new AuthenticationHeaderValue(
ApiHeaders.BearerAuthenticationScheme,
accessToken);