-
Notifications
You must be signed in to change notification settings - Fork 218
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
Make Microsoft.Identity.Web independent of the UI strings #1034
Comments
Would you think that this could go in MicrosoftIdentityOptions, @Ponant ? |
I am not familiar enough with this package but I just checked out
with a default value for In any case I think it will be clean to do so, currently there is a sort of implicit assumption that you will use the UI package along. I saw a few issues around this where it was suggested to trigger the I am happy to test it if need be. |
Hi @jmprieur , I come back to you to see if you are interested in a PR on this issue. Looking at the code and your suggestion, it seems that putting the strings in |
There is also this dependency on the UI route which could/should be fixed internal const string BlazorChallengeUri = "MicrosoftIdentity/Account/Challenge?redirectUri="; |
@jmprieur , in addition to the above, what about var callbackUrl = Url.Page(_optionsMonitor.Get(scheme).SignedOutRedirectUri,
pageHandler: null, values: null, protocol: Request.Scheme); and set instead of the hardcoded string for the SignOut in the Account controller var callbackUrl = Url.Page("/Account/SignedOut", pageHandler: null, values: null, protocol: Request.Scheme); |
@jmprieur , I am done with the changes. As a reminder, the idea is to make the Web library independent from the UI one. In MicrosoftIdentityOptions (3 changes) /// <summary>
/// Initializes a new instance of the <see cref="MicrosoftIdentityOptions"/> class.
/// </summary>
public MicrosoftIdentityOptions()
{
SignedOutRedirectUri = "/Account/SignedOut";
}
/// <summary>
/// Sets the ResetPassword route path.
/// Defaults to /MicrosoftIdentity/Account/ResetPassword,
/// which is the value used by Microsoft.Identity.Web.UI.
/// </summary>
public PathString ResetPasswordPath { get; set; } = new PathString("/MicrosoftIdentity/Account/ResetPassword");
/// <summary>
/// Sets the Error route path.
/// Defaults to the value /MicrosoftIdentity/Account/Error,
/// which is the value used by Microsoft.Identity.Web.UI.
/// </summary>
public PathString ErrorPath { get; set; } = new PathString("/MicrosoftIdentity/Account/Error"); In UpdateMergedOptionsFromMicrosoftIdentityOptions method internal static void UpdateMergedOptionsFromMicrosoftIdentityOptions(
MicrosoftIdentityOptions microsoftIdentityOptions, MergedOptions mergedOptions)
{
mergedOptions.ResetPasswordPath = microsoftIdentityOptions.ResetPasswordPath;
mergedOptions.ErrorPath = microsoftIdentityOptions.ErrorPath; In AzureADB2COpenIDConnectEventHandlers context.Response.Redirect($"{context.Request.PathBase}{Options.ResetPasswordPath}/{SchemeName}"); context.Response.Redirect($"{context.Request.PathBase}{Options.ErrorPath}"); In SignOut action var callbackUrl = Url.Page(_optionsMonitor.Get(scheme)
.SignedOutRedirectUri, pageHandler: null, values: null, protocol: Request.Scheme); I can push and PR that. |
Done |
Included in 1.18.0 release thanks for the great contribution @Ponant |
you are most welcome @jennyf19 |
Hello,
Currently, it seems that the
Microsoft.Identity.Web
is somewhat dependent on a hard coded path for the error, such as here (I did not check elsewhere yet)https://github.com/AzureAD/microsoft-identity-web/blob/master/src/Microsoft.Identity.Web/AzureADB2COpenIDConnectEventHandlers.cs
This makes it ok when used in conjunction with the UI package, but not immediate to customize otherwise. I was hitting this issue on Azure B2C by triggering errors on purpose, and I was not using the
Microsoft.Identity.Web.UI
package.I think it will be great to move this kind of string out of the class to a configuration that can be set in
AddMicrosoftIdentityWebApp
.Does this makes sense?
The text was updated successfully, but these errors were encountered: