Customizing Active Directory Federation Services Login Pages
I haven’t created a written post in quite a while, but as I was looking for resources on this topic, I realized there could be more out there.
This post is about customizing the login pages for Active Directory Federation Services or ADFS. We recently moved to Office 365 and instead of requiring our users to remember multiple passwords (one for their computer login and one for our Office 365 services) we set up ADFS. Some people would argue that we were too small of a company to really benefit from utilizing ADFS (we are about 35 people) but I disagree and so as a part of our Office 365 deployment, I also implemented ADFS and ADFS Proxy servers to handle authentication.
When editing the theme of the login pages as we are going to be doing, we will be doing it on our ADFS Proxy servers, not on our ADFS servers.
As anyone who’s dealt with ADFS knows, the login pages are very bland, similar to the one pictured below.
Now this is a very bland page, and (especially with the pretty 2013 Office 365 upgrade we just received) our users, including myself, were looking for something a little more flashy. Now, I only have very limited web development experience and none whatsoever with ASP, so I was digging around for some help and found very little, but I did find one page that helped me out quite a bit (link below). He has shown some more images of which pieces edit what.
http://cloudidentityblog.com/2012/09/18/custom-homerealmdiscovery-page-with-ad-fs-2-0/
If you’re looking to customize this page, all of the items that you will need to customize exist in the below listed files found in C:\intetpub\adfs\ls
web.config
logo.png
MasterPages\Masterpage.master
MasterPages\Stylesheet.css
App_GlobalResources\CommonResources.resx
App_GlobalResources\CommonResources.en.resx
If you’re familiar with Stylesheets at all, editing Stylesheet.css to adjust the colors should be a piece of cake for you. Otherwise, the CommonResources files have all of the text sections for all of the pages in them, so if you’d like to adjust any of the wording on the page, that would be done there. The Masterpage.master file is the page template for all of the pages, and adjusting it will adjust all of the pages associated with ADFS.
web.config
Changing this section of code:
<!-- <add key="logo" value="logo.png" /> -->
To this:
<add key="logo" value="logo.png" />
Along with adding an image file of your logo with the name “logo.png” will add a logo to your page.
MasterPage.master
Changing these sections of code:
<div class="specificsection"></div>
To a specific name of your choice:
<div class="specifichiddensection"></div>
As well as adding this to the Stylesheet.css file:
.specifichiddensection { }
Will allow you to make edits that specifically adjust only the section that you want to edit. One that I made use of in a few places was the code:
visibility:hidden;
To hide sections that I no longer wanted to show up.One other thing that I did in Stylesheet.css was adjusting this:
.MainActionContainer { padding: 5px 20px 5px 20px; border: solid 1px #cccccc; min-height: 150px; }
To this:
.MainActionContainer { padding: 0px 0px 0px 0px; border: solid 0px #cccccc; min-height: 150px; }
In order to hide the box border that they had assigned and push the text out to the edges.
I also edited CommonResources.en.resx to change this code:
<data> Example: domain\username </data>
To this code:
<data> Example: username@example.com </data>
So that my users would stop getting confused about the format that they were supposed to enter their username in.
All in all I think it turned out very well (assuming the logo is not scribbled out) and did not take a whole lot of my time.
That’s one impressive scribble job on the logo there.
Good article. What services did you have to stop to get modify access to the adfs web files?
Hey Adam,
I didn’t have to stop any services to be able to edit these files. I think I might know what you’re running into though, when I started editing these, I was editing the wrong files and I couldn’t figure out which services to stop as well. I was editing the files in the following location:
C:\Program Files\Active Directory Federation Services 2.0\WSFederationPassive.Web
Which is not the right location, and actually won’t work for you. You should be editing the files in this location:
C:\inetpub\adfs\ls
If you edit them in that location, you shouldn’t run into any access issues. You may have to restart the IIS services to get your changes to take effect though (depending on what you’re editing).
Hope this helps, if you’re still running into issues let me know.
Very good one. But I am facing the issue like, once i modified the style sheet it is not reflecting.Given iisrest also. Let me know the reason for that
Hi Jeswin,
This is something that I ran into as well, please verify that you are editing the style sheet in the correct place. The following location is NOT the correct location to edit the style sheet in.
C:\Program Files\Active Directory Federation Services 2.0\WSFederationPassive.Web
You SHOULD edit your style sheet in the following location.
C:\inetpub\adfs\ls
If you are editing it in the correct location and it’s still not working for you, please leave another comment and we can dig into it a little deeper.
Hi,
I am using office 365. I modified the Sign in page of ADFS 2.0. But it is not reflecting in the external (Out side the domain). It is working in the systems which are in that intranet.
Please guide me on that.
regards
Jeswin
Hi again Jeswin,
How are you publishing the site to the external of your environment? If you are using a NAT to directly map the outside IP address to the exact same internal address that your users connect to, the page that is displayed should be the exact same page that you are seeing internally and if it’s not, you may have to clear your browser cache to get it to display correctly. If you have an external IP address that is actually directly configured on your Federation Services server and when you browse to the site internally you are hitting an internal address and when you browse to it externally you are hitting the external address, you will have to re-check your IIS configuration to find out why two different pages are being published. If they are two IP addresses on the same website within IIS, you may have to check your Mappings within the site, if you have two different websites in IIS, one with an internal address and the other with an external address, you will have to verify that you have the exact same location as your base directory for the site.