active-directory

How to find users in AD that belong to a group, and just get their SAMAccountName, and SID?

纵饮孤独 提交于 2020-01-15 03:45:09
问题 I just want a user to be able to type in a group name in a textbox, and return just their login name and their SID. So far i have this, and that loads the users in the group but im unsure how to extract the login and SID. SearchResult result; DirectorySearcher search = new DirectorySearcher(); search.Filter = String.Format("(cn={0})", txtGroup.Text); search.PropertiesToLoad.Add("member"); search.PropertiesToLoad.Add("cn"); search.PropertiesToLoad.Add("objectGUID"); result = search.FindOne();

System.DirectoryServices vs system.directoryservices.accountmanagement

二次信任 提交于 2020-01-14 22:48:05
问题 I have an array (propertyList) that contains the names of certain Active Directory properties whose data I want to retrieve. Using Ironpython and .NET library System.DirectoryServices I solve the retrieval of properties to be loaded in this way: for propertyActDir in propertyList: obj.PropertiesToLoad.Add(propertyActDir) res = obj.FindAll() myDict = {} for sr in res: for prop in propertyList: myDict[prop] = getField(prop,sr.Properties[prop][0]) The function getField is mine. How can I solve

Active Directories UserPrincipal.Current.GetGroups() returns group on local not on web server

独自空忆成欢 提交于 2020-01-14 19:23:17
问题 The following works great on my local development box. However when I move it to the web server it fails and will not even log the error: public static List<string> getAuthorizationGrps(string userName) { List<string> grps = new List<string>(); try { PrincipalSearchResult<Principal> groups = UserPrincipal.Current.GetGroups(); IEnumerable<string> groupNames = groups.Select(x => x.SamAccountName); foreach (var name in groupNames) { grps.Add(name.ToString()); } return grps; } catch (Exception ex

Active directory : get groups where a user is member

旧街凉风 提交于 2020-01-14 14:01:12
问题 I'd like find the groups list where a user is member. I tried several solution from http://www.codeproject.com/KB/system/everythingInAD.aspx but no result. This code give me a "true", means LDAP is running : public static bool Exists(string objectPath) { bool found = false; if (DirectoryEntry.Exists("LDAP://" + objectPath)) found = true; return found; } Thanks, Update 1: public ArrayList Groups(string userDn, bool recursive) { ArrayList groupMemberships = new ArrayList(); return

Error creating a user with more than 20 chars in sAMAccountName using .NET

﹥>﹥吖頭↗ 提交于 2020-01-14 07:38:41
问题 I'm trying to programatically create a new Active Directory user setting the sAMAccountName attribute with a value larger than 20 chars. When I call the DirectoryEntry.CommitChanges(), I get the error: 00000523: SysErr: DSID-031A0FB6, problem 22 (Invalid argument), data 0 If I try to create a new user setting the sAMAccountName smaller than 20 chars everything work. Before someone says the the limit of the sAMAccountName is 20 chars, I want to point out that if I try to create the same user

How to use PrincipalContext in .NET Core 2.0

て烟熏妆下的殇ゞ 提交于 2020-01-14 07:36:10
问题 I have created a web application in .NET Core 2.0 where I would like to use a PrincipalContext from namespace System.DirectoryServices.AccountManagement . I want to validate user agains Active Directory like this: private static ClaimsIdentity ValidateUser(string userName, string password) { var domain = GetDomainByLogin(userName); using (var pc = new PrincipalContext(ContextType.Domain, domain, null, ContextOptions.Negotiate)) { if (!pc.ValidateCredentials(userName, password)) return null;

How to get current token from Azure ActiveDirectory application

*爱你&永不变心* 提交于 2020-01-14 03:08:53
问题 I have an ASP.NET Application created using the Visual Studio 2013 project template. For security, I chose Azure Active Directory. I have all of the login working, but I'd like to start using the Graph API to manage users in my application. I have created an Application Key to use with Azure AD, but I'm not quite sure how to go about making graph calls. I've studied the code at https://github.com/AzureADSamples/WebApp-GraphAPI-DotNet, but using the graph API in that way requires a token. Is

Windows authentication with PHP on IIS

微笑、不失礼 提交于 2020-01-13 05:35:08
问题 I'm Working on an Intranet application that is build in PHP on IIS. I want to authenticate against an AD by passing the username automatically from the browser to the IIS using windows authentication. Is there anyway to do that? 回答1: Yes, IIS supports integrated Windows authentication. Access the 'Authentication' option for your website... ...and change the 'Windows Authentication' item to 'enabled' (and perhaps 'Anonymous Authentication' to 'disabled' if you want to force users to

Getting blank value for $_SERVER['AUTH_USER']

两盒软妹~` 提交于 2020-01-12 14:59:34
问题 I have a PHP app running on Windows 2008 server R2, which authenticates users against Active Directory using PHP's LDAP library. As per this answer, I'm looking to use $_SERVER['AUTH_USER'] , but I'm getting a blank value for it. Same for AUTH_TYPE and AUTH_PASSWORD . The variables are declared, but none of them have any value assigned to them. I've enabled both the Basic Authentication and Windows Authentication roles (through Server Manager), but neither has solved the issue. I'm using PHP

A positional parameter cannot be found that accepts arguement “xxx”

半腔热情 提交于 2020-01-12 11:55:09
问题 I am trying to understand what this error actually means. So far a search of similar help requests for this error range from missing parameters, missing pipes, use of single or multi lines and also concatenation issues but none of the answers seem to give a definitive reason. So I assume the issue is code format (which makes it a lot harder to track down). This is my script which I am writing to rename active directory users per target OU from whatever format they are now into a firstname