Last active
August 10, 2016 13:25
-
-
Save eerrecart/4760b245ac78d5915b55ac311de39065 to your computer and use it in GitHub Desktop.
adfs integration for umbraco
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[assembly: OwinStartup("CustomUmbracoDefaultOwinStartup", typeof(CustomUmbracoDefaultOwinStartup))] | |
namespace MockNamespace.Backend | |
{ | |
public class CustomUmbracoDefaultOwinStartup : UmbracoDefaultOwinStartup | |
{ | |
private static string adfsMetadata = "https://sts-adfs-domain/federationmetadata/2007-06/federationmetadata.xml"; | |
private static string realm = "http://umbraco/dev"; | |
public override void Configuration(IAppBuilder app) | |
{ | |
base.Configuration(app); | |
app.SetDefaultSignInAsAuthenticationType(Umbraco.Core.Constants.Security.BackOfficeExternalAuthenticationType); | |
app.UseCookieAuthentication(new CookieAuthenticationOptions() { }); | |
var wsFedOptions = new WsFederationAuthenticationOptions | |
{ | |
Wtrealm = realm, | |
MetadataAddress = adfsMetadata, | |
SignInAsAuthenticationType = Umbraco.Core.Constants.Security.BackOfficeExternalAuthenticationType | |
}; | |
wsFedOptions.ForUmbracoBackOffice("btn-microsoft", "fa-windows"); | |
//important, do this after calling "wsFedOptions.ForUmbracoBackOffice()" since this method | |
// overrides the AuthenticationType property | |
wsFedOptions.AuthenticationType = "https://sts-adfs-domain/adfs/services/trust"; | |
wsFedOptions.SetExternalSignInAutoLinkOptions(new ExternalSignInAutoLinkOptions()); | |
wsFedOptions.Caption = "Enterprise account."; | |
app.UseWsFederationAuthentication(wsFedOptions); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment