Base solution for your next web application
Open Closed

User UnAuthorized [AbpAuthorize] #5004


User avatar
0
sago created

After successful Login to the Application the AbpAuthorize is still not authorize to the logged in User restricting access to assigned services also the AbpSession.UserId is Null after navigation.


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @sago,

    Can you share your related code ?

  • User Avatar
    0
    sago created

    <cite>ismcagdas: </cite> Hi @sago,

    Can you share your related code ?

    This is where the user is Authorized and gets all service list from database..

    [AbpAuthorize()] public async Task<List<UserNavigationHierarchyDto>> GetUserNavigationHierarchy(long UserId) { var vmUserNavigationHierarchy = await _sysobjectCustomRepo.GetUserNavigationHierarchy(UserId);

            List&lt;UserNavigationHierarchyDto&gt; results = new List&lt;UserNavigationHierarchyDto&gt;();
            foreach (var vm in vmUserNavigationHierarchy)
            {
                results.Add(new UserNavigationHierarchyDto
                {
                    Id = vm.Id,
                    Name = vm.JsonName,
                    ParentId = vm.ParentId,
                    Code = vm.Code,
                    SystemObjectTypeId = vm.SystemObjectTypeId,
                    TenantId = vm.TenantId
                });
            }
            return results;
        }
    

    After Navigating to a specific service, inside the class inherited from ApplicationService the same [AbpAuthorize()] is Invalid as it cannot enter the class or method requested! I am using ASPNET Core and ANGULAR 5. Node Modules abp-ng2-module v 2.1.0 OS-Win 10

  • User Avatar
    0
    aaron created
    Support Team

    Show error in Logs.txt.

  • User Avatar
    0
    sago created

    <cite>aaron: </cite> Show error in Logs.txt.

    The Issue was not related to the Attribute AbpAuthorize, the issue we had is now resolved.

    Thanks for you support !

  • User Avatar
    0
    alper created
    Support Team

    Ok. Thanks for your feedback!