Browse Source

Removed old LDAP code from sandbox and adjusted dependencies accordingly.

1.0.x
Luke Taylor 19 years ago
parent
commit
cbc74de7c6
  1. 5
      sandbox/other/pom.xml
  2. 30
      sandbox/other/src/main/java/org/acegisecurity/ldap/ContextSourceInitialDirContextFactory.java
  3. 27
      sandbox/other/src/main/java/org/acegisecurity/ldap/ppolicy/PasswordPolicyResponseControl.java
  4. 25
      sandbox/other/src/main/java/org/acegisecurity/userdetails/UserDetailsManager.java
  5. 50
      sandbox/other/src/main/java/org/acegisecurity/userdetails/ldap/InetOrgPerson.java

5
sandbox/other/pom.xml

@ -39,11 +39,6 @@ @@ -39,11 +39,6 @@
<artifactId>ldapsdk</artifactId>
<version>4.1</version>
</dependency>
<dependency>
<groupId>net.sf.ldaptemplate</groupId>
<artifactId>ldaptemplate</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.samba.jcifs</groupId>
<artifactId>jcifs</artifactId>

30
sandbox/other/src/main/java/org/acegisecurity/ldap/ContextSourceInitialDirContextFactory.java

@ -1,30 +0,0 @@ @@ -1,30 +0,0 @@
package org.acegisecurity.ldap;
import net.sf.ldaptemplate.ContextSource;
import javax.naming.directory.DirContext;
import org.springframework.dao.DataAccessException;
/**
* A version of InitialDirContextFactory that implements the ldaptemplate ContextSource interface.
*
* DefaultInitialDirContextFactory should be modified to implement this when it is possible to
* introduce a dependency on ldaptemplate in the main code.
*
* @author Luke
* @version $Id$
*/
public class ContextSourceInitialDirContextFactory extends DefaultInitialDirContextFactory implements ContextSource {
public ContextSourceInitialDirContextFactory(String providerUrl) {
super(providerUrl);
}
public DirContext getReadOnlyContext() throws DataAccessException {
return newInitialDirContext();
}
public DirContext getReadWriteContext() throws DataAccessException {
return newInitialDirContext();
}
}

27
sandbox/other/src/main/java/org/acegisecurity/ldap/ppolicy/PasswordPolicyResponseControl.java

@ -77,6 +77,18 @@ public class PasswordPolicyResponseControl extends PasswordPolicyControl { @@ -77,6 +77,18 @@ public class PasswordPolicyResponseControl extends PasswordPolicyControl {
//~ Constructors ===================================================================================================
/**
* Decodes the Ber encoded control data. The ASN.1 value of the control data is:<pre>
* PasswordPolicyResponseValue ::= SEQUENCE { warning [0] CHOICE {
* timeBeforeExpiration [0] INTEGER (0 .. maxInt),
* graceAuthNsRemaining [1] INTEGER (0 .. maxInt) } OPTIONAL, error [1] ENUMERATED {
* passwordExpired (0), accountLocked (1),
* changeAfterReset (2), passwordModNotAllowed (3),
* mustSupplyOldPassword (4), insufficientPasswordQuality (5),
* passwordTooShort (6), passwordTooYoung (7),
* passwordInHistory (8) } OPTIONAL }</pre>
*
*/
public PasswordPolicyResponseControl(byte[] encodedValue) {
this.encodedValue = encodedValue;
@ -111,19 +123,6 @@ public class PasswordPolicyResponseControl extends PasswordPolicyControl { @@ -111,19 +123,6 @@ public class PasswordPolicyResponseControl extends PasswordPolicyControl {
return errorCode;
}
/**
* Decodes the Ber encoded control data. The ASN.1 value of the control data is:<pre>
* PasswordPolicyResponseValue ::= SEQUENCE { warning [0] CHOICE {
* timeBeforeExpiration [0] INTEGER (0 .. maxInt),
* graceAuthNsRemaining [1] INTEGER (0 .. maxInt) } OPTIONAL, error [1] ENUMERATED {
* passwordExpired (0), accountLocked (1),
* changeAfterReset (2), passwordModNotAllowed (3),
* mustSupplyOldPassword (4), insufficientPasswordQuality (5),
* passwordTooShort (6), passwordTooYoung (7),
* passwordInHistory (8) } OPTIONAL }</pre>
*
* @return DOCUMENT ME!
*/
/**
* Returns the graceLoginsRemaining.
*
@ -207,7 +206,7 @@ public class PasswordPolicyResponseControl extends PasswordPolicyControl { @@ -207,7 +206,7 @@ public class PasswordPolicyResponseControl extends PasswordPolicyControl {
}
//~ Inner Classes ==================================================================================================
/**
* Decoder based on Netscape ldapsdk library
*/

25
sandbox/other/src/main/java/org/acegisecurity/userdetails/UserDetailsManager.java

@ -1,25 +0,0 @@ @@ -1,25 +0,0 @@
package org.acegisecurity.userdetails;
/**
* An extension of the {@link UserDetailsService} which provides the ability
* to create new users and update existing ones.
*
* @author Luke
* @version $Id$
*/
public interface UserDetailsManager extends UserDetailsService {
/**
* Save details for the supplied user, or update
*
* @param user
*/
void createUser(UserDetails user);
void updateUser(UserDetails user);
void deleteUser(String username);
boolean userExists(String username);
}

50
sandbox/other/src/main/java/org/acegisecurity/userdetails/ldap/InetOrgPerson.java

@ -1,50 +0,0 @@ @@ -1,50 +0,0 @@
package org.acegisecurity.userdetails.ldap;
/**
* @author Luke
* @version $Id$
*/
public class InetOrgPerson extends LdapUserDetailsImpl {
String sn;
String cn;
public String getSn() {
return sn;
}
public String getCn() {
return cn;
}
public static class Essence extends LdapUserDetailsImpl.Essence {
public Essence() {
}
public Essence(InetOrgPerson copyMe) {
super(copyMe);
}
LdapUserDetailsImpl createTarget() {
return new InetOrgPerson();
}
public void setSn(String sn) {
((InetOrgPerson)instance).sn = sn;
}
public void setCn(String cn) {
((InetOrgPerson)instance).cn = cn;
}
}
public static void main(String[] args) {
InetOrgPerson.Essence p = new InetOrgPerson.Essence();
p.setSn("Scobbie");
InetOrgPerson immutablePerson = (InetOrgPerson)p.createUserDetails();
System.out.println(immutablePerson.getSn());
}
}
Loading…
Cancel
Save