Advertise with Googlier.com
Steve Spencer's Blog - ADFS
Blogging on Azure Stuff
http://blogs.recneps.net/
http://www.rssboard.org/rss-specification
BlogEngine.NET 2.9.1.0
en-US
http://blogs.recneps.net/opml.axd
http://www.dotnetblogengine.net/syndication.axd
Steve Spencer
Steve Spencer's Blog
0.000000
0.000000
-
Adding Multi-Factor Authentication to ADFS
<p>I’ve been investigating how to wire up AD to ADFS and thanks to my friend James he pointed me in the direction of multifactor authentication. The post <a href="http://blogs.technet.com/b/cloudpfe/archive/2014/02/01/how-to-create-a-custom-authentication-provider-for-active-directory-federation-services-3-0-part-2.aspx">here</a> explains how to add in multi-factor authentication (MFA) to ADFS. There were however a couple of areas that were not clear that needed additional research. </p> <ol> <li>How to get a config file into the MFA provider <li>How to send additional claims from the MFA provider <li>How to customise the ADFS MFA portal pages</li></ol> <p>Adding configuration into the MFA is handled in the OnAuthenticationPipelineLoad method in the AuthenticationAdapter class. The configData parameter contains a Data property which is a file stream that allows you access to the config file. The config file can be anything you want but you need to add it when you register your plugin with ADFS. Plugin registration is doen in Powershell and you need to add the configuration as follows:</p> <p>Register-AdfsAuthenticationProvider -TypeName $typeName -Name "MFA_MyProvider" -Verbose -ConfigurationFilePath c:\mfa\config.xml see <a href="https://technet.microsoft.com/en-us/library/dn479353(v=wps.630).aspx">here</a> <p>In your OnAuthenticationPipelineLoad method you need to process the config file</p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><font face="Consolas"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#0000ff"><font style="font-size: 9.5pt">public</font></font></span><font style="font-size: 9.5pt"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#000000"> </font></span><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#0000ff">void</font></span></font><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font style="font-size: 9.5pt" color="#000000"> OnAuthenticationPipelineLoad(IAuthenticationMethodConfigData configData)</font></span></font></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font face="Consolas"><font style="font-size: 9.5pt" color="#000000">{</font></font></span></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><font face="Consolas"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><span style="mso-spacerun: yes"><font color="#000000"><font style="font-size: 9.5pt"> </font></font></span></span><font style="font-size: 9.5pt"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#0000ff">if</font></span><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#000000"> (configData != </font></span><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#0000ff">null</font></span></font><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font style="font-size: 9.5pt" color="#000000">)</font></span></font></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font face="Consolas"><font color="#000000"><span style="mso-spacerun: yes"><font style="font-size: 9.5pt"> </font></span><font style="font-size: 9.5pt">{</font></font></font></span></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><font face="Consolas"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><span style="mso-spacerun: yes"><font color="#000000"><font style="font-size: 9.5pt"> </font></font></span></span><font style="font-size: 9.5pt"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#0000ff">if</font></span><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#000000"> (configData.Data != </font></span><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#0000ff">null</font></span></font><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font style="font-size: 9.5pt" color="#000000">)</font></span></font></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font face="Consolas"><font color="#000000"><span style="mso-spacerun: yes"><font style="font-size: 9.5pt"> </font></span><font style="font-size: 9.5pt">{</font></font></font></span></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><font face="Consolas"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><span style="mso-spacerun: yes"><font color="#000000"><font style="font-size: 9.5pt"> </font></font></span></span><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font style="font-size: 9.5pt" color="#008000">// load the config file</font></span></font><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"></span></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><font face="Consolas"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><span style="mso-spacerun: yes"><font color="#000000"><font style="font-size: 9.5pt"> </font></font></span></span><font style="font-size: 9.5pt"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#0000ff">using</font></span><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#000000"> (</font></span><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#2b91af">StreamReader</font></span><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#000000"> reader = </font></span><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#0000ff">new</font></span><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#000000"> </font></span><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#2b91af">StreamReader</font></span><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#000000">(configData.Data, </font></span><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#2b91af">Encoding</font></span></font><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font style="font-size: 9.5pt" color="#000000">.UTF8))</font></span></font></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font face="Consolas"><font color="#000000"><span style="mso-spacerun: yes"><font style="font-size: 9.5pt"> </font></span><font style="font-size: 9.5pt">{</font></font></font></span></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><font face="Consolas"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><span style="mso-spacerun: yes"><font color="#000000"><font style="font-size: 9.5pt"> </font></font></span></span><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font style="font-size: 9.5pt" color="#0000ff">try</font></span></font><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"></span></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font face="Consolas"><font color="#000000"><span style="mso-spacerun: yes"><font style="font-size: 9.5pt"> </font></span><font style="font-size: 9.5pt">{</font></font></font></span></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><font face="Consolas"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><span style="mso-spacerun: yes"><font color="#000000"><font style="font-size: 9.5pt"> </font></font></span></span><font style="font-size: 9.5pt"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font color="#0000ff">string</font></span></font><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font style="font-size: 9.5pt" color="#000000"> config = reader.ReadToEnd();</font></span></font></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font face="Consolas"><font style="font-size: 9.5pt" color="#000000"> </font></font></span></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><font face="Consolas"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><span style="mso-spacerun: yes"><font color="#000000"><font style="font-size: 9.5pt"> </font></font></span></span><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font style="font-size: 9.5pt" color="#008000">// Read your config here</font></span></font><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"></span></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font face="Consolas"><font color="#000000"><span style="mso-spacerun: yes"><font style="font-size: 9.5pt"> </font></span><font style="font-size: 9.5pt">}</font></font></font></span></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font face="Consolas"><font color="#000000"><span style="mso-spacerun: yes"><font style="font-size: 9.5pt"> </font></span><font style="font-size: 9.5pt">}</font></font></font></span></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font face="Consolas"><font color="#000000"><span style="mso-spacerun: yes"><font style="font-size: 9.5pt"> </font></span><font style="font-size: 9.5pt">}</font></font></font></span></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font face="Consolas"><font color="#000000"><span style="mso-spacerun: yes"><font style="font-size: 9.5pt"> </font></span><font style="font-size: 9.5pt">}</font></font></font></span></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 0pt; line-height: normal; text-autospace: ; mso-layout-grid-align: none"><span style="font-family: ; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; color: ; mso-highlight: white"><font face="Consolas"><font style="font-size: 9.5pt" color="#000000">}</font></font></span></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 8pt; line-height: 12pt"><font face="Calibri"><font style="font-size: 11pt" color="#000000"> </font></font></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 8pt; line-height: 12pt"><font color="#000000" face="Calibri">Sending additional claims is achieved in the TryEndAuthentication method of the AuthenticationAdapter class. It should already be returning and authentication method as an array of claims. You can add additional claims to this array and return them through the claims out parameter. You will need to add rules in ADFS to pass through these claims to the application if they are required.</font></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 8pt; line-height: 12pt"><font color="#000000" face="Calibri">Customising the MFA portal is done through PowerShell details are found here:</font></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 8pt; line-height: 12pt"><a title="http://thinketg.com/adfs-3-0-logon-page-customization/" href="http://thinketg.com/adfs-3-0-logon-page-customization/">http://thinketg.com/adfs-3-0-logon-page-customization/</a> & <a title="https://technet.microsoft.com/en-us/library/dn280950.aspx" href="https://technet.microsoft.com/en-us/library/dn280950.aspx">https://technet.microsoft.com/en-us/library/dn280950.aspx</a></p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 8pt; line-height: 12pt"> </p> <p class="MsoNormal" style="cursor: auto; margin: 0cm 0cm 8pt; line-height: 12pt"><font color="#000000" face="Calibri"></font></p>
http://blogs.recneps.net/post/Adding-Multi-Factor-Authentication-to-ADFS
http://blogs.recneps.net/post/Adding-Multi-Factor-Authentication-to-ADFS#comment
http://blogs.recneps.net/post.aspx?id=48f5e5bf-d2af-4274-adeb-28cd24cd9bc1
Fri, 11 Sep 2015 18:33:15 +0000
ADFS
steve
http://blogs.recneps.net/pingback.axd
http://blogs.recneps.net/post.aspx?id=48f5e5bf-d2af-4274-adeb-28cd24cd9bc1
294
http://blogs.recneps.net/trackback.axd?id=48f5e5bf-d2af-4274-adeb-28cd24cd9bc1
http://blogs.recneps.net/post/Adding-Multi-Factor-Authentication-to-ADFS#comment
http://blogs.recneps.net/syndication.axd?post=48f5e5bf-d2af-4274-adeb-28cd24cd9bc1