Hi,
the documentation says "LDAP (Active Directory) Authentication is disabled by default. To make it work, you should disable multi-tenancy since LDAP auth is not used in a multi-tenant system normally."
Is it technically possible to enable both (LDAP Auth and multi-tenancy) at the same time? All users are in the same domain, but the customer has multiple divisions to be separated. It would also be helpfull to be able to use the edition feature.
If it will be technically possible to enable both at the same time - do we have to customize code or will it run out of the box?
Thank you very much!
Hi,
is it possible to re-use the authentication info of an user in an ASP.NET Zero project that uses LDAP auth (SPA with Angular 1)? I would like to use it to authenticate the user against the Exchange Webservice managed API, if this should be possible (<a class="postlink" href="https://github.com/OfficeDev/ews-managed-api">https://github.com/OfficeDev/ews-managed-api</a>). I think it will not be possible to use the "service.UseDefaultCredentials = true;" with the web application, but perhaps we can use the credentials entered to login? (service.Credentials = new WebCredentials("[email protected]", "password"); Source: <a class="postlink" href="https://msdn.microsoft.com/en-us/library/office/dn567668(v=exchg.150">https://msdn.microsoft.com/en-us/librar ... =exchg.150</a>).aspx)
Thank you very much.
Hi, I have to set the focus on an input element that I identify. I am using SPA with Angular 1. I am able to identify it and and i am able to set the focus - but the finally part of the event listener of the service method seems to fire to early to use my method, cause the focus is not set.
I have tried to use the "$scope.$on('$viewContentLoaded', function ()" that is contained in some views, but without luck - the function content will not be called.
Do you have a hint for me, how I can use event listeners that can call my function when everything is in place and loaded? Thank you very much!
Could you please give me a hint if there is a way to protect the whole Web API by making it accessible only to a defined set of IP addresses? Thank you very much for your great support!
Perfect - thank you very much.
Thank you very much - that was the problem!
Is my code ok or is there a better way to solve it?
Solution.Web.MultiTenancy.TenantIdAccessor.cs:
public void SetCurrentTenantId()
{
var tenancyName = _tenancyNameFinder.Value.GetCurrentTenancyNameOrNull();
CurrentTenantId = GetVerifiedTenantIdOrNull();
}
private int? GetVerifiedTenantIdOrNull()
{
var tenantIdFromClient = GetFromHeaderOrNull();
if (tenantIdFromClient != null)
{
return _tenantCache.GetOrNull(tenantIdFromClient.Value)?.Id;
}
return null;
}
private int? GetFromHeaderOrNull()
{
if (HttpContext.Current == null)
{
return null;
}
if(HttpContext.Current.Request.Headers.GetValues("Abp.TenantId") == null)
{
return null;
}
var header = HttpContext.Current.Request.Headers.GetValues("Abp.TenantId").GetValue(0).ToString();
if (string.IsNullOrWhiteSpace(header))
{
return null;
}
int tenantId;
return int.TryParse(header, out tenantId) ? (int?)tenantId : null;
}
It seems that it does not work with repositories based on entities that are defined in the project - I have done the following test to check it: I have changed the build in GetUserChatMessages from ChatAppService and changed it to:
[AbpAllowAnonymous]
public async Task<ListResultDto<ChatMessageDto>> GetUserChatMessages(GetUserChatMessagesInput input)
{
//var userId = AbpSession.GetUserId();
//var messages = await _chatMessageRepository.GetAll()
// .WhereIf(input.MinMessageId.HasValue, m => m.Id < input.MinMessageId.Value)
// .Where(m => m.UserId == userId && m.TargetTenantId == input.TenantId && m.TargetUserId == input.UserId)
// .OrderByDescending(m => m.CreationTime)
// .Take(50)
// .ToListAsync();
var messages = await _chatMessageRepository.GetAll().Where(m=>m.UserId == 2).ToListAsync();
messages.Reverse();
return new ListResultDto<ChatMessageDto>(messages.MapTo<List<ChatMessageDto>>());
}
The result is the same as for my own AppService class - not a single result row for anonymous users. You can call it anonymously, it jumps into the method in debug, you can step through the code until the end of the method but the repository always delivers 0 result rows from database - until you sign in with a user and repeat it - then you get the results you expect.
So where do I have to change what to allow anonymous access to the repositories? Thank you very much.
Thank you - I have already tried this with several of my repositories. They all deliver 0 items until I sign in. No not authorized or error messages just 0 items.
Additional info - I have added the _userRoleRepository to my class and I am able to retrieve results anonymously. But where could be the difference between my own repositories and the ABP ones? Thanks!
OK, I have checked logs and debugged - and now I am sure that the only problem I hit is that I cannot use repositories to access database. All repositories deliver 0 results. When I sign in to the backend and trigger the method again, than the repositories deliver the results.
Do I have to define anonymous access somewhere else to get the repositories working? Very strange about this behaviour is the fact that the GetUsers method works with repositories too and does not run into problems. I have compared the structure of my own service class and the UserAppService class and cannot find differences.
Thank you!