| | |
| | | // If we've gotten here, then the authentication was successful. |
| | | bindOperation.setResultCode(ResultCode.SUCCESS); |
| | | |
| | | AuthenticationInfo authInfo = |
| | | new AuthenticationInfo(userEntry, SASL_MECHANISM_CRAM_MD5, |
| | | clientCredentials, |
| | | DirectoryServer.isRootDN(userEntry.getDN())); |
| | | AuthenticationInfo authInfo = new AuthenticationInfo(userEntry, |
| | | SASL_MECHANISM_CRAM_MD5, DirectoryServer.isRootDN(userEntry.getDN())); |
| | | bindOperation.setAuthenticationInfo(authInfo); |
| | | return; |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | import org.opends.messages.Message; |
| | | |
| | | |
| | | |
| | | import java.security.cert.Certificate; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.admin.server.ConfigurationChangeListener; |
| | | import org.opends.server.admin.std.server.ExternalSASLMechanismHandlerCfg; |
| | | import org.opends.server.admin.std.server.SASLMechanismHandlerCfg; |
| | |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.core.BindOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.protocols.ldap.LDAPClientConnection; |
| | | import org.opends.server.types.*; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class provides an implementation of a SASL mechanism that relies on some |
| | | * form of authentication that has already been done outside the LDAP layer. At |
| | |
| | | } |
| | | |
| | | |
| | | AuthenticationInfo authInfo = |
| | | new AuthenticationInfo(userEntry, SASL_MECHANISM_EXTERNAL, |
| | | bindOperation.getSASLCredentials(), |
| | | DirectoryServer.isRootDN(userEntry.getDN())); |
| | | AuthenticationInfo authInfo = new AuthenticationInfo(userEntry, |
| | | SASL_MECHANISM_EXTERNAL, DirectoryServer.isRootDN(userEntry.getDN())); |
| | | bindOperation.setAuthenticationInfo(authInfo); |
| | | bindOperation.setResultCode(ResultCode.SUCCESS); |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.protocols.http; |
| | | |
| | | import static org.forgerock.opendj.adapter.server2x.Converters.*; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | import static org.opends.server.loggers.ErrorLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | |
| | | import java.text.ParseException; |
| | | import java.util.Collection; |
| | | |
| | | import javax.servlet.AsyncContext; |
| | | import javax.servlet.FilterChain; |
| | | import javax.servlet.FilterConfig; |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.ServletRequest; |
| | | import javax.servlet.ServletResponse; |
| | | import javax.servlet.*; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpServletResponseWrapper; |
| | | |
| | | import org.forgerock.json.resource.ResourceException; |
| | | import org.forgerock.opendj.ldap.Connection; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ErrorResultException; |
| | | import org.forgerock.opendj.ldap.*; |
| | | import org.forgerock.opendj.ldap.Filter; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.ResultHandler; |
| | | import org.forgerock.opendj.ldap.requests.BindRequest; |
| | | import org.forgerock.opendj.ldap.requests.Requests; |
| | | import org.forgerock.opendj.ldap.requests.SearchRequest; |
| | |
| | | import org.opends.server.schema.SchemaConstants; |
| | | import org.opends.server.types.AddressMask; |
| | | import org.opends.server.types.AuthenticationInfo; |
| | | import org.opends.server.types.ByteString; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import org.opends.server.types.DisconnectReason; |
| | | import org.opends.server.util.Base64; |
| | | |
| | | import static org.forgerock.opendj.adapter.server2x.Converters.*; |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.loggers.AccessLogger.*; |
| | | import static org.opends.server.loggers.ErrorLogger.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | /** |
| | | * Servlet {@link Filter} that collects information about client connections. |
| | | */ |
| | |
| | | private boolean prettyPrint; |
| | | /** Used for the bind request when credentials are specified. */ |
| | | private String userName; |
| | | /** Used for the bind request when credentials are specified. */ |
| | | /** |
| | | * Used for the bind request when credentials are specified. For security |
| | | * reasons, the password must be discarded as soon as possible after it's |
| | | * been used. |
| | | */ |
| | | private String password; |
| | | } |
| | | |
| | |
| | | final BindRequest bindRequest = |
| | | Requests.newSimpleBindRequest(bindDN.toString(), ctx.password |
| | | .getBytes(Charset.forName("UTF-8"))); |
| | | // We are done with the password at this stage, |
| | | // wipe it from memory for security reasons |
| | | ctx.password = null; |
| | | ctx.connection.bindAsync(bindRequest, null, |
| | | new CallDoFilterResultHandler(ctx, resultEntry)); |
| | | } |
| | |
| | | { |
| | | ctx.clientConnection.setAuthUser(ctx.userName); |
| | | |
| | | final AuthenticationInfo authInfo = |
| | | new AuthenticationInfo(to(resultEntry), to(resultEntry.getName()), |
| | | ByteString.valueOf(ctx.password), false); |
| | | final AuthenticationInfo authInfo = new AuthenticationInfo( |
| | | to(resultEntry), to(resultEntry.getName()), false); |
| | | try |
| | | { |
| | | doFilter(ctx, authInfo); |
| | |
| | | // TODO Use session to reduce hits with search + bind? |
| | | // Use proxied authorization control for session. |
| | | |
| | | // Security: How can we remove the password held in the request headers? |
| | | if (authConfig.isCustomHeadersAuthenticationSupported()) |
| | | { |
| | | final String userName = |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | | import static org.opends.server.util.Validator.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a data structure that may be used to store |
| | | * information about an authenticated user. Note that structures in |
| | |
| | | mayInvoke=true) |
| | | public final class AuthenticationInfo |
| | | { |
| | | // The password used to authenticate using simple authentication. |
| | | private ByteString simplePassword; |
| | | |
| | | // Indicates whether this connection is currently authenticated. |
| | | /** Indicates whether this connection is currently authenticated. */ |
| | | private boolean isAuthenticated; |
| | | |
| | | // Indicates whether this connection is authenticated as a root |
| | | // user. |
| | | /** Indicates whether this connection is authenticated as a root user. */ |
| | | private boolean isRoot; |
| | | |
| | | // Indicates whether the user's password must be changed before any |
| | | // other operation will be allowed. |
| | | /** |
| | | * Indicates whether the user's password must be changed before any other |
| | | * operation will be allowed. |
| | | */ |
| | | private boolean mustChangePassword; |
| | | |
| | | // The entry of the user that is currently authenticated. |
| | | /** The entry of the user that is currently authenticated. */ |
| | | private Entry authenticationEntry; |
| | | |
| | | // The entry of the user that will be used as the default |
| | | // authorization identity. |
| | | /** |
| | | * The entry of the user that will be used as the default authorization |
| | | * identity. |
| | | */ |
| | | private Entry authorizationEntry; |
| | | |
| | | // The type of authentication performed on this connection. |
| | | /** The type of authentication performed on this connection. */ |
| | | private AuthenticationType authenticationType; |
| | | |
| | | // The SASL mechanism used to authenticate. |
| | | /** The SASL mechanism used to authenticate. */ |
| | | private String saslMechanism; |
| | | |
| | | // The bind DN used to authenticate using simple authentication. |
| | | /** The bind DN used to authenticate using simple authentication. */ |
| | | private DN simpleBindDN; |
| | | |
| | | // The SASL credentials used to authenticate. |
| | | private ByteString saslCredentials; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new set of authentication information to be used for |
| | | * unauthenticated clients. |
| | |
| | | isAuthenticated = false; |
| | | isRoot = false; |
| | | mustChangePassword = false; |
| | | simplePassword = null; |
| | | authenticationType = null; |
| | | authenticationEntry = null; |
| | | authorizationEntry = null; |
| | | simpleBindDN = null; |
| | | saslCredentials = null; |
| | | saslMechanism = null; |
| | | } |
| | | |
| | |
| | | mustChangePassword = false; |
| | | simpleBindDN = authenticationEntry != null ? |
| | | authenticationEntry.getDN() : null; |
| | | simplePassword = null; |
| | | authorizationEntry = authenticationEntry; |
| | | saslMechanism = null; |
| | | saslCredentials = null; |
| | | authenticationType = AuthenticationType.INTERNAL; |
| | | } |
| | | |
| | |
| | | * {@code null}. |
| | | * @param simpleBindDN The bind DN that was used to |
| | | * perform the simple authentication. |
| | | * @param simplePassword The password that was used to |
| | | * perform the simple authentication. |
| | | * It must not be {@code null}. |
| | | * @param isRoot Indicates whether the authenticated |
| | | */ |
| | | public AuthenticationInfo(Entry authenticationEntry, |
| | | DN simpleBindDN, |
| | | ByteString simplePassword, boolean isRoot) |
| | | public AuthenticationInfo(Entry authenticationEntry, DN simpleBindDN, |
| | | boolean isRoot) |
| | | { |
| | | ensureNotNull(authenticationEntry, simplePassword); |
| | | ensureNotNull(authenticationEntry); |
| | | |
| | | this.authenticationEntry = authenticationEntry; |
| | | this.simpleBindDN = simpleBindDN; |
| | | this.simplePassword = simplePassword; |
| | | this.isRoot = isRoot; |
| | | |
| | | this.isAuthenticated = true; |
| | | this.mustChangePassword = false; |
| | | this.authorizationEntry = authenticationEntry; |
| | | this.saslMechanism = null; |
| | | this.saslCredentials = null; |
| | | this.authenticationType = AuthenticationType.SIMPLE; |
| | | } |
| | | |
| | |
| | | * authenticate. This must be provided |
| | | * in all-uppercase characters and must |
| | | * not be {@code null}. |
| | | * @param saslCredentials The SASL credentials used to |
| | | * authenticate. |
| | | * It must not be {@code null}. |
| | | * @param isRoot Indicates whether the authenticated |
| | | * user is a root user. |
| | | */ |
| | | public AuthenticationInfo(Entry authenticationEntry, |
| | | String saslMechanism, |
| | | ByteString saslCredentials, |
| | | boolean isRoot) |
| | | { |
| | | ensureNotNull(authenticationEntry, saslMechanism); |
| | |
| | | this.mustChangePassword = false; |
| | | this.authorizationEntry = authenticationEntry; |
| | | this.simpleBindDN = null; |
| | | this.simplePassword = null; |
| | | |
| | | this.authenticationType = AuthenticationType.SASL; |
| | | |
| | | this.saslMechanism = saslMechanism; |
| | | this.saslCredentials = saslCredentials; |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | this.isAuthenticated = true; |
| | | this.mustChangePassword = false; |
| | | this.simpleBindDN = null; |
| | | this.simplePassword = null; |
| | | |
| | | this.authenticationType = AuthenticationType.SASL; |
| | | |
| | | this.saslMechanism = saslMechanism; |
| | | this.saslCredentials = saslCredentials; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | public DN getAuthenticationDN() |
| | | { |
| | | if (authenticationEntry == null) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | if (authenticationEntry != null) |
| | | { |
| | | return authenticationEntry.getDN(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | public void setAuthenticationDN(DN dn) |
| | | { |
| | | if (authenticationEntry == null) |
| | | { |
| | | return; |
| | | } |
| | | else |
| | | if (authenticationEntry != null) |
| | | { |
| | | authenticationEntry.setDN(dn); |
| | | } |
| | |
| | | */ |
| | | public DN getAuthorizationDN() |
| | | { |
| | | if (authorizationEntry == null) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | if (authorizationEntry != null) |
| | | { |
| | | return authorizationEntry.getDN(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | public void setAuthorizationDN(DN dn) |
| | | { |
| | | if (authorizationEntry == null) |
| | | { |
| | | return; |
| | | } |
| | | else |
| | | if (authorizationEntry != null) |
| | | { |
| | | authorizationEntry.setDN(dn); |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the password that the client used for simple |
| | | * authentication. |
| | | * |
| | | * @return The password that the client used for simple |
| | | * authentication, or {@code null} if the client is not |
| | | * authenticated using simple authentication. |
| | | */ |
| | | public ByteString getSimplePassword() |
| | | { |
| | | return simplePassword; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the client is currently authenticated using the |
| | | * specified SASL mechanism. |
| | | * |
| | |
| | | return this.saslMechanism.equals(saslMechanism); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the SASL credentials that the client used for SASL |
| | | * authentication. |
| | | * |
| | | * @return The SASL credentials that the client used for SASL |
| | | * authentication, or {@code null} if the client is not |
| | | * authenticated using SASL authentication. |
| | | */ |
| | | public ByteString getSASLCredentials() |
| | | { |
| | | return saslCredentials; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves a string representation of this authentication info |
| | | * structure. |
| | |
| | | { |
| | | AuthenticationInfo authInfo = new AuthenticationInfo(); |
| | | |
| | | authInfo.simplePassword = simplePassword; |
| | | authInfo.isAuthenticated = isAuthenticated; |
| | | authInfo.isRoot = isRoot; |
| | | authInfo.mustChangePassword = mustChangePassword; |
| | |
| | | ERR_BIND_REJECTED_LOCKDOWN_MODE.get()); |
| | | } |
| | | setAuthenticationInfo(new AuthenticationInfo(userEntry, getBindDN(), |
| | | simplePassword, DirectoryServer.isRootDN(userEntry.getDN()))); |
| | | DirectoryServer.isRootDN(userEntry.getDN()))); |
| | | |
| | | // Set resource limits for the authenticated user. |
| | | setResourceLimits(userEntry); |
| | |
| | | ERR_BIND_REJECTED_LOCKDOWN_MODE.get()); |
| | | } |
| | | setAuthenticationInfo(new AuthenticationInfo(userEntry, getBindDN(), |
| | | simplePassword, DirectoryServer.isRootDN(userEntry.getDN()))); |
| | | DirectoryServer.isRootDN(userEntry.getDN()))); |
| | | |
| | | // Set resource limits for the authenticated user. |
| | | setResourceLimits(userEntry); |
| | |
| | | */ |
| | | package org.opends.server.core.networkgroups; |
| | | |
| | | |
| | | |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | | import java.util.Collection; |
| | |
| | | import org.opends.server.api.ConnectionHandler; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.types.AuthenticationInfo; |
| | | import org.opends.server.types.ByteString; |
| | | import org.opends.server.types.CancelRequest; |
| | | import org.opends.server.types.CancelResult; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.DisconnectReason; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.IntermediateResponse; |
| | | import org.opends.server.types.Operation; |
| | | import org.opends.server.types.SearchResultEntry; |
| | | import org.opends.server.types.SearchResultReference; |
| | | |
| | | |
| | | import org.opends.server.types.*; |
| | | |
| | | /** |
| | | * A mock connection for connection criteria testing. |
| | |
| | | public final class MockClientConnection extends ClientConnection |
| | | { |
| | | private final int clientPort; |
| | | |
| | | private final boolean isSecure; |
| | | |
| | | private final AuthenticationInfo authInfo; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new mock client connection. |
| | | * |
| | | * |
| | | * @param clientPort |
| | | * The client port. |
| | | * @param isSecure |
| | |
| | | break; |
| | | case SIMPLE: |
| | | Entry simpleUser = DirectoryServer.getEntry(bindDN); |
| | | ByteString password = ByteString.valueOf("password"); |
| | | this.authInfo = |
| | | new AuthenticationInfo(simpleUser, bindDN, password, true); |
| | | this.authInfo = new AuthenticationInfo(simpleUser, bindDN, true); |
| | | break; |
| | | default: // SASL |
| | | Entry saslUser = DirectoryServer.getEntry(bindDN); |
| | | this.authInfo = |
| | | new AuthenticationInfo(saslUser, "external", |
| | | ByteString.valueOf(bindDN.toNormalizedString()), true); |
| | | this.authInfo = new AuthenticationInfo(saslUser, "external", true); |
| | | break; |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core.networkgroups; |
| | | |
| | | |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | |
| | |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | | * This set of tests test the network groups. |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | public class NetworkGroupTest extends DirectoryServerTestCase { |
| | | //=========================================================================== |
| | | // |
| | |
| | | * @throws Exception if the environment could not be set up. |
| | | */ |
| | | @BeforeClass |
| | | public void setUp() |
| | | throws Exception |
| | | public void setUp() throws Exception |
| | | { |
| | | // This test suite depends on having the schema available, |
| | | // so we'll start the server. |
| | |
| | | |
| | | */ |
| | | @DataProvider (name = "DNSet_0") |
| | | public Object[][] initDNSet_0() |
| | | throws Exception |
| | | public Object[][] initDNSet_0() throws Exception |
| | | { |
| | | // Network group ID |
| | | String networkGroupID1 = "networkGroup1"; |
| | |
| | | DN dn2 = DN.decode("o=test2"); |
| | | |
| | | // Network group info |
| | | Object[][] myData = |
| | | { |
| | | return new Object[][] { |
| | | // Test1: create a network group with the identifier networkGroupID1 |
| | | { networkGroupID1, dn1 }, |
| | | |
| | |
| | | // Test3: create another network group |
| | | { networkGroupID2, dn2 }, |
| | | }; |
| | | |
| | | return myData; |
| | | } |
| | | |
| | | |
| | |
| | | * @throws Exception when DN.decode fails |
| | | */ |
| | | @DataProvider(name = "DNSet_1") |
| | | public Object[][] initDNSet_1() |
| | | throws Exception |
| | | public Object[][] initDNSet_1() throws Exception |
| | | { |
| | | DN dnRootDSE = DN.decode(""); |
| | | DN dnConfig = DN.decode("cn=config"); |
| | |
| | | // child entry under cn=backups. |
| | | |
| | | // Sets of DNs |
| | | Object[][] myData = |
| | | { |
| | | return new Object[][] { |
| | | { dnRootDSE, null, true, true, true }, |
| | | { dnConfig, dnSubordinateConfig, true, true, true }, |
| | | { dnMonitor, dnSubordinateMonitor, true, true, true }, |
| | |
| | | { dnBackups, null, true, true, true }, |
| | | { dnDummy, null, false, false, false }, |
| | | }; |
| | | |
| | | return myData; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | */ |
| | | @DataProvider (name = "DNSet_2") |
| | | public Object[][] initDNSet_2() |
| | | throws Exception |
| | | public Object[][] initDNSet_2() throws Exception |
| | | { |
| | | // Network group definition |
| | | DN dn1 = DN.decode("o=test1"); |
| | |
| | | DN unrelatedDN = DN.decode("o=dummy"); |
| | | |
| | | // Network group info |
| | | Object[][] myData = |
| | | { |
| | | return new Object[][] { |
| | | // Test1: one DN for one workflow |
| | | { |
| | | dn1, |
| | | null, |
| | | null, |
| | | subordinate1, |
| | | null, |
| | | null, |
| | | dn1, null, null, |
| | | subordinate1, null, null, |
| | | unrelatedDN |
| | | }, |
| | | // Test2: two DNs for two workflows |
| | | { |
| | | dn1, |
| | | dn2, |
| | | null, |
| | | subordinate1, |
| | | subordinate2, |
| | | null, |
| | | dn1, dn2, null, |
| | | subordinate1, subordinate2, null, |
| | | unrelatedDN |
| | | }, |
| | | // Test3: three DNs for three workflows |
| | | { |
| | | dn1, |
| | | dn2, |
| | | dn3, |
| | | subordinate1, |
| | | subordinate2, |
| | | subordinate3, |
| | | dn1, dn2, dn3, |
| | | subordinate1, subordinate2, subordinate3, |
| | | unrelatedDN |
| | | } |
| | | }; |
| | | |
| | | return myData; |
| | | } |
| | | |
| | | |
| | |
| | | * Provides information to create a network group with resource limits. |
| | | */ |
| | | @DataProvider (name = "DNSet_3") |
| | | public Object[][] initDNSet_3() |
| | | throws Exception |
| | | public Object[][] initDNSet_3() throws Exception |
| | | { |
| | | // Network group definition |
| | | String networkGroupID = "networkGroup1"; |
| | |
| | | int minSubstringLength = 4; |
| | | |
| | | // Network group info |
| | | Object[][] myData = |
| | | { |
| | | return new Object[][] { |
| | | // Test1: one DN for one workflow |
| | | { |
| | | networkGroupID, |
| | |
| | | minSubstringLength |
| | | } |
| | | }; |
| | | return myData; |
| | | } |
| | | |
| | | |
| | |
| | | * Provides information to create 2 network groups with different priorities. |
| | | */ |
| | | @DataProvider (name = "DNSet_4") |
| | | public Object[][] initDNSet_4() |
| | | throws Exception |
| | | public Object[][] initDNSet_4() throws Exception |
| | | { |
| | | String networkGroupID1 = "group1"; |
| | | String networkGroupID2 = "group2"; |
| | | DN dn1 = DN.decode("o=test1"); |
| | | DN dn2 = DN.decode("o=test2"); |
| | | |
| | | Object[][] myData = { |
| | | return new Object[][] { |
| | | { |
| | | networkGroupID1, |
| | | dn1, |
| | | 1, |
| | | networkGroupID2, |
| | | dn2, |
| | | 2 |
| | | networkGroupID1, dn1, 1, |
| | | networkGroupID2, dn2, 2 |
| | | }, |
| | | { |
| | | networkGroupID1, |
| | | dn1, |
| | | 2, |
| | | networkGroupID2, |
| | | dn2, |
| | | 1 |
| | | networkGroupID1, dn1, 2, |
| | | networkGroupID2, dn2, 1 |
| | | } |
| | | |
| | | }; |
| | | |
| | | return myData; |
| | | } |
| | | |
| | | |
| | |
| | | @DataProvider (name = "PrioritySet_0") |
| | | public Object[][] initPrioritySet_0() |
| | | { |
| | | Object[][] myData = { |
| | | return new Object[][] { |
| | | { 1, 2, 3 }, |
| | | { 1, 3, 2 }, |
| | | { 2, 1, 3 }, |
| | |
| | | { 3, 1, 2 }, |
| | | { 3, 2, 1 } |
| | | }; |
| | | |
| | | return myData; |
| | | } |
| | | |
| | | |
| | |
| | | @DataProvider (name = "BindFilterSet_0") |
| | | public Object[][] initBindFilterSet_0() |
| | | { |
| | | Object[][] myData = { |
| | | { |
| | | "*, cn=Root DNs, cn=config", |
| | | true |
| | | }, |
| | | { |
| | | "cn=Dir*, cn=Root DNs, cn=config", |
| | | true |
| | | }, |
| | | { |
| | | "cn=*", |
| | | false |
| | | }, |
| | | { |
| | | "uid=*", |
| | | false |
| | | }, |
| | | { |
| | | "**, cn=config", |
| | | true |
| | | }, |
| | | { |
| | | "*, cn=config", |
| | | false |
| | | } |
| | | return new Object[][] { |
| | | { "*, cn=Root DNs, cn=config", true }, |
| | | { "cn=Dir*, cn=Root DNs, cn=config", true }, |
| | | { "cn=*", false }, |
| | | { "uid=*", false }, |
| | | { "**, cn=config", true }, |
| | | { "*, cn=config", false } |
| | | }; |
| | | return myData; |
| | | } |
| | | |
| | | |
| | |
| | | // Use simple bind on this connection |
| | | Entry userEntry = DirectoryServer.getEntry( |
| | | DN.decode("cn=Directory Manager, cn=Root DNs, cn=config")); |
| | | ByteString password = ByteString.valueOf("password"); |
| | | ClientConnection connection2 = new InternalClientConnection( |
| | | new AuthenticationInfo(userEntry, userEntry.getDN(), password, true)); |
| | | new AuthenticationInfo(userEntry, userEntry.getDN(), true)); |
| | | ng = NetworkGroup.findMatchingNetworkGroup(connection2); |
| | | assertEquals(ng, networkGroup2); |
| | | |
| | | // Use SASL on this connection |
| | | ClientConnection connection3 = new InternalClientConnection( |
| | | new AuthenticationInfo(userEntry, "external", ByteString.valueOf( |
| | | "cn=Directory Manager, cn=Root DNs, cn=config"), true)); |
| | | new AuthenticationInfo(userEntry, "external", true)); |
| | | ng = NetworkGroup.findMatchingNetworkGroup(connection3); |
| | | assertEquals(ng, networkGroup3); |
| | | |
| | |
| | | // Use simple bind on this connection |
| | | Entry userEntry = DirectoryServer.getEntry( |
| | | DN.decode("cn=Directory Manager, cn=Root DNs, cn=config")); |
| | | ByteString password = ByteString.valueOf("password"); |
| | | ClientConnection connection2 = new InternalClientConnection( |
| | | new AuthenticationInfo(userEntry, userEntry.getDN(), password, true)); |
| | | new AuthenticationInfo(userEntry, userEntry.getDN(), true)); |
| | | ng = NetworkGroup.findMatchingNetworkGroup(connection2); |
| | | if (match) { |
| | | assertEquals(ng, networkGroup); |
| | |
| | | |
| | | // Use SASL on this connection |
| | | ClientConnection connection3 = new InternalClientConnection( |
| | | new AuthenticationInfo(userEntry, "external", ByteString.valueOf( |
| | | "cn=Directory Manager, cn=Root DNs, cn=config"), true)); |
| | | new AuthenticationInfo(userEntry, "external", true)); |
| | | ng = NetworkGroup.findMatchingNetworkGroup(connection3); |
| | | if (match) { |
| | | assertEquals(ng, networkGroup); |