I am making a call to WebAPI layer of the project.
Recently we added the header AbpApiAuthorize to controllers on WebAPI layer in the process of implementing token based authentication between Application project and Web API project calls.
How can I get the bearer token to add to the header before I call WebAPI project.
I am currently calling Authenticate method. But, do I need to call it every time? Or do we already have this stored in Identity or Session. If yes, how can I access it?
We're using MVC5.* + AJ1.* Just wondering whether there is a built-in retry logic in abp EventBus? (Immediate Retry or Delayed Retry, etc... ) And is the abp EventBus maintaining an in-memory queue or list to keep track of events?
Thank you,
I am looking for a message box with continue and cancel buttons and where I can have a<ins>hyperlink</ins> in the text area .
Dear Support,
We're using MVC 5.* + AngularJS1.*. We are trying to implement logging off another user when that user's securitystamp gets changed. We set up the OnValidateIdentity event in CookieAuthenticationProvider (UserManager is resolved and registered in OwinContext):
app.CreatePerOwinContext(() => IocManager.Instance.Resolve<UserManager>());
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<UserManager, User, long>(
validateInterval: TimeSpan.FromMinutes(1),
regenerateIdentityCallback: (manager, user) => manager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie),
getUserIdCallback: (ci) => (Int64.Parse(ci.GetUserId())))
},
SlidingExpiration = true,
ExpireTimeSpan = TimeSpan.FromMinutes(30)
});
*: THE GetUserId() is under namespace Microsoft.AspNet.Identity instead of Abp.Runtime.Security.
After doing this, we noticed that all users get signed off (in one minute as I set the validate interval to be 1 minute), no matter whether the user's securitystamp gets updated or not. But we only want to log out users whose securitystamp has been changed. Do I miss something or do anything wrong in setting up the cookie authentication provider?
Thank you,
I'm using MVC 5.* + AngularJS version, and came across a weird issue when trying to use eventbus.
When I try to use EventBus to do insert/update for a batch of UserOrganizationUnit records:
EventBus.Trigger(new UserOrganizationUnitsUpdateDto { UserId = user.Id, OrganizationUnitIds = input.GrantedOrganizationUnits });
It throws me an error:
$exception {"The changes to the database were committed successfully, but an error occurred while updating the object context. The ObjectContext might be in an inconsistent state. Inner exception message: Saving or accepting changes failed because more than one entity of type 'Abp.Authorization.Users.UserOrganizationUnit' have the same primary key value. Ensure that explicitly set primary key values are unique. Ensure that database-generated primary keys are configured correctly in the database and in the Entity Framework model. Use the Entity Designer for Database First/Model First configuration. Use the 'HasDatabaseGeneratedOption" fluent API or 'DatabaseGeneratedAttribute' for Code First configuration."} System.InvalidOperationException
It works properly if I simply use:
updateList.ForEach(x => _userOrganizationUnitRepository.InsertOrUpdateAsync(x));
But updateList.ForEach(x => _userOrganizationUnitRepository.InsertOrUpdateAsync(x)); would take around 1-2 minutes for 9000 records... So I'm still prefer using eventbus to improve user experience.
The Id column in UserOrganizationUnit is already an identity column in database, but it is not decorated with DatabaseGeneratedOption. Is there a way to work around this issue?
Objective: I need to force the user to log out when I mark the user to Inactive in user management (from a different machine). The user immediately should be redirected to log out page expiring his session so he cannot log back in!
How can we do this?
I am trying to create an user with email id <a href="mailto:[email protected]">[email protected]</a> but Abp throws an error saying User name <a href="mailto:[email protected]">[email protected]</a> is invalid, can only contain letters or digits.
How can we allow '-' in the emails ? As now most of the companies uses such kind of email format!
Hi - Swagger is throwing the following error. I already added c.UseFullTypeNameInSchemaIds(); to WebApiModule.cs file. However, that doesn't seem to resolve the issue. Any ideas to help resolve this?
500 : {"message":"An error has occurred.","exceptionMessage":"Conflicting schemaIds: Duplicate schemaIds detected for types and . See the config setting - "UseFullTypeNameInSchemaIds" for a potential workaround","exceptionType":"System.InvalidOperationException","stackTrace":" at Swashbuckle.Swagger.SchemaRegistry.CreateRefSchema(Type type)\r\n at Swashbuckle.Swagger.SchemaRegistry.GetOrRegister(Type type)\r\n at Swashbuckle.Swagger.SwaggerGenerator.CreateOperation(ApiDescription apiDesc, SchemaRegistry schemaRegistry)\r\n at Swashbuckle.Swagger.SwaggerGenerator.CreatePathItem(IEnumerable1 apiDescriptions, SchemaRegistry schemaRegistry)\r\n at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable
1 source, Func2 keySelector, Func
2 elementSelector, IEqualityComparer`1 comparer)\r\n at Swashbuckle.Swagger.SwaggerGenerator.GetSwagger(String rootUrl, String apiVersion)\r\n at Swashbuckle.Application.SwaggerDocsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpMessageInvoker.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at Abp.WebApi.Controllers.ResultWrapperHandler.
I'm using MVC5.* and AngularJS for our project. I have a shopping cart module for user to add items into it . I'm trying to archive that an item could be added to all opened windows if user add one item in one of opened windows. I have couple questions on the way of using AbpCommonHub to implement signalr hub.
(1) Can I use AbpCommonHub in Application project (instead of Web Project)? If I can, do I still need to register in Start_Up.cs in the web project? (2) If could, could I add AbpCommonHub as a property in one of my Services?
public class ShoppingCartService : MyProjectAppServiceBase, IShoppingCartService{
private static IHubContext CommonHub
{
get
{
return GlobalHost.ConnectionManager.GetHubContext<AbpCommonHub>();
}
}
public void BroadCastAddItem(IReadOnlyList<IOnlineClient> clients)
{
foreach (var client in clients)
{
var signalRClient = CommonHub.Clients.Client(client.ConnectionId);
if (signalRClient == null)
{
Logger.Debug("Can not get user " + client.UserId + " from SignalR hub!");
continue;
}
signalRClient.getAddItemMessage("A new Item added to Shopping Cart!"));
}
}
}
*:Because I already inherit base class MyProjectAppServiceBase, I could not add AbpCommonHub as base class. Is it okay to add AbpCommonHub as a private field?
(3) Could I use localhost:6240/signalr to connect to the server?
Any hint would be greatly appreciated! Thank you in advance.
I tried to set up constants in AbpSettings, created customprovider(inheriting from SettingsProvider) in WebApi project, configured it in APiModule as below:
Configuration.Settings.Providers.Add<MySettingProvider>();
However, the values are not being pulled from the database.
The following is how I am trying to pull the values: SettingManager.GetSettingValue(AppSettings.TenantManagement.URL);
Please let me know if I am missing anything.
Thank you for your help in advance.