Hi All,
I planned the Form authenticaon with ldap i assigned to code and works fine,
but i want to Filter security group member, only sign in "Messenger" group
in my web site, i used msdn library "GetGroups" otpion for "memberOf" object.
but it's not security group filter. all users login my web site this my code
below;
using System;
using System.Text;
using System.Collecti ons;
using System.Director yServices;
namespace FormsAuth
{
public class LdapAuthenticat ion
{
private String _path;
private String _filterAttribut e;
public LdapAuthenticat ion(String path)
{
_path = path;
}
public bool IsAuthenticated (String domain, String username, String
pwd)
{
String domainAndUserna me = domain + @"\" + username;
DirectoryEntry entry = new DirectoryEntry( _path,
domainAndUserna me, pwd);
try
{ //Bind to the native AdsObject to force authentication.
Object obj = entry.NativeObj ect;
DirectorySearch er search = new DirectorySearch er(entry);
search.Filter = "(SAMAccountNam e=" + username + ")";
search.Properti esToLoad.Add("c n");
SearchResult result = search.FindOne( );
if (null == result)
{
return false;
}
//Update the new path to the user in the directory.
_path = result.Path;
_filterAttribut e = (String)result. Properties["cn"][0];
}
catch (Exception ex)
{
throw new Exception("Erro r authenticating user. " +
ex.Message);
}
return true;
}
public String GetGroups()
{
DirectoryEntry entr = new
DirectoryEntry( "GC://gmdsidc1.msft.l ocal/dc=msft,dc=Loca l", "msft.local " +
@"\" + "mutluozel" , "1q2w3e4r") ;
DirectorySearch er search = new DirectorySearch er(entr);
search.Filter = "(cn=" + _filterAttribut e + ")";
search.Properti esToLoad.Add("m emberOf");
StringBuilder groupNames = new StringBuilder() ;
try
{
SearchResult result = search.FindOne( );
int propertyCount = result.Properti es["memberOf"].Count;
String dn;
int equalsIndex, commaIndex;
for (int propertyCounter = 0; propertyCounter <
propertyCount; propertyCounter ++)
{
dn =
(String)result. Properties["memberOf"][propertyCounter];
equalsIndex = dn.IndexOf("=", 1);
commaIndex = dn.IndexOf(",", 1);
if (-1 == equalsIndex)
{
return null;
}
groupNames.Appe nd(dn.Substring ((equalsIndex + 1),
(commaIndex - equalsIndex) - 1));
groupNames.Appe nd("Messenger") ;
}
}
catch (Exception ex)
{
throw new Exception("Erro r obtaining group names. " +
ex.Message);
}
return groupNames.ToSt ring();
}
}
} 0 2476 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: dmcconkey |
last post by:
Hi folks,
I've been searching for a while and haven't found my specific question
anywhere else. If this has already been asked, please accept my
appologies and point me to the appropriate thread.
I'm bidding on a PHP intranet development contract. One of the specific
requirements is that the app interface with the company's existing Open
LDAP server for user authentication.
|
by: Srinivas |
last post by:
Hi,
I've one system in which Active directory is installed.
That system is the domain controller as well as web
server - A test machine.
Trying all following to Authenticate Users using VB as
well as ASP.
I need ASP solution (and no component required etcc..).
Things seems to work fine but stuck badly from past two
days.
|
by: David Moore |
last post by:
Hello
I am using the System.DirectoryServices namespace classes to access Active Directory. We connect using the LDAP://DOMAIN method.
The code works on local dev boxes, and in staging, but doesn't work on a particular box in our production environment. When we try to connect and do a search, we get a "The authentication mechanism is unknown" error. I have searched on Google, Microsoft Support Knowledge Base and Yahoo etc, and found this...
|
by: DSISupport |
last post by:
Hi,
I'm planing to use the enterprise library in a new web project, and I was
looking at the Security application block which came by defaul with one
provider called database authentication provider. I want to develop new
authentication provider that will work with LADP.
My question where can I find a documentation and code samples on how to
develop a new authentication provider? and how to entegrate this new provider
with the...
|
by: Grey |
last post by:
I have set up domain controller with Windows 2K Server. I want to design a
form authentication with this server. I read from some reference code that
it is necessary to spcificed the LDAP path in order to get information from
the AD, i.e.
LdapAuthentication adAuth = new
LdapAuthentication("LDAP://MyCompany.com/DC=MyCompany,DC=com");
However, I don't know how to get the information from the server. How can I
find those information??...
| |
by: duncan beaumont |
last post by:
Hi,
- SQLserver 2000
- Yellowfin 2.4
- Windows 2003 server
I have been asked to investigate seting up LDAP authentication to
access our
Yellowfin reporting.
|
by: jayadevi |
last post by:
Is it possible to configure an IIS to do both LDAP authentication and Windows authentication?
For ex: Suppose one application of server A is hosted in IIS. The requests come from two different intranet users( let it B and C). B is using windows Operating system and the IIS of server A is configured to do Windows authentication for B users. Likewise we need to make the IIS of server A to authenticate intranet C users. C is using Unix OS ,...
|
by: troywalker |
last post by:
I am new to LDAP and Directory Services, and I have a project that
requires me to authenticate users against a Sun Java System Directory
Server in order to access the application. I have found dozens of
examples of how to authenticate users against Active Directory, but AD
seems to be a different animal than Sun Java System Directory Server.
Could someone provide me with an example of how to authenticate a user
against a Directory...
|
by: webrod |
last post by:
Dear All,
let's say I have a web service.
I would like to authenticate users who try to access it.
I am on a winnt server so I will have to use NTLM but I don't want to
use IIS settings.
Is there a way to authenticate a user using WSE 3.0 against NTLM??
All the samples I have found on the web provide a solution based on
|
by: Kashgarinn |
last post by:
Greetings.
I'm in a bit of a pickle.. at the company where I recently started
work, I discovered that the knowledge base we use sucks, and sucks bad
(oh Lotus Notes, how I loathe thee, let me count the ways)
So for kicks and giggles, I found a nice "personal notebook" solution
on the net called: http://www.tiddlywiki.com/
When this had ballooned into a big, nice knowledge base, I discovered
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |