ome.logic
Class LdapImpl

java.lang.Object
  extended by ome.logic.AbstractLevel2Service
      extended by ome.logic.LdapImpl
All Implemented Interfaces:
ILdap, ServiceInterface, SelfConfigurableService, org.springframework.context.ApplicationContextAware

@Transactional(readOnly=true)
public class LdapImpl
extends AbstractLevel2Service
implements ILdap, org.springframework.context.ApplicationContextAware

Provides methods for administering user accounts, passwords, as well as methods which require special privileges. Developer note: As can be expected, to perform these privileged the Admin service has access to several resources that should not be generally used while developing services. Misuse could circumvent security or auditing.

Since:
3.0-M3
Version:
$Revision: 1552 $, $Date: 2007-05-23 09:43:33 +0100 (Wed, 23 May 2007) $
Author:
Aleksandra Tarkowska, A.Tarkowska@dundee.ac.uk
See Also:
SecuritySystem, Permissions

Field Summary
 
Fields inherited from class ome.logic.AbstractLevel2Service
iQuery, iUpdate, metadata, queryFactory, sec
 
Constructor Summary
LdapImpl(org.springframework.ldap.core.ContextSource ctx, org.springframework.ldap.core.LdapOperations ldap, Roles roles, LdapConfig config, RoleProvider roleProvider, org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbc)
           
 
Method Summary
 boolean createUserFromLdap(String username, String password)
          Gets user from LDAP for checking him by requirements and setting his details on DB
 String findDN(String username)
          Searchs unique Distinguished Name - String in LDAP for Common Name equals username.
 ome.model.meta.Experimenter findExperimenter(String username)
          Searchs Experimenter by unique Distinguished Name - String in LDAP for Common Name equals username.
 Class<? extends ServiceInterface> getServiceInterface()
           
 boolean getSetting()
          Gets config value from properties.
 String lookupLdapAuthExperimenter(Long id)
           
 List<Map<String,Object>> lookupLdapAuthExperimenters()
           
 List<ome.model.meta.Experimenter> searchAll()
          Searchs all Experimenter list on LDAP for attribute objectClass = person.
 List<ome.model.meta.Experimenter> searchByAttribute(String dns, String attr, String value)
          Searchs all Experimenter in LDAP for specyfied attribute
 List<ome.model.meta.Experimenter> searchByAttributes(String dn, String[] attributes, String[] values)
          Searchs all Experimenter in LDAP for specyfied attributes.
 ome.model.meta.Experimenter searchByDN(String dns)
          Searchs one Experimenter in LDAP for specyfied Distinguished Name - String
 List<String> searchDnInGroups(String attr, String value)
          Searchs Distinguished Name - String in groups
 void setApplicationContext(org.springframework.context.ApplicationContext arg0)
           
 void setDN(Long experimenterID, String dn)
          Searchs all Experimenter in LDAP for objectClass = person
 boolean validatePassword(String dn, String password)
          Validates password for base.
 
Methods inherited from class ome.logic.AbstractLevel2Service
getBeanHelper, getExtendedMetadata, getQueryFactory, getSecuritySystem, selfConfigure, setExtendedMetadata, setQueryFactory, setQueryService, setSecuritySystem, setUpdateService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LdapImpl

public LdapImpl(org.springframework.ldap.core.ContextSource ctx,
                org.springframework.ldap.core.LdapOperations ldap,
                Roles roles,
                LdapConfig config,
                RoleProvider roleProvider,
                org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbc)
Method Detail

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext arg0)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

getServiceInterface

public Class<? extends ServiceInterface> getServiceInterface()
Specified by:
getServiceInterface in interface SelfConfigurableService

searchAll

public List<ome.model.meta.Experimenter> searchAll()
Description copied from interface: ILdap
Searchs all Experimenter list on LDAP for attribute objectClass = person.

Specified by:
searchAll in interface ILdap
Returns:
all Experimenter list.

searchByAttribute

public List<ome.model.meta.Experimenter> searchByAttribute(String dns,
                                                           String attr,
                                                           String value)
Description copied from interface: ILdap
Searchs all Experimenter in LDAP for specyfied attribute

Specified by:
searchByAttribute in interface ILdap
Parameters:
dns - - Distinguished Name - String base for search. Never null, should be net.sf.ldaptemplate.support.DistinguishedName#EMPTY_PATH.
value - - String expected value of attribute. Never null or empty.
Returns:
List of Experimenters.

searchByDN

public ome.model.meta.Experimenter searchByDN(String dns)
Description copied from interface: ILdap
Searchs one Experimenter in LDAP for specyfied Distinguished Name - String

Specified by:
searchByDN in interface ILdap
Parameters:
dns - unique Distinguished Name - String of user, Never null or empty.
Returns:
an Experimenter.

findDN

public String findDN(String username)
Description copied from interface: ILdap
Searchs unique Distinguished Name - String in LDAP for Common Name equals username. Common Name should be unique under the specified base. If list of cn's contains more then one DN will return exception.

Specified by:
findDN in interface ILdap
Parameters:
username - Name of the Experimenter equals CommonName.
Returns:
an String Distinguished Name. Never null.

findExperimenter

public ome.model.meta.Experimenter findExperimenter(String username)
Description copied from interface: ILdap
Searchs Experimenter by unique Distinguished Name - String in LDAP for Common Name equals username. Common Name should be unique under the specified base. If list of cn's contains more then one DN will return exception.

Specified by:
findExperimenter in interface ILdap
Parameters:
username - Name of the Experimenter equals CommonName.
Returns:
an Experimenter. Never null.

searchDnInGroups

public List<String> searchDnInGroups(String attr,
                                     String value)
Description copied from interface: ILdap
Searchs Distinguished Name - String in groups

Specified by:
searchDnInGroups in interface ILdap
Parameters:
attr - - String name of memeber attribute. Never null or empty.
value - - user's DN which should be set on value for attribute. Never null or empty.
Returns:
List of groups which contains DN.

searchByAttributes

public List<ome.model.meta.Experimenter> searchByAttributes(String dn,
                                                            String[] attributes,
                                                            String[] values)
Description copied from interface: ILdap
Searchs all Experimenter in LDAP for specyfied attributes. Attributes should be specyfied in String [] and their values should be set in equivalets String [].

Specified by:
searchByAttributes in interface ILdap
Parameters:
dn - - net.sf.ldaptemplate.support.DistinguishedName base for search. Never null, should be net.sf.ldaptemplate.support.DistinguishedName#EMPTY_PATH.
Returns:
List of Experimenters.

setDN

@Transactional(readOnly=false)
public void setDN(Long experimenterID,
                                String dn)
Description copied from interface: ILdap
Searchs all Experimenter in LDAP for objectClass = person

Specified by:
setDN in interface ILdap

getSetting

public boolean getSetting()
Description copied from interface: ILdap
Gets config value from properties.

Specified by:
getSetting in interface ILdap
Returns:
boolean

createUserFromLdap

public boolean createUserFromLdap(String username,
                                  String password)
Gets user from LDAP for checking him by requirements and setting his details on DB

Returns:
ServiceFactory

validatePassword

public boolean validatePassword(String dn,
                                String password)
Validates password for base. Base is user's DN. When context was created successful specified requirements are valid.

Returns:
boolean

lookupLdapAuthExperimenters

public List<Map<String,Object>> lookupLdapAuthExperimenters()

lookupLdapAuthExperimenter

public String lookupLdapAuthExperimenter(Long id)


OmeroJava Api

Version: Beta-4.2.0-r7571-b29

Copyright © 2009 The University of Dundee. All Rights Reserved.