ADFS Domain auto completion

When your domain is federated with Office 365, during your authentication session you are redirected to your ADFS servers to authenticate. You must then enter your Active Directory email address and password to access Office 365. If your company domain is long, such as education.fabrikam.com, I suggest you provide your users with auto-completion of your domain name. In order to do this, you need to modify your local ADFS Template.

Script source: https://social.msdn.microsoft.com/Forums/vstudio/en-US/d0b2089f-e4be-494c-b488-21493f62bc58/adfs-2012-r2-forms-authentication-default-login-domain?forum=Geneva

For more information on how to customize your ADFS infrastructure, click on the link below:

1. First, create a new Template, by copying the default one. You will then make your modifications on this one, to avoid modifying the default Template of ADFS.

Script.ps1
PS C:\Users\John> New-AdfsWebTheme -Name Fabrikam -SourceName default

2. Then, export the Template to your location.

Script.ps1
PS C:\Users\John> Export-AdfsWebTheme -Name Fabrikam -DirectoryPath c:\theme

3. Look for the file onload.js in the folder C:\theme\script\ and add the following lines to the end of the document:

Script.ps1
//remove domain name requirement
function runScript(e) {
if (e.keyCode == 13) {
AppendUPN();
return Login.submitLoginRequest();
}
}

var AppendUPN = function () {
var userName = document.getElementById(Login.userNameInput);
var lowerUserName = userName.value.toLowerCase();

//Check to see if they already included the UPN
var li = lowerUserName.lastIndexOf( @education.fabrikam.com’ );
if (li ==-1)
{
userName.value = userName.value + @education.fabrikam.com ;
}

return true;
}

document.getElementById(‘submitButton’).onclick = new Function(‘AppendUPN();return Login.submitLoginRequest();’);
document.getElementById(‘passwordInput’).onkeypress = runScript;

4. To replace the file we just modified in our custom theme, using Power Shell, run the command below:

Script.ps1
PS C:\Users\John> Set-AdfsWebTheme -TargetName Fabrikam -AdditionalFileResource @{Uri=’ /adfs/portal/script/onload.js’;path=”C:\Temp\script/onload.js”}

5. Finally, to activate your new theme :

Script.ps1
PS C:\Users\John> Set-AdfsWebConfig -ActiveThemeName Fabrikam

Want to migrate or connect your phone system to Teams?

Write to me and let's keep in touch!

small_c_popup.png

Formulaire de contact

Discutons ensemble de vos projets

small_c_popup.png

Contact form

Let's discuss your projects together