Skip to content

Instantly share code, notes, and snippets.

@eerrecart
Last active August 10, 2016 13:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eerrecart/4760b245ac78d5915b55ac311de39065 to your computer and use it in GitHub Desktop.
Save eerrecart/4760b245ac78d5915b55ac311de39065 to your computer and use it in GitHub Desktop.
adfs integration for umbraco
[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