Redirecting to a custom login page using Windows Identity Foundation

I am using Windows Identity Foundation with Azure AppFabric Access Control Service on MVC3 site. I am trying to figure out how to control where the WIF redirects the user if I have an AuthorizeAttribute on the controller or action. (This is my first time working with WIF, and there doesn't seem to be much good information.)

I turned off automatic forwarding because it kept sending me the default ACS authentication page. I want users on my site to use my custom login page, but I cannot figure out what settings I need to tickle in order to do this.

Is there a way, initially with WIF, to tell him to redirect to my login page or will I have to write my own AuthorizeAttribute to do this for me?

Thank!

Edit:

Since there has been some activity in this recently, I thought that I would write some of my conclusions. Unfortunately, I'm not 100% what made everything work correctly (so many moving parts), but I finally got a WIF to redirect to my login page.

I did this without adding code to the program and instead deviated a bit from the examples I found. I found that saving part of forms authentication in web.config allows everyone to work. In my web.config, I have an auth entry with normal forms:

<system.web>
    <httpRuntime requestValidationMode="2.0" />
    <authentication mode="Forms" >
        <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>
    ...
</system.web>

: , WIF - . [] , , .

+3
2

, , .

global.asax RedirectingToIdentityProvider, , whr. ConfigurationCreated:

protected void Application_Start()
{
    AreaRegistration.RegisterAllAreas();

    RegisterRoutes(RouteTable.Routes);

    FederatedAuthentication.ServiceConfigurationCreated += new EventHandler<Microsoft.IdentityModel.Web.Configuration.ServiceConfigurationCreatedEventArgs>(FederatedAuthentication_ServiceConfigurationCreated);   
}

    void FederatedAuthentication_ServiceConfigurationCreated(object sender, Microsoft.IdentityModel.Web.Configuration.ServiceConfigurationCreatedEventArgs e)
    {
        var m = FederatedAuthentication.WSFederationAuthenticationModule;
        m.RedirectingToIdentityProvider += new EventHandler<RedirectingToIdentityProviderEventArgs>(m_RedirectingToIdentityProvider);
    }

    void m_RedirectingToIdentityProvider(object sender, RedirectingToIdentityProviderEventArgs e)
    {
        var sim = e.SignInRequestMessage;
        sim.HomeRealm = "Google";
    }

.

, , .

№ 3 # 7. MVC3, MVC2 , . http://claimsid.codeplex.com

:

http://msdn.microsoft.com/en-us/library/ff966481.aspx#sec14

+3
+1

All Articles