I am trying to change the button name {wsfederation} that comes as the default when you enable adfs on asp.net core application as shown on the following doc https://learn.microsoft.com/en-us/aspnet/core/security/authentication/ws-federation?view=aspnetcore-2.0.
How can I achieve this?
The default identity templates use the SignInManager.GetExternalAuthenticationSchemesAsync
method to retrieve all registered external authentication schemes and uses a scheme’s display name as the button label.
The scheme’s display label is “WFederation” by default for the WsFederation scheme but you can change a scheme’s display name by setting it explicitly while registering it. There’s typically an overload to the Add~
method for schemes that allows you to set it too.
In your case, it would look like this:
services.AddAuthentication()
.AddWsFederation(WsFederationDefaults.AuthenticationScheme, "Active Directory", options =>
{
// …
});
The display name now would be “Active Directory” so that would be the button label. Of course, you can change this however you want.
You could also just edit the default Identity UI. Chances are that you eventually want to change it anyway, so if you want your ADFS login displayed differently, you could also just have a fixed button there to log in using ADFS instead of having the Identity UI fetch the available schemes first.