Activities of "maliming"

hi

It works with the code below.

@using AbpSolution1.Books
@using AbpSolution1.Permissions
@using Microsoft.AspNetCore.Authorization
@inherits Volo.Abp.AspNetCore.Components.AbpComponentBase
@inject IBooksAppService BooksAppService

@if(IsAuthorized)
{
    if (IsAnyBook)
    {
        <div class="bg-success w-100 d-flex justify-content-center align-items-center h-100">
            <b class="text-dark">
                Books available
            </b>
        </div>
    }
    else
    {
        <div class="bg-warning w-100 d-flex justify-content-center align-items-center h-100">
            <b class="text-dark">
                No Books
            </b>
        </div>
    }
}
else
{
     <div class="bg-danger w-100 d-flex justify-content-center align-items-center h-100">
        <b class="text-dark">
            Not Authorized
        </b>
    </div>
}

@code {

    private bool IsAuthorized { get; set; } = false;

    private bool IsAnyBook { get; set; } = false;

    private async Task LoadBooks()
    {
        try
        {
            GetBooksInput input = new GetBooksInput();
            var books = await BooksAppService.GetListAsync(input);
            IsAnyBook = books.Items.Any();
        }
        catch(Exception ex)
        {
            await HandleErrorAsync(ex);
            Console.WriteLine(ex.Message);
        }
    }

    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();
        var isAutheticated = CurrentUser.IsAuthenticated;
        IsAuthorized = await AuthorizationService.IsGrantedAsync(AbpSolution1Permissions.Books.Default);

        if (isAutheticated && IsAuthorized)
        {
            await LoadBooks();
        }
    }
}



hi

, the problem is a routing issue that the ABP code cannot locate the generated certificate.

What is this mean? do you have any error logs?

Thanks I will check it asap.

hi

Can you share a simple project to reproduce this?

I will download and check it.

liming.ma@volosoft.com

Thanks.

hi

Sorry for your bad experience.

Can you try to test your app without IIS virtual app directory?

can't login. Swagger breaks. images break.

If you can share details, we will fix this problem asap.

hi

I mean, you can remove the <AuthorizeView codes.

@if (IsAnyBook)
{
    <div class="bg-success w-100 d-flex justify-content-center align-items-center h-100">
        <b class="text-dark" style="font-size: 20px;">
            Books available
        </b>
    </div>
}
else
{
    <div class="bg-warning w-100 d-flex justify-content-center align-items-center h-100">
        <b class="text-dark" style="font-size: 20px;">
            No Books
        </b>
    </div>
}

hi

You can add a custom grant type to get a token in the next request.

see https://abp.io/community/articles/how-to-add-a-custom-grant-type-in-openiddict.-6v0df94z

hi

You can try to inject the ICurrentUser to check the CurrentUser.IsAuthenticated

@if (CurrentUser.IsAuthenticated)
{

}

And IAuthorizationService to check the permission.

https://abp.io/docs/latest/framework/ui/blazor/authorization?_redirected=B8ABF606AA1BDF5C629883DF1061649A#iauthorizationservice

hi

https://abp.io/community/articles/implementing-passwordless-authentication-with-asp.net-core-identity-c25l8koj

: )

Showing 441 to 450 of 7734 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 23, 2024, 13:33