Merge pull request #1448 from tgstation/MSOsKajigger [TGSDeploy]

Add's a UserInformationUrlOverride configuration option
This commit is contained in:
Jordan Dominion
2023-04-05 01:15:57 -04:00
committed by GitHub
5 changed files with 12 additions and 4 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
@@ -1,6 +1,6 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- This is in it's own file to help incremental building, changing it causes a complete rebuild of the web panel -->
<TgsControlPanelVersion>4.17.0</TgsControlPanelVersion>
<TgsControlPanelVersion>4.18.0</TgsControlPanelVersion>
</PropertyGroup>
</Project>
+2 -2
View File
@@ -3,8 +3,8 @@
<!-- Integration tests will ensure they match across the board -->
<Import Project="ControlPanelVersion.props" />
<PropertyGroup>
<TgsCoreVersion>5.7.3</TgsCoreVersion>
<TgsConfigVersion>4.4.0</TgsConfigVersion>
<TgsCoreVersion>5.8.0</TgsCoreVersion>
<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);