Why am I getting the following error in the browser (Chrome and Safari) when calling my Blazor web app?
[Warning] [blocked] The page at https://staging.mydomain.io/ requested insecure content from http://auth.staging.mydomain.io/connect/authorize?client_id=Blazor&redirect_uri=https%3A%2F%2Fstaging.mydomain.io%2Fauthentication%2Flogin-callback&response_type=code&scope=openid%20profile%20roles%20email%20phone%20AuthServer%20IdentityService%20AdministrationService%20SaasService%20AuditLoggingService%20GdprService%20LanguageService%20ChatService%20CustomerService%20TicketService%20DocumentService%20InvoiceService&state=c81ecdee975347efbec0130e23432ee0&code_challenge=o7sBN0mlemkSHHOvWYE_wZhJ9i9d6RB1vRhsHac39oA&code_challenge_method=S256&prompt=none&response_mode=query. This content was blocked and must be served over HTTPS.
Which variable is responsible for generating http://auth.staging.mydomain.io/connect (i.e., why is it using http:// instead of https://)?
What works: Logging in directly via auth.staging.mydomain.io Using https://gateway-web.staging.mydomain.io and running Swagger against the services' endpoints.
Itβs a microservice solution created with ABP 9.0.4, and only minimal changes have been made to the Helm charts compared to the ABP generator output.
Thanks in advance.
Thanks mailing, that was the problem! You need to copy the contracts into the blazor project.
Thanks AI,
I tried your suggestion but it did not worked, I think that @using Volo.Abp.AspNetCore.Components.Authorization is not valid.
Please let the humans take a look at it :-)
exceptionWe have problem to get https://abp.io/docs/latest/framework/ui/blazor/authorization to work in our Blazor project. This is what we have:
@page "/"
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize("CustomerService.Customers")]
@inherits MyProjectComponentBase
@* https://abp.io/docs/latest/framework/ui/blazor/authorization *@
#AuthorizeView Policy="CustomerService.Customers.Create">
<p>You can only see this if you satisfy the "CustomerService.Customers.Create" policy.</p>
#/AuthorizeView>
The # is instead of < since CB does render it? A bug in the Write component maybe?
This is the MyProject_Administration database, AbpPermissions table:

