From 3168eded05065353d3bcd6e1347ad2e6174ff176 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Mon, 7 Dec 2020 12:40:04 -0500 Subject: [PATCH] Refactors Scope into base OAuthTokenRequest --- .../Security/OAuth/DiscordTokenRequest.cs | 8 +------- .../Security/OAuth/OAuthTokenRequest.cs | 15 +++++++++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Tgstation.Server.Host/Security/OAuth/DiscordTokenRequest.cs b/src/Tgstation.Server.Host/Security/OAuth/DiscordTokenRequest.cs index a3ee43c704..cf477ba156 100644 --- a/src/Tgstation.Server.Host/Security/OAuth/DiscordTokenRequest.cs +++ b/src/Tgstation.Server.Host/Security/OAuth/DiscordTokenRequest.cs @@ -13,21 +13,15 @@ namespace Tgstation.Server.Host.Security.OAuth /// public string GrantType { get; } - /// - /// The 'scope' field. - /// - public string Scope { get; } - /// /// Initializes a new instance of the . /// /// The for the . /// The OAuth code for the . public DiscordTokenRequest(OAuthConfigurationBase oAuthConfiguration, string code) - : base(oAuthConfiguration, code) + : base(oAuthConfiguration, code, "identify") { GrantType = "authorization_code"; - Scope = "identify"; } } } diff --git a/src/Tgstation.Server.Host/Security/OAuth/OAuthTokenRequest.cs b/src/Tgstation.Server.Host/Security/OAuth/OAuthTokenRequest.cs index 1db7a8f692..cad2885746 100644 --- a/src/Tgstation.Server.Host/Security/OAuth/OAuthTokenRequest.cs +++ b/src/Tgstation.Server.Host/Security/OAuth/OAuthTokenRequest.cs @@ -9,19 +9,26 @@ namespace Tgstation.Server.Host.Security.OAuth class OAuthTokenRequest : OAuthConfigurationBase { /// - /// The OAuth code. + /// The OAuth code received from the browser. /// public string Code { get; } /// - /// Initializes a new instance of the + /// The scopes being requested. + /// + public string Scope { get; } + + /// + /// Initializes a new instance of the . /// /// The to build from. - /// The OAuth code received from the browser. - public OAuthTokenRequest(OAuthConfigurationBase oAuthConfiguration, string code) + /// The value of . + /// The value of + public OAuthTokenRequest(OAuthConfigurationBase oAuthConfiguration, string code, string scope) : base(oAuthConfiguration) { Code = code ?? throw new ArgumentNullException(nameof(code)); + Scope = scope ?? throw new ArgumentNullException(nameof(scope)); } } }