Skip to content

Commit 163a006

Browse files
Remove redundant formatting
Remove redundant string formatting from JumpCloud.
1 parent 50d3dc6 commit 163a006

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/AspNet.Security.OAuth.JumpCloud/JumpCloudAuthenticationDefaults.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* for more information concerning the license and the contributors participating to this project.
55
*/
66

7-
using System.Globalization;
8-
97
namespace AspNet.Security.OAuth.JumpCloud;
108

119
/// <summary>
@@ -36,30 +34,33 @@ public static class JumpCloudAuthenticationDefaults
3634
/// <summary>
3735
/// Default path format to use for <see cref="OAuthOptions.AuthorizationEndpoint"/>.
3836
/// </summary>
37+
[Obsolete("This field is obsolete and will be removed in a future version.")]
3938
public static readonly string AuthorizationEndpointPathFormat = "/oauth2/auth";
4039

4140
/// <summary>
4241
/// Default path format to use for <see cref="OAuthOptions.TokenEndpoint"/>.
4342
/// </summary>
43+
[Obsolete("This field is obsolete and will be removed in a future version.")]
4444
public static readonly string TokenEndpointPathFormat = "/oauth2/token";
4545

4646
/// <summary>
4747
/// Default path format to use for <see cref="OAuthOptions.UserInformationEndpoint"/>.
4848
/// </summary>
49+
[Obsolete("This field is obsolete and will be removed in a future version.")]
4950
public static readonly string UserInformationEndpointPathFormat = "/userinfo";
5051

5152
/// <summary>
5253
/// Default path to use for <see cref="OAuthOptions.AuthorizationEndpoint"/>.
5354
/// </summary>
54-
public static readonly string AuthorizationEndpointPath = string.Format(CultureInfo.InvariantCulture, AuthorizationEndpointPathFormat);
55+
public static readonly string AuthorizationEndpointPath = "/oauth2/auth";
5556

5657
/// <summary>
5758
/// Default path to use for <see cref="OAuthOptions.TokenEndpoint"/>.
5859
/// </summary>
59-
public static readonly string TokenEndpointPath = string.Format(CultureInfo.InvariantCulture, TokenEndpointPathFormat);
60+
public static readonly string TokenEndpointPath = "/oauth2/token";
6061

6162
/// <summary>
6263
/// Default path to use for <see cref="OAuthOptions.UserInformationEndpoint"/>.
6364
/// </summary>
64-
public static readonly string UserInformationEndpointPath = string.Format(CultureInfo.InvariantCulture, UserInformationEndpointPathFormat);
65+
public static readonly string UserInformationEndpointPath = "/userinfo";
6566
}

src/AspNet.Security.OAuth.JumpCloud/JumpCloudPostConfigureOptions.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* for more information concerning the license and the contributors participating to this project.
55
*/
66

7-
using System.Globalization;
87
using Microsoft.Extensions.Options;
98

109
namespace AspNet.Security.OAuth.JumpCloud;
@@ -24,15 +23,13 @@ public void PostConfigure(
2423
throw new ArgumentException("No JumpCloud domain configured.", nameof(options));
2524
}
2625

27-
options.AuthorizationEndpoint = CreateUrl(options.Domain, JumpCloudAuthenticationDefaults.AuthorizationEndpointPathFormat);
28-
options.TokenEndpoint = CreateUrl(options.Domain, JumpCloudAuthenticationDefaults.TokenEndpointPathFormat);
29-
options.UserInformationEndpoint = CreateUrl(options.Domain, JumpCloudAuthenticationDefaults.UserInformationEndpointPathFormat);
26+
options.AuthorizationEndpoint = CreateUrl(options.Domain, JumpCloudAuthenticationDefaults.AuthorizationEndpointPath);
27+
options.TokenEndpoint = CreateUrl(options.Domain, JumpCloudAuthenticationDefaults.TokenEndpointPath);
28+
options.UserInformationEndpoint = CreateUrl(options.Domain, JumpCloudAuthenticationDefaults.UserInformationEndpointPath);
3029
}
3130

32-
private static string CreateUrl(string domain, string pathFormat, params object[] args)
31+
private static string CreateUrl(string domain, string path)
3332
{
34-
var path = string.Format(CultureInfo.InvariantCulture, pathFormat, args);
35-
3633
// Enforce use of HTTPS
3734
var builder = new UriBuilder(domain)
3835
{

0 commit comments

Comments
 (0)