hi
https://docs.abp.io/en/abp/latest/Connection-Strings
hi
You can share a simple project. liming.ma@volosoft.com
hi
These belong to the scope of SignalR, You can get sample code from its document.
hi
You can override the public virtual async Task<IActionResult> OnGetAsync() of the Login page.
This is the same as you click the Windows button.
public override async Task<IActionResult> OnGetAsync()
{
var redirectUrl = Url.Page("./Login", pageHandler: "ExternalLoginCallback", values: new { ReturnUrl, ReturnUrlHash, });
var properties = SignInManager.ConfigureExternalAuthenticationProperties("Windows", redirectUrl);
properties.Items["scheme"] = "Windows";
return await Task.FromResult(Challenge(properties, provider));
}
See the sign in code
https://github.com/search?q=repo%3Aabpframework%2Fabp%20ProcessWindowsLoginAsync&type=code
hi
There is no problem with your DruidAIUserManagement code.
Can you share a project?
hi
Please add these code to output the headers.
We have to attach the cookies to call the endpoint.
If there is no cookies, the HTML of login page will show up.
// Blazor server mode
client.BaseAddress = new Uri(NavigationManager.BaseUri);
foreach (var header in HttpContextAccessor.HttpContext!.Request.Headers)
{
Logger.LogInformation("Header: {0} = {1}", header.Key, header.Value);
requestMessage.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray());
}
hi
Let;s check what is the value of responseString
var responseString = await response.Content.ReadAsStringAsync();
Logger.LogInformation("Response: {0}", responseString);
return responseString;
[Dependency(ReplaceServices = true)]
public class MyBlazorServerLookupApiRequestService : ILookupApiRequestService, ITransientDependency
{
public IHttpClientFactory HttpClientFactory { get; }
public IRemoteServiceHttpClientAuthenticator HttpClientAuthenticator { get; }
public IRemoteServiceConfigurationProvider RemoteServiceConfigurationProvider { get; }
public ICurrentTenant CurrentTenant { get; }
public IHttpContextAccessor HttpContextAccessor { get; }
public NavigationManager NavigationManager { get; }
public ILogger<MyBlazorServerLookupApiRequestService> Logger { get; }
public MyBlazorServerLookupApiRequestService(IHttpClientFactory httpClientFactory,
IRemoteServiceHttpClientAuthenticator httpClientAuthenticator,
ICurrentTenant currentTenant,
IHttpContextAccessor httpContextAccessor,
NavigationManager navigationManager,
IRemoteServiceConfigurationProvider remoteServiceConfigurationProvider,
ILogger<MyBlazorServerLookupApiRequestService> logger)
{
HttpClientFactory = httpClientFactory;
HttpClientAuthenticator = httpClientAuthenticator;
CurrentTenant = currentTenant;
HttpContextAccessor = httpContextAccessor;
NavigationManager = navigationManager;
RemoteServiceConfigurationProvider = remoteServiceConfigurationProvider;
Logger = logger;
}
public async Task<string> SendAsync(string url)
{
var client = HttpClientFactory.CreateClient();
var requestMessage = new HttpRequestMessage(HttpMethod.Get, url);
var uri = new Uri(url, UriKind.RelativeOrAbsolute);
if (!uri.IsAbsoluteUri)
{
var remoteServiceConfig = await RemoteServiceConfigurationProvider.GetConfigurationOrDefaultOrNullAsync("Default");
if (remoteServiceConfig != null)
{
// Blazor tiered mode
var baseUrl = remoteServiceConfig.BaseUrl;
client.BaseAddress = new Uri(baseUrl);
AddHeaders(requestMessage);
await HttpClientAuthenticator.Authenticate(new RemoteServiceHttpClientAuthenticateContext(client, requestMessage, new RemoteServiceConfiguration(baseUrl), string.Empty));
}
else
{
// Blazor server mode
client.BaseAddress = new Uri(NavigationManager.BaseUri);
foreach (var header in HttpContextAccessor.HttpContext!.Request.Headers)
{
requestMessage.Headers.TryAddWithoutValidation(header.Key, header.Value.ToArray());
}
}
}
var response = await client.SendAsync(requestMessage);
var responseString = await response.Content.ReadAsStringAsync();
Logger.LogInformation("Response: {0}", responseString);
return responseString;
}
protected virtual void AddHeaders(HttpRequestMessage requestMessage)
{
if (CurrentTenant.Id.HasValue)
{
requestMessage.Headers.Add(TenantResolverConsts.DefaultTenantKey, CurrentTenant.Id.Value.ToString());
}
var currentCulture = CultureInfo.CurrentUICulture.Name ?? CultureInfo.CurrentCulture.Name;
if (!currentCulture.IsNullOrEmpty())
{
requestMessage.Headers.AcceptLanguage.Add(new(currentCulture));
}
}
}
Remove dummyClientSecret in angular
And unset the secret of the client.
hi
You can add a new Hub and add a new service like SignalRTypingMessageSender(SignalRRealTimeChatMessageSender)
In angular side. Send the request to API when the user is typing. And the API uses SignalRTypingMessageSender to send the messages to users.
hi
You can remove the client_secret from the application/client.
Your angular client should be a public application.
https://auth0.com/docs/get-started/applications/confidential-and-public-applications