提交 0ba2e05f 编写于 作者: S smarks

7008728: diamond conversion of basic security, permissions, authentication

Reviewed-by: mullan
上级 5fa67826
...@@ -1180,7 +1180,7 @@ public class PolicyFile extends javax.security.auth.Policy { ...@@ -1180,7 +1180,7 @@ public class PolicyFile extends javax.security.auth.Policy {
// Done // Done
return certs; return certs;
ArrayList<Certificate> userCertList = new ArrayList<Certificate>(); ArrayList<Certificate> userCertList = new ArrayList<>();
i = 0; i = 0;
while (i < certs.length) { while (i < certs.length) {
userCertList.add(certs[i]); userCertList.add(certs[i]);
......
...@@ -99,10 +99,10 @@ public class DialogCallbackHandler implements CallbackHandler { ...@@ -99,10 +99,10 @@ public class DialogCallbackHandler implements CallbackHandler {
throws UnsupportedCallbackException throws UnsupportedCallbackException
{ {
/* Collect messages to display in the dialog */ /* Collect messages to display in the dialog */
final List<Object> messages = new ArrayList<Object>(3); final List<Object> messages = new ArrayList<>(3);
/* Collection actions to perform if the user clicks OK */ /* Collection actions to perform if the user clicks OK */
final List<Action> okActions = new ArrayList<Action>(2); final List<Action> okActions = new ArrayList<>(2);
ConfirmationInfo confirmation = new ConfirmationInfo(); ConfirmationInfo confirmation = new ConfirmationInfo();
......
...@@ -152,7 +152,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration { ...@@ -152,7 +152,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
// new configuration // new configuration
HashMap<String, LinkedList<AppConfigurationEntry>> newConfig = HashMap<String, LinkedList<AppConfigurationEntry>> newConfig =
new HashMap<String, LinkedList<AppConfigurationEntry>>(); new HashMap<>();
if (url != null) { if (url != null) {
...@@ -392,8 +392,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration { ...@@ -392,8 +392,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
String moduleClass; String moduleClass;
String sflag; String sflag;
AppConfigurationEntry.LoginModuleControlFlag controlFlag; AppConfigurationEntry.LoginModuleControlFlag controlFlag;
LinkedList<AppConfigurationEntry> configEntries = LinkedList<AppConfigurationEntry> configEntries = new LinkedList<>();
new LinkedList<AppConfigurationEntry>();
// application name // application name
appName = st.sval; appName = st.sval;
...@@ -433,7 +432,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration { ...@@ -433,7 +432,7 @@ public class ConfigFile extends javax.security.auth.login.Configuration {
} }
// get the args // get the args
HashMap<String, String> options = new HashMap<String, String>(); HashMap<String, String> options = new HashMap<>();
String key; String key;
String value; String value;
while (peek(";") == false) { while (peek(";") == false) {
......
...@@ -184,7 +184,7 @@ public class JndiLoginModule implements LoginModule { ...@@ -184,7 +184,7 @@ public class JndiLoginModule implements LoginModule {
private UnixNumericUserPrincipal UIDPrincipal; private UnixNumericUserPrincipal UIDPrincipal;
private UnixNumericGroupPrincipal GIDPrincipal; private UnixNumericGroupPrincipal GIDPrincipal;
private LinkedList<UnixNumericGroupPrincipal> supplementaryGroups = private LinkedList<UnixNumericGroupPrincipal> supplementaryGroups =
new LinkedList<UnixNumericGroupPrincipal>(); new LinkedList<>();
// initial state // initial state
private Subject subject; private Subject subject;
......
...@@ -658,8 +658,7 @@ public class KeyStoreLoginModule implements LoginModule { ...@@ -658,8 +658,7 @@ public class KeyStoreLoginModule implements LoginModule {
throw new FailedLoginException( throw new FailedLoginException(
"Unable to find X.509 certificate chain in keystore"); "Unable to find X.509 certificate chain in keystore");
} else { } else {
LinkedList<Certificate> certList = LinkedList<Certificate> certList = new LinkedList<>();
new LinkedList<Certificate>();
for (int i=0; i < fromKeyStore.length; i++) { for (int i=0; i < fromKeyStore.length; i++) {
certList.add(fromKeyStore[i]); certList.add(fromKeyStore[i]);
} }
......
...@@ -76,7 +76,7 @@ public class SolarisLoginModule implements LoginModule { ...@@ -76,7 +76,7 @@ public class SolarisLoginModule implements LoginModule {
private SolarisNumericUserPrincipal UIDPrincipal; private SolarisNumericUserPrincipal UIDPrincipal;
private SolarisNumericGroupPrincipal GIDPrincipal; private SolarisNumericGroupPrincipal GIDPrincipal;
private LinkedList<SolarisNumericGroupPrincipal> supplementaryGroups = private LinkedList<SolarisNumericGroupPrincipal> supplementaryGroups =
new LinkedList<SolarisNumericGroupPrincipal>(); new LinkedList<>();
/** /**
* Initialize this <code>LoginModule</code>. * Initialize this <code>LoginModule</code>.
......
...@@ -70,7 +70,7 @@ public class UnixLoginModule implements LoginModule { ...@@ -70,7 +70,7 @@ public class UnixLoginModule implements LoginModule {
private UnixNumericUserPrincipal UIDPrincipal; private UnixNumericUserPrincipal UIDPrincipal;
private UnixNumericGroupPrincipal GIDPrincipal; private UnixNumericGroupPrincipal GIDPrincipal;
private LinkedList<UnixNumericGroupPrincipal> supplementaryGroups = private LinkedList<UnixNumericGroupPrincipal> supplementaryGroups =
new LinkedList<UnixNumericGroupPrincipal>(); new LinkedList<>();
/** /**
* Initialize this <code>LoginModule</code>. * Initialize this <code>LoginModule</code>.
......
...@@ -121,7 +121,7 @@ public final class AccessControlContext { ...@@ -121,7 +121,7 @@ public final class AccessControlContext {
this.context = null; this.context = null;
} }
} else { } else {
List<ProtectionDomain> v = new ArrayList<ProtectionDomain>(context.length); List<ProtectionDomain> v = new ArrayList<>(context.length);
for (int i =0; i< context.length; i++) { for (int i =0; i< context.length; i++) {
if ((context[i] != null) && (!v.contains(context[i]))) if ((context[i] != null) && (!v.contains(context[i])))
v.add(context[i]); v.add(context[i]);
......
...@@ -515,7 +515,7 @@ implements java.io.Serializable ...@@ -515,7 +515,7 @@ implements java.io.Serializable
// Copy perms into a Hashtable // Copy perms into a Hashtable
Hashtable<String, Permission> permissions = Hashtable<String, Permission> permissions =
new Hashtable<String, Permission>(perms.size()*2); new Hashtable<>(perms.size()*2);
synchronized (this) { synchronized (this) {
permissions.putAll(perms); permissions.putAll(perms);
......
...@@ -188,7 +188,7 @@ public class CodeSource implements java.io.Serializable { ...@@ -188,7 +188,7 @@ public class CodeSource implements java.io.Serializable {
} else if (signers != null) { } else if (signers != null) {
// Convert the code signers to certs // Convert the code signers to certs
ArrayList<java.security.cert.Certificate> certChains = ArrayList<java.security.cert.Certificate> certChains =
new ArrayList<java.security.cert.Certificate>(); new ArrayList<>();
for (int i = 0; i < signers.length; i++) { for (int i = 0; i < signers.length; i++) {
certChains.addAll( certChains.addAll(
signers[i].getSignerCertPath().getCertificates()); signers[i].getSignerCertPath().getCertificates());
...@@ -606,10 +606,10 @@ public class CodeSource implements java.io.Serializable { ...@@ -606,10 +606,10 @@ public class CodeSource implements java.io.Serializable {
// Iterate through all the certificates // Iterate through all the certificates
int i = 0; int i = 0;
List<CodeSigner> signers = new ArrayList<CodeSigner>(); List<CodeSigner> signers = new ArrayList<>();
while (i < certs.length) { while (i < certs.length) {
List<java.security.cert.Certificate> certChain = List<java.security.cert.Certificate> certChain =
new ArrayList<java.security.cert.Certificate>(); new ArrayList<>();
certChain.add(certs[i++]); // first cert is an end-entity cert certChain.add(certs[i++]); // first cert is an end-entity cert
int j = i; int j = i;
......
...@@ -362,7 +362,7 @@ implements Serializable ...@@ -362,7 +362,7 @@ implements Serializable
// Copy perms into a Hashtable // Copy perms into a Hashtable
Hashtable<Class<?>, PermissionCollection> perms = Hashtable<Class<?>, PermissionCollection> perms =
new Hashtable<Class<?>, PermissionCollection>(permsMap.size()*2); // no sync; estimate new Hashtable<>(permsMap.size()*2); // no sync; estimate
synchronized (this) { synchronized (this) {
perms.putAll(permsMap); perms.putAll(permsMap);
} }
...@@ -567,7 +567,7 @@ implements Serializable ...@@ -567,7 +567,7 @@ implements Serializable
// Copy perms into a Hashtable // Copy perms into a Hashtable
Hashtable<Permission, Permission> perms = Hashtable<Permission, Permission> perms =
new Hashtable<Permission, Permission>(permsMap.size()*2); new Hashtable<>(permsMap.size()*2);
synchronized (this) { synchronized (this) {
perms.putAll(permsMap); perms.putAll(permsMap);
} }
......
...@@ -336,8 +336,8 @@ public class ProtectionDomain { ...@@ -336,8 +336,8 @@ public class ProtectionDomain {
int swag = 32; int swag = 32;
int vcap = 8; int vcap = 8;
Enumeration<Permission> e; Enumeration<Permission> e;
List<Permission> pdVector = new ArrayList<Permission>(vcap); List<Permission> pdVector = new ArrayList<>(vcap);
List<Permission> plVector = new ArrayList<Permission>(swag); List<Permission> plVector = new ArrayList<>(swag);
// //
// Build a vector of domain permissions for subsequent merge // Build a vector of domain permissions for subsequent merge
......
...@@ -437,7 +437,7 @@ public abstract class Provider extends Properties { ...@@ -437,7 +437,7 @@ public abstract class Provider extends Properties {
private void readObject(ObjectInputStream in) private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException { throws IOException, ClassNotFoundException {
Map<Object,Object> copy = new HashMap<Object,Object>(); Map<Object,Object> copy = new HashMap<>();
for (Map.Entry<Object,Object> entry : super.entrySet()) { for (Map.Entry<Object,Object> entry : super.entrySet()) {
copy.put(entry.getKey(), entry.getValue()); copy.put(entry.getKey(), entry.getValue());
} }
...@@ -719,7 +719,7 @@ public abstract class Provider extends Properties { ...@@ -719,7 +719,7 @@ public abstract class Provider extends Properties {
} }
if (serviceSet == null) { if (serviceSet == null) {
ensureLegacyParsed(); ensureLegacyParsed();
Set<Service> set = new LinkedHashSet<Service>(); Set<Service> set = new LinkedHashSet<>();
if (serviceMap != null) { if (serviceMap != null) {
set.addAll(serviceMap.values()); set.addAll(serviceMap.values());
} }
...@@ -1395,7 +1395,7 @@ public abstract class Provider extends Properties { ...@@ -1395,7 +1395,7 @@ public abstract class Provider extends Properties {
if (s != null) { if (s != null) {
String[] classNames = s.split("\\|"); String[] classNames = s.split("\\|");
List<Class> classList = List<Class> classList =
new ArrayList<Class>(classNames.length); new ArrayList<>(classNames.length);
for (String className : classNames) { for (String className : classNames) {
Class clazz = getKeyClass(className); Class clazz = getKeyClass(className);
if (clazz != null) { if (clazz != null) {
......
...@@ -50,7 +50,7 @@ public class SecureClassLoader extends ClassLoader { ...@@ -50,7 +50,7 @@ public class SecureClassLoader extends ClassLoader {
// HashMap that maps CodeSource to ProtectionDomain // HashMap that maps CodeSource to ProtectionDomain
// @GuardedBy("pdcache") // @GuardedBy("pdcache")
private final HashMap<CodeSource, ProtectionDomain> pdcache = private final HashMap<CodeSource, ProtectionDomain> pdcache =
new HashMap<CodeSource, ProtectionDomain>(11); new HashMap<>(11);
private static final Debug debug = Debug.getInstance("scl"); private static final Debug debug = Debug.getInstance("scl");
......
...@@ -545,8 +545,7 @@ public final class Security { ...@@ -545,8 +545,7 @@ public final class Security {
value = filter.substring(index + 1); value = filter.substring(index + 1);
} }
Hashtable<String, String> hashtableFilter = Hashtable<String, String> hashtableFilter = new Hashtable<>(1);
new Hashtable<String, String>(1);
hashtableFilter.put(key, value); hashtableFilter.put(key, value);
return (getProviders(hashtableFilter)); return (getProviders(hashtableFilter));
...@@ -606,7 +605,7 @@ public final class Security { ...@@ -606,7 +605,7 @@ public final class Security {
// Then only return those providers who satisfy the selection criteria. // Then only return those providers who satisfy the selection criteria.
Provider[] allProviders = Security.getProviders(); Provider[] allProviders = Security.getProviders();
Set<String> keySet = filter.keySet(); Set<String> keySet = filter.keySet();
LinkedHashSet<Provider> candidates = new LinkedHashSet<Provider>(5); LinkedHashSet<Provider> candidates = new LinkedHashSet<>(5);
// Returns all installed providers // Returns all installed providers
// if the selection criteria is null. // if the selection criteria is null.
...@@ -660,8 +659,7 @@ public final class Security { ...@@ -660,8 +659,7 @@ public final class Security {
} }
// Map containing cached Spi Class objects of the specified type // Map containing cached Spi Class objects of the specified type
private static final Map<String,Class> spiMap = private static final Map<String,Class> spiMap = new ConcurrentHashMap<>();
new ConcurrentHashMap<String,Class>();
/** /**
* Return the Class object for the given engine type * Return the Class object for the given engine type
...@@ -885,7 +883,7 @@ public final class Security { ...@@ -885,7 +883,7 @@ public final class Security {
String attrName, String attrName,
String filterValue, String filterValue,
Provider[] allProviders) { Provider[] allProviders) {
LinkedHashSet<Provider> candidates = new LinkedHashSet<Provider>(5); LinkedHashSet<Provider> candidates = new LinkedHashSet<>(5);
for (int i = 0; i < allProviders.length; i++) { for (int i = 0; i < allProviders.length; i++) {
if (isCriterionSatisfied(allProviders[i], serviceName, if (isCriterionSatisfied(allProviders[i], serviceName,
algName, algName,
...@@ -1082,7 +1080,7 @@ public final class Security { ...@@ -1082,7 +1080,7 @@ public final class Security {
return Collections.EMPTY_SET; return Collections.EMPTY_SET;
} }
HashSet<String> result = new HashSet<String>(); HashSet<String> result = new HashSet<>();
Provider[] providers = Security.getProviders(); Provider[] providers = Security.getProviders();
for (int i = 0; i < providers.length; i++) { for (int i = 0; i < providers.length; i++) {
......
...@@ -198,7 +198,7 @@ implements java.io.Serializable ...@@ -198,7 +198,7 @@ implements java.io.Serializable
if (this.certs == null) { if (this.certs == null) {
// extract the signer certs // extract the signer certs
ArrayList<java.security.cert.Certificate> signerCerts = ArrayList<java.security.cert.Certificate> signerCerts =
new ArrayList<java.security.cert.Certificate>(); new ArrayList<>();
i = 0; i = 0;
while (i < certs.length) { while (i < certs.length) {
signerCerts.add(certs[i]); signerCerts.add(certs[i]);
......
...@@ -119,7 +119,7 @@ implements java.io.Serializable ...@@ -119,7 +119,7 @@ implements java.io.Serializable
public Enumeration<Permission> elements() { public Enumeration<Permission> elements() {
List<Permission> results = List<Permission> results =
new ArrayList<Permission>(); // where results are stored new ArrayList<>(); // where results are stored
// Get iterator of Map values (which are lists of permissions) // Get iterator of Map values (which are lists of permissions)
synchronized (this) { synchronized (this) {
...@@ -161,7 +161,7 @@ implements java.io.Serializable ...@@ -161,7 +161,7 @@ implements java.io.Serializable
// Copy perms into a Hashtable // Copy perms into a Hashtable
Hashtable<String, Vector<UnresolvedPermission>> permissions = Hashtable<String, Vector<UnresolvedPermission>> permissions =
new Hashtable<String, Vector<UnresolvedPermission>>(perms.size()*2); new Hashtable<>(perms.size()*2);
// Convert each entry (List) into a Vector // Convert each entry (List) into a Vector
synchronized (this) { synchronized (this) {
...@@ -169,8 +169,7 @@ implements java.io.Serializable ...@@ -169,8 +169,7 @@ implements java.io.Serializable
for (Map.Entry<String, List<UnresolvedPermission>> e : set) { for (Map.Entry<String, List<UnresolvedPermission>> e : set) {
// Convert list into Vector // Convert list into Vector
List<UnresolvedPermission> list = e.getValue(); List<UnresolvedPermission> list = e.getValue();
Vector<UnresolvedPermission> vec = Vector<UnresolvedPermission> vec = new Vector<>(list.size());
new Vector<UnresolvedPermission>(list.size());
synchronized (list) { synchronized (list) {
vec.addAll(list); vec.addAll(list);
} }
...@@ -207,8 +206,7 @@ implements java.io.Serializable ...@@ -207,8 +206,7 @@ implements java.io.Serializable
for (Map.Entry<String, Vector<UnresolvedPermission>> e : set) { for (Map.Entry<String, Vector<UnresolvedPermission>> e : set) {
// Convert Vector into ArrayList // Convert Vector into ArrayList
Vector<UnresolvedPermission> vec = e.getValue(); Vector<UnresolvedPermission> vec = e.getValue();
List<UnresolvedPermission> list = List<UnresolvedPermission> list = new ArrayList<>(vec.size());
new ArrayList<UnresolvedPermission>(vec.size());
list.addAll(vec); list.addAll(vec);
// Add to Hashtable being serialized // Add to Hashtable being serialized
......
...@@ -329,7 +329,7 @@ public final class PrivateCredentialPermission extends Permission { ...@@ -329,7 +329,7 @@ public final class PrivateCredentialPermission extends Permission {
throw new IllegalArgumentException("invalid empty name"); throw new IllegalArgumentException("invalid empty name");
} }
ArrayList<CredOwner> pList = new ArrayList<CredOwner>(); ArrayList<CredOwner> pList = new ArrayList<>();
StringTokenizer tokenizer = new StringTokenizer(name, " ", true); StringTokenizer tokenizer = new StringTokenizer(name, " ", true);
String principalClass = null; String principalClass = null;
String principalName = null; String principalName = null;
......
...@@ -48,7 +48,7 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner { ...@@ -48,7 +48,7 @@ public class SubjectDomainCombiner implements java.security.DomainCombiner {
private Subject subject; private Subject subject;
private WeakKeyValueMap<ProtectionDomain, ProtectionDomain> cachedPDs = private WeakKeyValueMap<ProtectionDomain, ProtectionDomain> cachedPDs =
new WeakKeyValueMap<ProtectionDomain, ProtectionDomain>(); new WeakKeyValueMap<>();
private Set<Principal> principalSet; private Set<Principal> principalSet;
private Principal[] principals; private Principal[] principals;
......
...@@ -361,7 +361,7 @@ final class KrbDelegationPermissionCollection extends PermissionCollection ...@@ -361,7 +361,7 @@ final class KrbDelegationPermissionCollection extends PermissionCollection
// Don't call out.defaultWriteObject() // Don't call out.defaultWriteObject()
// Write out Vector // Write out Vector
Vector<Permission> permissions = new Vector<Permission>(perms.size()); Vector<Permission> permissions = new Vector<>(perms.size());
synchronized (this) { synchronized (this) {
permissions.addAll(perms); permissions.addAll(perms);
......
...@@ -569,7 +569,7 @@ final class KrbServicePermissionCollection extends PermissionCollection ...@@ -569,7 +569,7 @@ final class KrbServicePermissionCollection extends PermissionCollection
// Don't call out.defaultWriteObject() // Don't call out.defaultWriteObject()
// Write out Vector // Write out Vector
Vector<Permission> permissions = new Vector<Permission>(perms.size()); Vector<Permission> permissions = new Vector<>(perms.size());
synchronized (this) { synchronized (this) {
permissions.addAll(perms); permissions.addAll(perms);
......
...@@ -37,7 +37,7 @@ import java.security.acl.*; ...@@ -37,7 +37,7 @@ import java.security.acl.*;
*/ */
public class AclEntryImpl implements AclEntry { public class AclEntryImpl implements AclEntry {
private Principal user = null; private Principal user = null;
private Vector<Permission> permissionSet = new Vector<Permission>(10, 10); private Vector<Permission> permissionSet = new Vector<>(10, 10);
private boolean negative = false; private boolean negative = false;
/** /**
......
...@@ -41,15 +41,15 @@ public class AclImpl extends OwnerImpl implements Acl { ...@@ -41,15 +41,15 @@ public class AclImpl extends OwnerImpl implements Acl {
// or principal. // or principal.
// //
private Hashtable<Principal, AclEntry> allowedUsersTable = private Hashtable<Principal, AclEntry> allowedUsersTable =
new Hashtable<Principal, AclEntry>(23); new Hashtable<>(23);
private Hashtable<Principal, AclEntry> allowedGroupsTable = private Hashtable<Principal, AclEntry> allowedGroupsTable =
new Hashtable<Principal, AclEntry>(23); new Hashtable<>(23);
private Hashtable<Principal, AclEntry> deniedUsersTable = private Hashtable<Principal, AclEntry> deniedUsersTable =
new Hashtable<Principal, AclEntry>(23); new Hashtable<>(23);
private Hashtable<Principal, AclEntry> deniedGroupsTable = private Hashtable<Principal, AclEntry> deniedGroupsTable =
new Hashtable<Principal, AclEntry>(23); new Hashtable<>(23);
private String aclName = null; private String aclName = null;
private Vector<Permission> zeroSet = new Vector<Permission>(1,1); private Vector<Permission> zeroSet = new Vector<>(1,1);
/** /**
...@@ -294,7 +294,7 @@ public class AclImpl extends OwnerImpl implements Acl { ...@@ -294,7 +294,7 @@ public class AclImpl extends OwnerImpl implements Acl {
// //
private static Enumeration<Permission> union(Enumeration<Permission> e1, private static Enumeration<Permission> union(Enumeration<Permission> e1,
Enumeration<Permission> e2) { Enumeration<Permission> e2) {
Vector<Permission> v = new Vector<Permission>(20, 20); Vector<Permission> v = new Vector<>(20, 20);
while (e1.hasMoreElements()) while (e1.hasMoreElements())
v.addElement(e1.nextElement()); v.addElement(e1.nextElement());
...@@ -313,7 +313,7 @@ public class AclImpl extends OwnerImpl implements Acl { ...@@ -313,7 +313,7 @@ public class AclImpl extends OwnerImpl implements Acl {
// //
private Enumeration<Permission> subtract(Enumeration<Permission> e1, private Enumeration<Permission> subtract(Enumeration<Permission> e1,
Enumeration<Permission> e2) { Enumeration<Permission> e2) {
Vector<Permission> v = new Vector<Permission>(20, 20); Vector<Permission> v = new Vector<>(20, 20);
while (e1.hasMoreElements()) while (e1.hasMoreElements())
v.addElement(e1.nextElement()); v.addElement(e1.nextElement());
......
...@@ -34,7 +34,7 @@ import java.security.acl.*; ...@@ -34,7 +34,7 @@ import java.security.acl.*;
* @author Satish Dharmaraj * @author Satish Dharmaraj
*/ */
public class GroupImpl implements Group { public class GroupImpl implements Group {
private Vector<Principal> groupMembers = new Vector<Principal>(50, 100); private Vector<Principal> groupMembers = new Vector<>(50, 100);
private String group; private String group;
/** /**
...@@ -131,7 +131,7 @@ public class GroupImpl implements Group { ...@@ -131,7 +131,7 @@ public class GroupImpl implements Group {
if (groupMembers.contains(member)) { if (groupMembers.contains(member)) {
return true; return true;
} else { } else {
Vector<Group> alreadySeen = new Vector<Group>(10); Vector<Group> alreadySeen = new Vector<>(10);
return isMemberRecurse(member, alreadySeen); return isMemberRecurse(member, alreadySeen);
} }
} }
......
...@@ -178,7 +178,7 @@ class SearchFirstMode extends LdapConfiguration { ...@@ -178,7 +178,7 @@ class SearchFirstMode extends LdapConfiguration {
public SearchFirstMode() { public SearchFirstMode() {
super(); super();
Map<String, String> options = new HashMap<String, String>(4); Map<String, String> options = new HashMap<>(4);
options.put("userProvider", "ldap://localhost:23456/dc=example,dc=com"); options.put("userProvider", "ldap://localhost:23456/dc=example,dc=com");
options.put("userFilter", options.put("userFilter",
"(&(uid={USERNAME})(objectClass=inetOrgPerson))"); "(&(uid={USERNAME})(objectClass=inetOrgPerson))");
...@@ -213,7 +213,7 @@ class AuthFirstMode extends LdapConfiguration { ...@@ -213,7 +213,7 @@ class AuthFirstMode extends LdapConfiguration {
public AuthFirstMode() { public AuthFirstMode() {
super(); super();
Map<String, String> options = new HashMap<String, String>(5); Map<String, String> options = new HashMap<>(5);
options.put("userProvider", "ldap://localhost:23456/dc=example,dc=com"); options.put("userProvider", "ldap://localhost:23456/dc=example,dc=com");
options.put("authIdentity", "{USERNAME}"); options.put("authIdentity", "{USERNAME}");
options.put("userFilter", options.put("userFilter",
...@@ -248,7 +248,7 @@ class AuthOnlyMode extends LdapConfiguration { ...@@ -248,7 +248,7 @@ class AuthOnlyMode extends LdapConfiguration {
public AuthOnlyMode() { public AuthOnlyMode() {
super(); super();
Map<String, String> options = new HashMap<String, String>(4); Map<String, String> options = new HashMap<>(4);
options.put("userProvider", options.put("userProvider",
"ldap://localhost:23456 ldap://localhost:23457"); "ldap://localhost:23456 ldap://localhost:23457");
options.put("authIdentity", options.put("authIdentity",
......
...@@ -73,7 +73,7 @@ public class CheckOptions { ...@@ -73,7 +73,7 @@ public class CheckOptions {
// bad value for userProvider option // bad value for userProvider option
Map<String, String> options = new HashMap<String, String>(); Map<String, String> options = new HashMap<>();
options.put(USER_PROVIDER_OPTION, "ldap://localhost:23456"); options.put(USER_PROVIDER_OPTION, "ldap://localhost:23456");
ldap.initialize(subject, null, null, options); ldap.initialize(subject, null, null, options);
...@@ -93,7 +93,7 @@ public class CheckOptions { ...@@ -93,7 +93,7 @@ public class CheckOptions {
LdapLoginModule ldap = new LdapLoginModule(); LdapLoginModule ldap = new LdapLoginModule();
Subject subject = new Subject(); Subject subject = new Subject();
Map<String, String> options = new HashMap<String, String>(); Map<String, String> options = new HashMap<>();
ldap.initialize(subject, null, null, options); ldap.initialize(subject, null, null, options);
try { try {
...@@ -110,7 +110,7 @@ public class CheckOptions { ...@@ -110,7 +110,7 @@ public class CheckOptions {
LdapLoginModule ldap = new LdapLoginModule(); LdapLoginModule ldap = new LdapLoginModule();
Subject subject = new Subject(); Subject subject = new Subject();
Map<String, String> options = new HashMap<String, String>(); Map<String, String> options = new HashMap<>();
CallbackHandler goodHandler = new MyCallbackHandler(true); CallbackHandler goodHandler = new MyCallbackHandler(true);
ldap.initialize(subject, goodHandler, null, options); ldap.initialize(subject, goodHandler, null, options);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册