Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

How to disable authorization for aspnetboilerplate #1200


User avatar
0
amrsaafan created

Hello,

How can I disable logins & authorization for aspnetboilerplate and allow anonymous users to my view? I am using version 9.1.1 up to date. I removed [AbpMVcAuthorize] but it is throwing an error : User did not login

Also I've a weired issue, when calling webApi proxy of application service "getDetails", it is executing in first time but when I execute $state.go('') to make a back button then I click again on details : Ajax call request failed, I have traced the issue and I got nothing

I have considered the EventCloud Source as a reference but same structure.

Please Advise.


2 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Removing AbpMvcAuthorize from controllers should disable authorization, since authorization is only done when these attributes does exists. If you are calling app service from controller, maybe it has [AbpAuthorize] attribute?

    AJAX problem maybe related to your Angular code. Probably somehow it can not make the AJAX request. Can you check it in newtork comm tab of dev tools?

  • User Avatar
    0
    tarekdev created

    in case of AngularJS navigate to \App\Main\services\appSession.js comment the below lines //abp.services.app.session.getCurrentLoginInformations({ async: false }).done(function (result) { // _session.user = result.user; // _session.tenant = result.tenant; //}); it will suppress the "User did not login Message" also in \App_Start\projectNavigationProvider.cs

    comment //.AddItem( // new MenuItemDefinition( // "Users", // L("Users"), // url: "#users", // icon: "fa fa-users", // requiredPermissionName: PermissionNames.Pages_Users // )) and in \project.Web\Controllers\HomeController.cs comment //[AbpMvcAuthorize]

    and in ApplicationService : make sure ther eis no AbpAuthorize it resolved the issue and no Pain now Enjoy