Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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