Base solution for your next web application

Activities of "bbakermmc"

I see this is now part of the Paid version, will this be release to the free version anytime soon?

I see this is now in the Paid version, will this be released to the Free version any time soon?

Im trying to use the Federation Authentication and its working when the user logins in using /Account/Login. But if the user isnt logged in and hits a [AbpMvcAuthorize] tag the site doesnt redirect to /Account/Login like I would expect it to. Instead it actually takes them to the Federation Auth server, and then the user gets stuck in a ADFS redirection loop.

What am I missing?

var cookieOptions = new CookieAuthenticationOptions
            {
                //AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login/"),
                CookieManager = new SystemWebCookieManager()
            };
            app.UseAbp();

            app.UseKentorOwinCookieSaver();
            app.UseCookieAuthentication(cookieOptions);
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

if (IsTrue("ExternalAuth.WsFederation.IsEnabled"))
            {
                app.UseWsFederationAuthentication(CreateWsFederationAuthOptions());
            }


private static WsFederationAuthenticationOptions CreateWsFederationAuthOptions()
        {
            var options = new WsFederationAuthenticationOptions
            {
                MetadataAddress = "https://fs/FederationMetadata/2007-06/FederationMetadata.xml",
                AuthenticationType = "Windows",
                Caption = "Domain",
                //localhost
                Wreply = "https://prodapp2/Account/Login/",
                Wtrealm = "https://prodapp2/Account/Login/"
            };

            return options;
        }

Are you able to provide a full solution based off the free aspnetboilerplate template? Ive tried using what you proposed and it doesnt work. When you hit the base url of the site in the "Home" controller it goes in to a ADFS redirection loop instead of redirecting me to login page. If I got to the /Account/Login, I see the "ADFS" button, but when I click it, it just redirects me back to login page. The loginInfo in "ExternalLoginCallback" is null.

Do I need to set some IIS setting like FormsAuth? Disable anonymous or something?

Update: If I set IIS to allow FormsAuth using "/Account/Login" then when I hit the authorize link in the home controller, I get redirected to the login page.

If I Have windows auth enabled. When I hit the home controller I get a ADFS redirection loop instead of being redirected to the login page, however, if I goto the login page directly I am able to use the button properly and it logs in just fine as long as my username matches my windows name (Ill have to modify the registration page to pass these fields in and make them read only, so thats minor).

I was finally able to get it to work, there is something wonky if you put the federation config last. I had to move the external loing and federation configs to be before the cookie auth, then everything works fine.

app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

            app.UseWsFederationAuthentication(CreateWsFederationAuthOptions());

            app.UseOAuthBearerAuthentication(AccountController.OAuthBearerOptions);
            
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login")
            });

Is there an example that shows the nav menu using roles instead of permissions or where I would start to extend it so it can use roles instead of permissions.

I created some new permissions in my AuthorizationProvider and assigned them to some navigation nodes. But when I add them to the table in the DB it doesnt take affect until I restart the app pool? This doesnt seem normal, am I missing something someplace?

Once i restart the app pool/VS the nodes appear just fine. Do I need to call a method just for testing until I build out the role/permissions screens?

Can you point me in the direction of what cache/method I need to call so I dont need to keep resting my app and can just create a simple end point for now :)

Im having the same issue. When I have custom errors "On" I still doent get the friendly exception, I get a 500 error. Im doing this on my machine in VS 2013, so could be be an issue there?

My test case is just using an invalid username/password on the login page (Stock code).

Installed ELMAH to get the errors for you:

This looks like where the error is coming from:

System.InvalidOperationException: The model item passed into the dictionary is of type 'System.Web.Mvc.HandleErrorInfo', but this dictionary requires a model item of type 'Abp.Web.Mvc.Models.ErrorViewModel'.
   at System.Web.Mvc.ViewDataDictionary`1.SetModel(Object value)
   at System.Web.Mvc.ViewDataDictionary.set_Model(Object value)
   at System.Web.Mvc.ViewDataDictionary..ctor(ViewDataDictionary dictionary)
   at System.Web.Mvc.ViewDataDictionary`1..ctor(ViewDataDictionary viewDataDictionary)
   at System.Web.Mvc.WebViewPage`1.SetViewData(ViewDataDictionary viewData)
   at System.Web.Mvc.WebViewPage.set_ViewData(ViewDataDictionary value)
   at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
   at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
   at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
   at Castle.Proxies.AccountControllerProxy.EndExecuteCore_callback(IAsyncResult asyncResult)
   at Castle.Proxies.Invocations.Controller_EndExecuteCore.InvokeMethodOnTarget()
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\Github\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 29
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Castle.Proxies.AccountControllerProxy.EndExecuteCore(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
   at Castle.Proxies.AccountControllerProxy.EndExecute_callback(IAsyncResult asyncResult)
   at Castle.Proxies.Invocations.Controller_EndExecute.InvokeMethodOnTarget()
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\Github\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 29
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Castle.Proxies.AccountControllerProxy.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
   at System.Web.HttpApplication.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar)

This looks normal to me:

Abp.UI.UserFriendlyException: Login failed!
   at Platform.Web.Controllers.AccountController.<GetLoginResultAsync>d__7.MoveNext() in c:\GIT Repos\Platform\Platform.Web\Controllers\AccountController.cs:line 116
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Platform.Web.Controllers.AccountController.<Login>d__2.MoveNext() in c:\GIT Repos\Platform\Platform.Web\Controllers\AccountController.cs:line 86
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at System.Threading.Tasks.TaskHelpersExtensions.ThrowIfFaulted(Task task)
   at System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)
Showing 1 to 10 of 164 entries