C# Class pGina.Plugin.Ldap.LdapServer

Inheritance: IDisposable
Datei anzeigen Open project: pgina/pgina Class Usage Examples

Public Methods

Method Description
Authenticate ( string uname, string password ) : BooleanResult

Attempt to authenticate the user by binding to the LDAP server.

Bind ( ) : void

Tries to bind to the server anonymously. Throws LdapException if the bind fails.

Bind ( NetworkCredential creds ) : void

Try to bind to the LDAP server with the given credentials. This uses basic authentication. Throws LdapException if the bind fails.

BindForSearch ( ) : void
Close ( ) : void
Dispose ( ) : void
FindFirstDN ( string searchBase, string filter ) : string

Does a search in the subtree at searchBase, using the filter provided and returns the DN of the first match.

GetUserDN ( string uname ) : string
LdapServer ( ) : System
MemberOfGroup ( string user, string group ) : bool
SetUserAttribute ( string uname, string attribute, string value ) : void

Private Methods

Method Description
Connect ( ) : void
CreateSearchFilter ( string uname ) : string

This generates the search filter to be used when searching for the DN

CreateUserDN ( string uname ) : string

This generates the DN for the user assuming that a pattern has been provided. This assumes that Settings.Store.DnPattern has a valid DN pattern.

FindUserDN ( string uname ) : string

Attempts to find the DN for the user by searching a set of LDAP trees. The base DN for each of the trees is retrieved from Settings.Store.SearchContexts. The search filter is taken from Settings.Store.SearchFilter. If all searches fail, this method returns null.

VerifyCert ( System.DirectoryServices.Protocols.LdapConnection conn, X509Certificate cert ) : bool

This is the verify certificate callback method used when initially binding to the LDAP server. This manages all certificate validation.

Method Details

Authenticate() public method

Attempt to authenticate the user by binding to the LDAP server.
public Authenticate ( string uname, string password ) : BooleanResult
uname string
password string
return pGina.Shared.Types.BooleanResult

Bind() public method

Tries to bind to the server anonymously. Throws LdapException if the bind fails.
public Bind ( ) : void
return void

Bind() public method

Try to bind to the LDAP server with the given credentials. This uses basic authentication. Throws LdapException if the bind fails.
public Bind ( NetworkCredential creds ) : void
creds System.Net.NetworkCredential The credentials to use when binding.
return void

BindForSearch() public method

public BindForSearch ( ) : void
return void

Close() public method

public Close ( ) : void
return void

Dispose() public method

public Dispose ( ) : void
return void

FindFirstDN() public method

Does a search in the subtree at searchBase, using the filter provided and returns the DN of the first match.
public FindFirstDN ( string searchBase, string filter ) : string
searchBase string The DN of the root of the subtree for the search (search context).
filter string The search filter.
return string

GetUserDN() public method

public GetUserDN ( string uname ) : string
uname string
return string

LdapServer() public method

public LdapServer ( ) : System
return System

MemberOfGroup() public method

public MemberOfGroup ( string user, string group ) : bool
user string
group string
return bool

SetUserAttribute() public method

public SetUserAttribute ( string uname, string attribute, string value ) : void
uname string
attribute string
value string
return void