Version Affected: 22.12 Hotfix 3 and later, 22.02 Hotfix 10 and later, 23.07 Hotfix 1 and later, 24.04 and later
Overview
This article explains how to stop the SecureAuth Identity Provider (IdP) login page from auto-filling the username. Starting with 22.12 Hotfix 3, the login page fills in the Username field when the incoming request carries a username value in the URL query string. Some Service Providers (SPs) add this value automatically when they redirect users to SecureAuth. For example, Microsoft 365 (Web Services Federation, or WS-Federation) appends &username=user@example.com after the user types their email address on the Microsoft sign-in page.
The feature only fills in the field. It does not submit the form or skip any authentication step, and users can still change the value. Some organizations prefer that users always type their username, for example when the realm expects a sAMAccountName but the SP sends a User Principal Name (UPN) or email address.
There are two ways to turn the auto-fill off. Pick the one that matches the IdP version:
- Method 1 - 22.12 Hotfix 5 and later, 22.02 Hotfix 10 and later, 23.07 Hotfix 1 and later, and 24.04 and later include the EnableSAMLLoginReqUsernamePrefill setting.
- Method 2 - 22.12 Hotfix 3 and Hotfix 4 have the auto-fill but not the setting, so strip the username from the URL with an Internet Information Services (IIS) URL Rewrite rule instead.
In this article
- Method 1: Turn Off Auto-Fill With the web.config Setting
- Method 2: Strip the Username With an IIS URL Rewrite Rule
Method 1: Turn Off Auto-Fill With the web.config Setting
Use this method on any version that includes the EnableSAMLLoginReqUsernamePrefill setting. It needs administrator access to every IdP appliance that serves the realm.
- Back up the realm's web.config file, for example D:\SecureAuth\SecureAuth<N>\web.config.
- Open the file in a text editor and find the <appSettings> section.
- Add the following line inside <appSettings>. If the key is already there, change its value to False. When the key is missing, the default is True, which leaves auto-fill on.
<add key="EnableSAMLLoginReqUsernamePrefill" value="False" /> - Save the file. IIS restarts the realm's application automatically.
- Repeat steps 1 to 4 on every IdP node behind the load balancer, so every node behaves the same way.
- Open the realm URL with a test value in the query string, for example https://<idp-hostname>/SecureAuth<N>/?username=testuser, and confirm the Username field is empty.
To turn auto-fill back on, set the value to True or remove the key, then save the file on every node.
Method 2: Strip the Username With an IIS URL Rewrite Rule
Use this method on 22.12 Hotfix 3 and Hotfix 4, which have the auto-fill but not the EnableSAMLLoginReqUsernamePrefill setting. It needs the IIS URL Rewrite module on every IdP node. Upgrading to 22.12 Hotfix 5 or later and using Method 1 is the longer-term fix.
- Open IIS Manager, expand Sites, and select the realm the rule applies to.
- Double-click URL Rewrite, then select Add Rule(s) and choose Blank rule.
- Configure the rule so it matches every URL, redirects to the same path without the username parameter, and only fires when the query string carries one. The finished rule in the realm's web.config looks like this:
<rule name="Remove Username from URL" stopProcessing="true"> <match url="(.*)" /> <action type="Redirect" url="{R:0}?{C:1}{C:3}" appendQueryString="false" logRewrittenUrl="true" redirectType="Temporary" /> <conditions logicalGrouping="MatchAny"> <add input="{QUERY_STRING}" pattern="(.*)(&username=[aA-zZ0-9._%+-]+%40[aA-zZ0-9.-]+\.[aA-zZ]{2,})(.*)" /> </conditions> </rule> - Select Apply, then repeat steps 1 to 3 on every IdP node.
- Sign in through the SP again and confirm the Username field on the IdP login page is empty.
Special Considerations
Saving web.config or applying a URL Rewrite rule restarts the realm's application, so users who are part-way through signing in on that realm may have to start again. Make the change during a quiet period.
The Method 2 rule only matches a username value shaped like an email address. If the SP sends a plain username instead, adjust the pattern before relying on it.
SecureAuth Knowledge Base Articles provide information based on specific use cases and may not apply to all appliances or configurations. Be advised that these instructions could cause harm to the environment if not followed correctly or if they do not apply to the current use case.
Customers are responsible for their own due diligence prior to utilizing this information and agree that SecureAuth is not liable for any issues caused by misconfiguration directly or indirectly related to SecureAuth products.
Comments
0 comments
Please sign in to leave a comment.