Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace bunch of string concatenation with usage of StringBulder #55

Open
wants to merge 1 commit into
base: feature/Authentication
Choose a base branch
from

Conversation

maxime-poulain
Copy link
Contributor

@maxime-poulain maxime-poulain commented May 10, 2023

This commit aims to prevent unnecessary string concatenation.

While the choice of using a StringBuilder was made, there are alternatives:

  • a List<string> that gets flattened with string.Join: now this method uses vectorization which makes its performance close to the StringBuilder
  • Arcu's Message(s)

@@ -254,11 +264,6 @@ public static AuthenticationBuilder AddOidcAuthentication(this IServiceCollectio
cookiesConfigureOptionsType = Type.GetType(settings.CookiesConfigureOptionsType, true);
}

if (string.IsNullOrWhiteSpace(settings.ResponseType))
{
throw new MissingFieldException("A ResponseType is mandatory to define the OpenId Connect protocol.");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of throwining the exception at the end if the setting is missing
I have moved up the check so the error is added to the error list.

Change is that MissingFieldException would not e thrown anymore.


if (string.IsNullOrWhiteSpace(settings.OpenIdConnectEventsType))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of throwining the exception at the end if the setting is missing
I have moved up the check so the error is added to the error list.

Change is that MissingFieldException would not e thrown anymore.

@maxime-poulain
Copy link
Contributor Author

I see there are now conflicts, I'll fix them in few days.

I think there were people complaining about the usage of a StringBuilder,
I am open ears to adjust accordingly.

@maxime-poulain maxime-poulain marked this pull request as ready for review May 15, 2023 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant