From f87f609e380067dfe373e0b77478e72cb019a63b Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Tue, 8 Dec 2020 17:44:40 -0500 Subject: [PATCH] Add serverUrl to OAuthProviderInfo --- docs/API.dox | 2 +- src/Tgstation.Server.Api/Models/OAuthProviderInfo.cs | 5 +++++ .../Security/OAuth/GenericOAuthValidator.cs | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/API.dox b/docs/API.dox index 0a27032d8e..66f79a3174 100644 --- a/docs/API.dox +++ b/docs/API.dox @@ -128,7 +128,7 @@ TGS4 supports OAuth 2.0 with select providers for authentication. The flow for this is as follows: -- Retrieve the @ref api_ver to find out available OAuth providers and their respective client ID and redirect URIs. +- Retrieve the @ref api_ver to find out which @ref Tgstation.Server.Api.Models.OAuthProvider are enabled and their respective information. - Send the user to the Authorization Request endpoint for the provider using the client ID from above. See https://tools.ietf.org/html/rfc6749#section-4.1.1. DO NOT specify a redirect URI, this should be configured in the provider. - Retrieve the authorization response code after successfully completing the authorize step above. - Perform the following request: diff --git a/src/Tgstation.Server.Api/Models/OAuthProviderInfo.cs b/src/Tgstation.Server.Api/Models/OAuthProviderInfo.cs index 10466c3204..6163e445f4 100644 --- a/src/Tgstation.Server.Api/Models/OAuthProviderInfo.cs +++ b/src/Tgstation.Server.Api/Models/OAuthProviderInfo.cs @@ -16,5 +16,10 @@ namespace Tgstation.Server.Api.Models /// The redirect URL. /// public Uri? RedirectUri { get; set; } + + /// + /// The server URL. + /// + public Uri? ServerUrl { get; set; } } } diff --git a/src/Tgstation.Server.Host/Security/OAuth/GenericOAuthValidator.cs b/src/Tgstation.Server.Host/Security/OAuth/GenericOAuthValidator.cs index ad0de1e980..4a6beb15e6 100644 --- a/src/Tgstation.Server.Host/Security/OAuth/GenericOAuthValidator.cs +++ b/src/Tgstation.Server.Host/Security/OAuth/GenericOAuthValidator.cs @@ -127,7 +127,8 @@ namespace Tgstation.Server.Host.Security.OAuth new OAuthProviderInfo { ClientId = OAuthConfiguration.ClientId, - RedirectUri = OAuthConfiguration.RedirectUrl + RedirectUri = OAuthConfiguration.RedirectUrl, + ServerUrl = OAuthConfiguration.ServerUrl }); } }