mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-23 21:16:52 +01:00
Refactors Scope into base OAuthTokenRequest
This commit is contained in:
@@ -13,21 +13,15 @@ namespace Tgstation.Server.Host.Security.OAuth
|
||||
/// </summary>
|
||||
public string GrantType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The 'scope' field.
|
||||
/// </summary>
|
||||
public string Scope { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DiscordTokenRequest"/> <see langword="class"/>.
|
||||
/// </summary>
|
||||
/// <param name="oAuthConfiguration">The <see cref="OAuthConfigurationBase"/> for the <see cref="OAuthTokenRequest"/>.</param>
|
||||
/// <param name="code">The OAuth code for the <see cref="OAuthTokenRequest"/>.</param>
|
||||
public DiscordTokenRequest(OAuthConfigurationBase oAuthConfiguration, string code)
|
||||
: base(oAuthConfiguration, code)
|
||||
: base(oAuthConfiguration, code, "identify")
|
||||
{
|
||||
GrantType = "authorization_code";
|
||||
Scope = "identify";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,19 +9,26 @@ namespace Tgstation.Server.Host.Security.OAuth
|
||||
class OAuthTokenRequest : OAuthConfigurationBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The OAuth code.
|
||||
/// The OAuth code received from the browser.
|
||||
/// </summary>
|
||||
public string Code { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="OAuthTokenRequest"/>
|
||||
/// The scopes being requested.
|
||||
/// </summary>
|
||||
public string Scope { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="OAuthTokenRequest"/> <see langword="class"/>.
|
||||
/// </summary>
|
||||
/// <param name="oAuthConfiguration">The <see cref="OAuthConfiguration"/> to build from.</param>
|
||||
/// <param name="code">The OAuth code received from the browser.</param>
|
||||
public OAuthTokenRequest(OAuthConfigurationBase oAuthConfiguration, string code)
|
||||
/// <param name="code">The value of <see cref="Code"/>.</param>
|
||||
/// <param name="scope">The value of <see cref="Scope"/></param>
|
||||
public OAuthTokenRequest(OAuthConfigurationBase oAuthConfiguration, string code, string scope)
|
||||
: base(oAuthConfiguration)
|
||||
{
|
||||
Code = code ?? throw new ArgumentNullException(nameof(code));
|
||||
Scope = scope ?? throw new ArgumentNullException(nameof(scope));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user