Thanks, I will take a look :-)
For some reason it seems to only be related to Safari web browser, and not Chrome. Any ideas why?
Thanks
I have deployed my service using the provided Helm charts. But once testing it in Swagger (the authentication seems be ok) I got the following error from server.
[20:24:45 INF] Request starting HTTP/1.1 POST http://myproject-ticket/api/ticket/tickets - application/json 333
[20:24:45 INF] CORS policy execution successful.
[20:24:45 INF] Executing endpoint 'myproject.TicketService.Tickets.TicketsAppService.CreateAsync (myproject.TicketService)'
[20:24:45 INF] Route matched with {action = "Create", controller = "Tickets", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[myproject.TicketService.Tickets.TicketDto] CreateAsync(myproject.TicketService.Tickets.TicketCreateDto) on controller myproject.TicketService.Tickets.TicketsAppService (myproject.TicketService).
[20:24:45 WRN] The required antiforgery cookie ".AspNetCore.Antiforgery.Pqki2eFce9s" is not present.
[20:24:45 INF] Authorization failed for the request at filter 'Volo.Abp.AspNetCore.Mvc.AntiForgery.AbpAutoValidateAntiforgeryTokenAuthorizationFilter'.
[20:24:45 INF] Executing StatusCodeResult, setting HTTP status code 400
[20:24:45 INF] Executed action myproject.TicketService.Tickets.TicketsAppService.CreateAsync (myproject.TicketService) in 1.4636ms
[20:24:45 INF] Executed endpoint 'myproject.TicketService.Tickets.TicketsAppService.CreateAsync (myproject.TicketService)'
[20:24:45 INF] Request finished HTTP/1.1 POST http://myproject-ticket/api/ticket/tickets - 400 0 null 28.3141ms
Do you have any idea what the problem is?
Thanks
Hi :-)
I have tried to follow https://abp.io/docs/latest/framework/infrastructure/event-bus/distributed
The CustomerService shall publish a message over RabbitMQ disitrbuted bus to the InvoiceService when Customer is updated.
The publisher:
public class CustomersAppService : ApplicationService, ICustomersAppService
{
protected IDistributedCache<CustomerDownloadTokenCacheItem, string> _downloadTokenCache;
protected ICustomerRepository _customerRepository;
protected CustomerManager _customerManager;
protected IDistributedEventBus _eventBus;
public CustomersAppService(
ICustomerRepository customerRepository,
CustomerManager customerManager,
IDistributedEventBus eventBus,
IDistributedCache<CustomerDownloadTokenCacheItem, string> downloadTokenCache)
{
_downloadTokenCache = downloadTokenCache;
_customerRepository = customerRepository;
_customerManager = customerManager;
_eventBus = eventBus;
}
public virtual async Task<CustomerDto> UpdateAsync(Guid id, CustomerUpdateDto input)
{
var customer = await _customerManager.UpdateAsync(
id,
input.Name, input.Street, input.ZipCode, input.City, input.PhoneNumber,
input.Email, input.IsCompany, input.IdentificationNumber, input.AttName,
input.ConcurrencyStamp
);
// Send update event
var customerUpdatedEto = ObjectMapper.Map<Customer, CustomerUpdatedEto>(customer);
await _eventBus.PublishAsync(customerUpdatedEto);
// Return object
return ObjectMapper.Map<Customer, CustomerDto>(customer);
}
...
}
The ETO class:
using Volo.Abp.EventBus;
namespace MyProject.CustomerService.Customers;
[EventName("MyProject.CustomerService.Customers.CustomerUpdated")]
public class CustomerUpdatedEto
{
public Guid Id { get; set; }
public string Name { get; set; } = null!;
public string Street { get; set; } = null!;
public string ZipCode { get; set; } = null!;
public string City { get; set; } = null!;
public string PhoneNumber { get; set; } = null!;
public string Email { get; set; }
public bool IsCompany { get; set; }
public string? IdentificationNumber { get; set; }
public string? AttName { get; set; }
}
That's everything I have done in the CustomerService. In the subscriber, InvoiceService is only one added class CustomerServiceEventHandler
using MyProject.CustomerService.Customers;
using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus.Distributed;
namespace MyProject.InvoiceService;
public class CustomerServiceEventHandler : IDistributedEventHandler<CustomerUpdatedEto>, ITransientDependency
{
public async Task HandleEventAsync(CustomerUpdatedEto eventData)
{
var customerId = eventData.Id;
}
}
Now, I have started the both services, CustomerService and the InvoiceService, and the RabbitMQ queues are listed by using the RabbitMQ CLI:
$ docker exec -it rabbitmq rabbitmqctl list_queues
Timeout: 60.0 seconds ...
Listing queues for vhost / ...
name messages
AbpBackgroundJobsDelayed.Volo.Abp.Emailing.BackgroundEmailSendingJobArgs 0
MyProject_AuthServer 0
MyProject_IdentityService 0
MyProject_CustomerService 0
AbpBackgroundJobs.Volo.Abp.Emailing.BackgroundEmailSendingJobArgs 0
MyProject_InvoiceService 0
So the queues seems to be registered. However, I can't see that any message is published, nor received at the subscribe. Notice that the receiver has a binding to the ETO class MyProject.CustomerService.Customers.CustomerUpdated. When using debugger in CustomerService, I can see that there is no exceptions thrown in the await _eventBus.PublishAsync(customerUpdatedEto); line.
$ docker exec -it rabbitmq rabbitmqctl list_bindings | grep MyProject_CustomerService
exchange MyProject_CustomerService queue MyProject_CustomerService []
MyProject exchange MyProject_CustomerService queue Volo.Abp.Localization.LanguageChangedEto []
MyProject exchange MyProject_CustomerService queue Volo.Payment.RecurringPaymentUpdated []
MyProject exchange MyProject_CustomerService queue Volo.Payment.SubscriptionCanceled []
MyProject exchange MyProject_CustomerService queue Volo.Payment.SubscriptionCreated []
MyProject exchange MyProject_CustomerService queue abp.data.apply_database_migrations []
MyProject exchange MyProject_CustomerService queue abp.multi_tenancy.tenant.connection_string.updated []
MyProject exchange MyProject_CustomerService queue abp.multi_tenancy.tenant.created []
$ docker exec -it rabbitmq rabbitmqctl list_bindings | grep MyProject_InvoiceService
exchange MyProject_InvoiceService queue MyProject_InvoiceService []
MyProject exchange MyProject_InvoiceService queue MyProject.CustomerService.Customers.CustomerUpdated []
MyProject exchange MyProject_InvoiceService queue Volo.Abp.Localization.LanguageChangedEto []
MyProject exchange MyProject_InvoiceService queue Volo.Payment.RecurringPaymentUpdated []
MyProject exchange MyProject_InvoiceService queue Volo.Payment.SubscriptionCanceled []
MyProject exchange MyProject_InvoiceService queue Volo.Payment.SubscriptionCreated []
MyProject exchange MyProject_InvoiceService queue abp.data.apply_database_migrations []
MyProject exchange MyProject_InvoiceService queue abp.multi_tenancy.tenant.connection_string.updated []
MyProject exchange MyProject_InvoiceService queue abp.multi_tenancy.tenant.created []
The ETO class:
using Volo.Abp.EventBus;
namespace MyProject.CustomerService.Customers;
[EventName("MyProject.CustomerService.Customers.CustomerUpdated")]
public class CustomerUpdatedEto
{
public Guid Id { get; set; }
public string Name { get; set; } = null!;
public string Street { get; set; } = null!;
public string ZipCode { get; set; } = null!;
public string City { get; set; } = null!;
public string PhoneNumber { get; set; } = null!;
public string Email { get; set; }
public bool IsCompany { get; set; }
public string? IdentificationNumber { get; set; }
public string? AttName { get; set; }
}
That's everything I have done in the CustomerService. In the subscriber, InvoiceService is only one added class CustomerServiceEventHandler
using MyProject.CustomerService.Customers;
using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus.Distributed;
namespace MyProject.InvoiceService;
public class CustomerServiceEventHandler : IDistributedEventHandler<CustomerUpdatedEto>, ITransientDependency
{
public async Task HandleEventAsync(CustomerUpdatedEto eventData)
{
var customerId = eventData.Id;
}
}
Now, I have started the both services, CustomerService and the InvoiceService, and the RabbitMQ queues are listed by using the RabbitMQ CLI:
$ docker exec -it rabbitmq rabbitmqctl list_queues
Timeout: 60.0 seconds ...
Listing queues for vhost / ...
name messages
AbpBackgroundJobsDelayed.Volo.Abp.Emailing.BackgroundEmailSendingJobArgs 0
MyProject_AuthServer 0
MyProject_IdentityService 0
MyProject_CustomerService 0
AbpBackgroundJobs.Volo.Abp.Emailing.BackgroundEmailSendingJobArgs 0
MyProject_InvoiceService 0
So the queues seems to be registered. However, I can't see that any message is published, nor received at the subscribe. Notice that the receiver has a binding to the ETO class MyProject.CustomerService.Customers.CustomerUpdated.
$ docker exec -it rabbitmq rabbitmqctl list_bindings | grep MyProject_CustomerService
exchange MyProject_CustomerService queue MyProject_CustomerService []
MyProject exchange MyProject_CustomerService queue Volo.Abp.Localization.LanguageChangedEto []
MyProject exchange MyProject_CustomerService queue Volo.Payment.RecurringPaymentUpdated []
MyProject exchange MyProject_CustomerService queue Volo.Payment.SubscriptionCanceled []
MyProject exchange MyProject_CustomerService queue Volo.Payment.SubscriptionCreated []
MyProject exchange MyProject_CustomerService queue abp.data.apply_database_migrations []
MyProject exchange MyProject_CustomerService queue abp.multi_tenancy.tenant.connection_string.updated []
MyProject exchange MyProject_CustomerService queue abp.multi_tenancy.tenant.created []
$ docker exec -it rabbitmq rabbitmqctl list_bindings | grep MyProject_InvoiceService
exchange MyProject_InvoiceService queue MyProject_InvoiceService []
MyProject exchange MyProject_InvoiceService queue MyProject.CustomerService.Customers.CustomerUpdated []
MyProject exchange MyProject_InvoiceService queue Volo.Abp.Localization.LanguageChangedEto []
MyProject exchange MyProject_InvoiceService queue Volo.Payment.RecurringPaymentUpdated []
MyProject exchange MyProject_InvoiceService queue Volo.Payment.SubscriptionCanceled []
MyProject exchange MyProject_InvoiceService queue Volo.Payment.SubscriptionCreated []
MyProject exchange MyProject_InvoiceService queue abp.data.apply_database_migrations []
MyProject exchange MyProject_InvoiceService queue abp.multi_tenancy.tenant.connection_string.updated []
MyProject exchange MyProject_InvoiceService queue abp.multi_tenancy.tenant.created []
Thanks, it is working fine now! :-)