Update:
More comprehensive write-up here.
Apologies for the title but there doesn't seem to be a standard for what the R2 version of ADFS is called so I included them all to ease the Google / Bing / Duck Duck Go search
If there's one question that has become flavour of the month lately this is it. There are many questions around customising the logon / login / sign on pages.
Some of them refer to customising the pages for Multi-Factor Authentication (MFA). Just remember that you can now do this with a Microsoft solution. Refer: Azure Multi-Factor Authentication. Note that this doesn't have to be cloud based. There is an on-premise variation.
In ADFS 2.0, the functionality was implemented as a web site running on IIS so you could customise to your heart's content changing the .aspx and the .cs pages.
My guess is that some people who didn't really understand the implications of what they were doing customised the pages in sub-standard ways and things went wrong and Microsoft copped the blame for pushing a crap product.
Remember - security in a web application is hard - writing a security application is even harder,
So in ADFS 3.0 this was all locked down. The biggest change was that it no longer uses IIS.
Refer: First Impressions – AD FS and Windows Server 2012 R2 – Part I
There are some PowerShell commands you can use to customise the screens
Refer: Customizing the AD FS Sign-in Pages
and Advanced Customization of AD FS Sign-in Pages.
There are some good suggestions here:
adfs 2012 R2 forms authentication default login domain
Beware: one of the suggestions here is to modify the .dll. I would strongly suggest that you don't go down this particular rabbit hole!
And a good write up here:
Handling Expired Passwords in AD FS 2012 R2
Enjoy!
Ideas and thoughts about Microsoft Identity, C# development, cabbages and kings and random flotsam on the incoming tide
Thursday, May 29, 2014
Wednesday, May 28, 2014
Visual Studio : Extending the user profile for organisational accounts in Azure
When you use VS 2013 and choose the web application option and then change the authentication options to use organisational accounts, you get a lot of template code which shows you some of the attributes in the user profile derived from Azure Active Directory (AAD).
You can see this if you click on the name of the logged-in user once the application is running and you have authenticated.
What if you want to extend this?
The first step is to find out what the attribute is called?
The easiest way to do this is to use the Graph Explorer.
Click "Use Demo Company" then "Get" then click on:
"https://graph.windows.net/GraphDir1.OnMicrosoft.com/users".
You'll get a list of the AAD schema attributes e.g if you want the user department, you'll see the name is "department".
In the VS project under "Models / HomeViewModels.cs" add another line e.g.
Under "Views / Home / UserProfile.cshtml" add another line e.g.
The key to this is under "Controllers / HomeController.cs" where:
Job done.
Enjoy!
You can see this if you click on the name of the logged-in user once the application is running and you have authenticated.
What if you want to extend this?
The first step is to find out what the attribute is called?
The easiest way to do this is to use the Graph Explorer.
Click "Use Demo Company" then "Get" then click on:
"https://graph.windows.net/GraphDir1.OnMicrosoft.com/users".
You'll get a list of the AAD schema attributes e.g if you want the user department, you'll see the name is "department".
In the VS project under "Models / HomeViewModels.cs" add another line e.g.
public string Department { get; set; }
Under "Views / Home / UserProfile.cshtml" add another line e.g.
This uses Razor syntax - you may have something different but you get the general idea.<td>Department</td> <td>@Model.department</td>
The key to this is under "Controllers / HomeController.cs" where:
UserProfile profile = JsonConvert.DeserializeObjectleverages the power of the JSON library to serialize the attributes you have defined.(responseString);
Job done.
Enjoy!
Friday, May 23, 2014
Security : Secret Q & A
Came across an interesting idea for the answers to those ubiquitous secret Q & A they use for authentication.
If you see someone lives in NZ and the question is:
Where where you born?
a hacker could answer "Auckland" / Wellington" / "Christchurch" / "Dunedin" and that would cover about 80% of the possibilities since e.g. over 25% of the people in NZ live in Auckland.
So the suggestion is to use a random phrase to answer everything.
e.g.
"Where were you born"? = Puddleduck
"Mother's maiden name"? = Puddleduck
and so on.
Enjoy!
If you see someone lives in NZ and the question is:
Where where you born?
a hacker could answer "Auckland" / Wellington" / "Christchurch" / "Dunedin" and that would cover about 80% of the possibilities since e.g. over 25% of the people in NZ live in Auckland.
So the suggestion is to use a random phrase to answer everything.
e.g.
"Where were you born"? = Puddleduck
"Mother's maiden name"? = Puddleduck
and so on.
Enjoy!
Tuesday, May 06, 2014
Azure : Deploying a Java web site to Azure
Well, who would ever think that the words "Azure" and "Java" would be used in the same sentence?
I'm not talking about the Azure VM here; rather the Azure web site option.
As Mrs. Beaton would say "First catch your rabbit". For Java, this becomes "First catch your .war file".
You can create a simple Java web site in either Eclipse or NetBeans - whatever floats your boat.
Work through the following documentation:
Get started with Azure web sites and Java
Adding an application to your Java web site on Azure
I used the "Create a Java web site using the Azure configuration UI" option.
OK, but when you display the web site URL, you get the "This Java based application has been successfully created". So where's my index.jsp?
From the dashboard of the Azure web site, you'll see the FTP address. I use FileZilla.
Before you can use this, you have to set the credentials. There's a link under "Quick Glance" called "Reset your deployment credentials". So set them.
Assume your web site is called MyJavaWebSite.
So to get FileZilla to work, you use the FTP URL from the dashboard page, your user name is:
and the password is whatever you chose.
On the LHS menu, navigate to your war file. On the RHS, navigate to:
Copy the war file over.
Now navigate to the actual Azure web site URL. Still shows the canned screen.
So append /MyJavaWebSite/index.jsp to the URL.
Bingo.
Enjoy!
I'm not talking about the Azure VM here; rather the Azure web site option.
As Mrs. Beaton would say "First catch your rabbit". For Java, this becomes "First catch your .war file".
You can create a simple Java web site in either Eclipse or NetBeans - whatever floats your boat.
Work through the following documentation:
Get started with Azure web sites and Java
Adding an application to your Java web site on Azure
I used the "Create a Java web site using the Azure configuration UI" option.
OK, but when you display the web site URL, you get the "This Java based application has been successfully created". So where's my index.jsp?
From the dashboard of the Azure web site, you'll see the FTP address. I use FileZilla.
Before you can use this, you have to set the credentials. There's a link under "Quick Glance" called "Reset your deployment credentials". So set them.
Assume your web site is called MyJavaWebSite.
So to get FileZilla to work, you use the FTP URL from the dashboard page, your user name is:
MyJavaWebSite\username
and the password is whatever you chose.
On the LHS menu, navigate to your war file. On the RHS, navigate to:
/site/wwwroot/webapps
Copy the war file over.
Now navigate to the actual Azure web site URL. Still shows the canned screen.
So append /MyJavaWebSite/index.jsp to the URL.
Bingo.
Enjoy!
Wednesday, April 30, 2014
Azure : Web site FTP credentials
In an Azure web site, in the portal under the dashboard on the RHS, you'll see a whole link of links e.g. the link to the site, ftp links, log links etc.
To access these, you need credentials which you can set further up that page on the RHS i.e. "Reset your deployment credentials".
So you pick a name like "myftpusername" and a password.
Then you use something like FileZilla to FTP to the site using the FTP link, you type in the credentials and get "Access Denied"! WTF?
The reason is that you have to add the actual site to the user name. So if the site name is "AnAzureWebSite", then the user name needs to be:
AnAzureWebSite\myftpusername
Enjoy!
To access these, you need credentials which you can set further up that page on the RHS i.e. "Reset your deployment credentials".
So you pick a name like "myftpusername" and a password.
Then you use something like FileZilla to FTP to the site using the FTP link, you type in the credentials and get "Access Denied"! WTF?
The reason is that you have to add the actual site to the user name. So if the site name is "AnAzureWebSite", then the user name needs to be:
AnAzureWebSite\myftpusername
Enjoy!
Wednesday, April 16, 2014
Misc : Zooming the ZoomIt window
ZoomIt is a fantastic tool for presentations. You'll find it at:
ZoomIt
But I've always battled to get it to display exactly where I want and tracking around the zoomed screen is a nightmare.
Then I figured out that before you hit "Ctrl / 1" to zoom, put the cursor at the middle of the section you want to zoom.
Then zoom.
You can make minor adjustments by moving the mouse, use the trackwheel to zoom in / out, click the left mouse button to "stabilise" and then you are in the "Ctrl / 2" window by default so "Ctrl / Shift" will draw an arrow etc.
And it would be remiss of me not to point out that you can do this in Windows via the built-in commands. In a browser, type "Windows key" and then "+" to zoom out and then "Windows key" and then "-" to zoom back in. This is in fact the Magnifier tool.
Enjoy!
ZoomIt
But I've always battled to get it to display exactly where I want and tracking around the zoomed screen is a nightmare.
Then I figured out that before you hit "Ctrl / 1" to zoom, put the cursor at the middle of the section you want to zoom.
Then zoom.
You can make minor adjustments by moving the mouse, use the trackwheel to zoom in / out, click the left mouse button to "stabilise" and then you are in the "Ctrl / 2" window by default so "Ctrl / Shift" will draw an arrow etc.
And it would be remiss of me not to point out that you can do this in Windows via the built-in commands. In a browser, type "Windows key" and then "+" to zoom out and then "Windows key" and then "-" to zoom back in. This is in fact the Magnifier tool.
Enjoy!
ADFS : Getting certificate data from metadata
A number of times I've needed to get information about the certificate e.g. to update the WIF thumbprint in the web.config and I've battled to extract this out of the metadata.
For ADFS, you'll find it at:
https://someserver/FederationMetadata/2007-06/FederationMetadata.xml
For Azure Active Directory, you'll find it at:
Then I found an easy way to do this based on a post I read.
Open the metadata file in Notepad++ or whatever your particular flavour is and then search for the "X509Certificate" tag.
Copy all the information between that and the closing tag. It's base64 encoded so it will normally end with an "=" sign.
Copy / paste this into a new Notepad++ window. Remove all trailing spaces.
Save the file somewhere with a ".cer" suffix.
Then double-click on the file.
Viola - it opens up the certificate window and you can grab whatever you want.
The thumbprint is found under the "Details" tab - scroll down to the bottom.
Enjoy!
For ADFS, you'll find it at:
https://someserver/FederationMetadata/2007-06/FederationMetadata.xml
For Azure Active Directory, you'll find it at:
- Click on "Active Directory" in the menu on the LHS of the Azure Portal.
- Click on your tenant name.
- Click on the "Applications" tab at the top.
- Click on "View Endpoints" at the bottom.
- Then navigate to the "Federation Metadata Document" link.
Then I found an easy way to do this based on a post I read.
Open the metadata file in Notepad++ or whatever your particular flavour is and then search for the "X509Certificate" tag.
Copy all the information between that and the closing tag. It's base64 encoded so it will normally end with an "=" sign.
Copy / paste this into a new Notepad++ window. Remove all trailing spaces.
Save the file somewhere with a ".cer" suffix.
Then double-click on the file.
Viola - it opens up the certificate window and you can grab whatever you want.
The thumbprint is found under the "Details" tab - scroll down to the bottom.
Enjoy!
Tuesday, April 01, 2014
Visual Studio : Unable to locate NuGet.exe
Actual message is:
Error - Unable to locate 'C:\.....\.nuget\NuGet.exe'
You sometimes get this when building a project that you cloned from GitHub.
Under .nuget/nuget.Targets in your project, change:
Enjoy!
Error - Unable to locate 'C:\.....\.nuget\NuGet.exe'
You sometimes get this when building a project that you cloned from GitHub.
Under .nuget/nuget.Targets in your project, change:
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false ...
to
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">true ...
Enjoy!
Monday, March 24, 2014
Windows : Ctrl - Alt - Del on a VM
If you use Remote Desktop a lot and you get a message about your password needing to change, you can't use:
Ctrl - Alt - Del
because that will change the password on your actual PC - not the box you are RDC'ing to.
All the documentation states:
Ctrl - Alt - End
but sometimes that simply doesn't work.
In such cases, in the RDC window, try Start - Run - OSK.
This pops up the On Screen Keyboard.
Than hold down Ctrl and Alt on your actual keyboard and then click Delete on the OSK.
Job done!
Enjoy!
Ctrl - Alt - Del
because that will change the password on your actual PC - not the box you are RDC'ing to.
All the documentation states:
Ctrl - Alt - End
but sometimes that simply doesn't work.
In such cases, in the RDC window, try Start - Run - OSK.
This pops up the On Screen Keyboard.
Than hold down Ctrl and Alt on your actual keyboard and then click Delete on the OSK.
Job done!
Enjoy!
Friday, March 07, 2014
ADFS : Non domain-joined proxy
All our proxies are domain-joined albeit in a different zone.
Recently, I was involved with a client whose proxy was non-domain joined i.e. a workgroup.
When installing the proxy, you need to enter the credentials of the ADFS service account.
Battled to get this to work and then I remembered that this was not domain-joined and consequently, you needed to enter the sAMAccountName in the form:
That did the trick.
Enjoy!
Recently, I was involved with a client whose proxy was non-domain joined i.e. a workgroup.
When installing the proxy, you need to enter the credentials of the ADFS service account.
Battled to get this to work and then I remembered that this was not domain-joined and consequently, you needed to enter the sAMAccountName in the form:
domain\userwhere the domain is the one that ADFS is installed in.
That did the trick.
Enjoy!
Monday, March 03, 2014
OWIN : WS Federation support
Vittorio blogged on this:
Using Claims in your Web App is Easier with the new OWIN Security Components
There's a good reference to OWIN in the above.
WS-Federation in Microsoft OWIN Components–a quick start
But what the article doesn't show is how to display the claims.
Dominick blogged on this:
Test driving the WS-Federation Authentication Middleware for Katana
Horrible hack below - yeah I know! - I put it in the About page in the HomeController ...
Enjoy!
Using Claims in your Web App is Easier with the new OWIN Security Components
There's a good reference to OWIN in the above.
WS-Federation in Microsoft OWIN Components–a quick start
But what the article doesn't show is how to display the claims.
Dominick blogged on this:
Test driving the WS-Federation Authentication Middleware for Katana
Horrible hack below - yeah I know! - I put it in the About page in the HomeController ...
public ActionResult About()
{
ViewBag.Message = "Your application description page.";
var ctx = Request.GetOwinContext();
var user = ctx.Authentication.User;
var response = ctx.Response;
response.ContentType = "text/html";
if (user.Identity.IsAuthenticated)
{
... code as above
}
Enjoy!
Subscribe to:
Posts (Atom)
