Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (47 sloc) 2.21 KB
using System;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Microsoft.Owin.Security.WsFederation;
using Microsoft.Owin.Security;
using Owin;
using System.Threading.Tasks;
using WebAppAzureADSingleKatanaGoAzure.Models;
namespace WebAppAzureADSingleKatanaGoAzure
{
public partial class Startup
{
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(WsFederationAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(
new CookieAuthenticationOptions
{
AuthenticationType =
WsFederationAuthenticationDefaults.AuthenticationType
});
app.UseWsFederationAuthentication(
new WsFederationAuthenticationOptions
{
// the URL of Federation Metadata Document of App Endpoints of my Azure AD tenant
// アプリケーションのエンドポイント内、フェデレーションメタデータドキュメントのURLを記入
MetadataAddress = "https://login.windows.net/<Tenant-Id>/federationmetadata/2007-06/federationmetadata.xml",
// the App ID URI of Single Sign-On
// シングルサインオン内のアプリケーションID/URIを記入
Wtrealm = "http://myapps/WebAppAzureADSingleKatanaGoAzure",
// for Skipping the Home Realm Discovery Page in Azure AD
// ホームレルムディスカバリをスキップするためのコード
Notifications = new WsFederationAuthenticationNotifications
{
RedirectToIdentityProvider = (context) =>
{
context.ProtocolMessage.Whr = "myrealm.onmicrosoft.com";
return Task.FromResult(0);
}
}
});
}
}
}