01: package migration.modules.ldap;
02:
03: import java.util.HashMap;
04: import java.util.Set;
05: import java.util.Iterator;
06:
07: // Simple class to encompass auth module mappings to classes.
08: // Extends map so that custom auth modules can be mapped.
09: public class AuthMap extends HashMap {
10:
11: public AuthMap() {
12: super ();
13: this .put("LDAP",
14: "com.sun.identity.authentication.modules.ldap.LDAP");
15: this .put("Unix",
16: "com.sun.identity.authentication.modules.unix.UNIX");
17: this .put("Cert",
18: "com.sun.identity.authentication.modules.cert.Cert");
19: this
20: .put("Application",
21: "com.sun.identity.authentication.modules.application.Application");
22: this
23: .put("Anonymous",
24: "com.sun.identity.authentication.modules.anonymous.Anonymous");
25: this
26: .put("Membership",
27: "com.sun.identity.authentication.modules.membership.Membership");
28: this
29: .put("RADIUS",
30: "com.sun.identity.authentication.modules.radius.RADIUS");
31: this
32: .put("SafeWord",
33: "com.sun.identity.authentication.modules.safeword.SafeWord");
34: }
35:
36: // This constructor calls the base constructor as well as parses
37: // a PS 3.0 domain ldif dump for further custom modules
38: public AuthMap(String domainFile) {
39: this ();
40: }
41:
42: // Assume all objects in the keyset can be cast to String. Searches thru
43: // the keys performing an equalsIgnoreCase on key until match is found.
44: public boolean containsKeyIgnoreCase(String key) {
45: Set keys = this .keySet();
46: for (Iterator iter = keys.iterator(); iter.hasNext();) {
47: if (key.equalsIgnoreCase((String) iter.next()))
48: return true;
49: }
50: return false;
51: }
52:
53: // Assume all objects in the keyset can be cast to String. Searches thru
54: // the keys performing an equalsIgnoreCase on key until match is found.
55: // Then returns a get on the matching object.
56: public Object getIgnoreCase(String key) {
57: Set keys = this .keySet();
58: for (Iterator iter = keys.iterator(); iter.hasNext();) {
59: String realKey = (String) iter.next();
60: if (key.equalsIgnoreCase(realKey))
61: return this.get(realKey);
62: }
63: return null;
64: }
65:
66: }
|