diff --git a/build/Version.props b/build/Version.props
index 096a0bc299..70bdd75827 100644
--- a/build/Version.props
+++ b/build/Version.props
@@ -4,8 +4,8 @@
4.17.1
- 4.1.0
- 9.4.0
+ 4.2.0
+ 9.5.0
9.4.0
10.5.0
6.0.5
diff --git a/src/Tgstation.Server.Api/Models/OAuthProvider.cs b/src/Tgstation.Server.Api/Models/OAuthProvider.cs
index 716686ed16..a6dfbe07bb 100644
--- a/src/Tgstation.Server.Api/Models/OAuthProvider.cs
+++ b/src/Tgstation.Server.Api/Models/OAuthProvider.cs
@@ -28,5 +28,10 @@ namespace Tgstation.Server.Api.Models
/// https://www.keycloak.org
///
Keycloak,
+
+ ///
+ /// https://invisioncommunity.com/
+ ///
+ InvisionCommunity,
}
}
diff --git a/src/Tgstation.Server.Host/Security/OAuth/InvisionCommunityOAuthValidator.cs b/src/Tgstation.Server.Host/Security/OAuth/InvisionCommunityOAuthValidator.cs
new file mode 100644
index 0000000000..e0021d0143
--- /dev/null
+++ b/src/Tgstation.Server.Host/Security/OAuth/InvisionCommunityOAuthValidator.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Net.Http;
+
+using Microsoft.Extensions.Logging;
+
+using Tgstation.Server.Api.Models;
+using Tgstation.Server.Host.Configuration;
+using Tgstation.Server.Host.System;
+
+namespace Tgstation.Server.Host.Security.OAuth
+{
+ ///
+ /// OAuth validator for Invision Community (selfhosted).
+ ///
+ sealed class InvisionCommunityOAuthValidator : GenericOAuthValidator
+ {
+ ///
+ public override OAuthProvider Provider => OAuthProvider.InvisionCommunity;
+
+ ///
+ protected override Uri TokenUrl => new Uri($"{OAuthConfiguration.ServerUrl}/oauth/token/"); // This needs the trailing slash or it doesnt get the token. Do not remove.
+
+ ///
+ protected override Uri UserInformationUrl => new Uri($"{OAuthConfiguration.ServerUrl}/api/core/me");
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The for the .
+ /// The for the .
+ /// The for the .
+ /// The for the .
+ public InvisionCommunityOAuthValidator(
+ IHttpClientFactory httpClientFactory,
+ IAssemblyInformationProvider assemblyInformationProvider,
+ ILogger logger,
+ OAuthConfiguration oAuthConfiguration)
+ : base(httpClientFactory, assemblyInformationProvider, logger, oAuthConfiguration)
+ {
+ }
+
+ ///
+ protected override OAuthTokenRequest CreateTokenRequest(string code) => new OAuthTokenRequest(OAuthConfiguration, code, "profile");
+
+ ///
+ protected override string DecodeTokenPayload(dynamic responseJson) => responseJson.access_token;
+
+ ///
+ protected override string DecodeUserInformationPayload(dynamic responseJson) => responseJson.id;
+ }
+}
diff --git a/src/Tgstation.Server.Host/Security/OAuth/OAuthProviders.cs b/src/Tgstation.Server.Host/Security/OAuth/OAuthProviders.cs
index b51f21a61c..5337ee051f 100644
--- a/src/Tgstation.Server.Host/Security/OAuth/OAuthProviders.cs
+++ b/src/Tgstation.Server.Host/Security/OAuth/OAuthProviders.cs
@@ -79,6 +79,14 @@ namespace Tgstation.Server.Host.Security.OAuth
assemblyInformationProvider,
loggerFactory.CreateLogger(),
keyCloakConfig));
+
+ if (securityConfiguration.OAuth.TryGetValue(OAuthProvider.InvisionCommunity, out var invisionConfig))
+ validatorsBuilder.Add(
+ new InvisionCommunityOAuthValidator(
+ httpClientFactory,
+ assemblyInformationProvider,
+ loggerFactory.CreateLogger(),
+ invisionConfig));
}
///