Search in sources :

Example 1 with BasicAuthCommonCacheConfig

use of org.apache.druid.security.basic.BasicAuthCommonCacheConfig in project druid by druid-io.

the class BasicRoleBasedAuthorizerTest method setUp.

@Before
public void setUp() {
    TestDerbyConnector connector = derbyConnectorRule.getConnector();
    MetadataStorageTablesConfig tablesConfig = derbyConnectorRule.metadataTablesConfigSupplier().get();
    connector.createConfigTable();
    BasicAttributes userAttrs = new BasicAttributes(true);
    userAttrs.put(new BasicAttribute("sAMAccountName", "druiduser"));
    userAttrs.put(new BasicAttribute("memberOf", "CN=user,OU=Druid,OU=Application,OU=Groupings,DC=corp,DC=apache,DC=org"));
    BasicAttributes adminAttrs = new BasicAttributes(true);
    adminAttrs.put(new BasicAttribute("sAMAccountName", "druidadmin"));
    adminAttrs.put(new BasicAttribute("memberOf", "CN=admin,OU=Platform,OU=Groupings,DC=corp,DC=apache,DC=org"));
    userSearchResult = new SearchResult("CN=1234,OU=Employees,OU=People", null, userAttrs);
    adminSearchResult = new SearchResult("CN=9876,OU=Employees,OU=People", null, adminAttrs);
    updater = new CoordinatorBasicAuthorizerMetadataStorageUpdater(new AuthorizerMapper(ImmutableMap.of(DB_AUTHORIZER_NAME, new BasicRoleBasedAuthorizer(null, DB_AUTHORIZER_NAME, null, null, null, null, null, new MetadataStoreRoleProvider(null)), LDAP_AUTHORIZER_NAME, new BasicRoleBasedAuthorizer(null, LDAP_AUTHORIZER_NAME, null, null, null, null, null, new LDAPRoleProvider(null, groupFilters)))), connector, tablesConfig, new BasicAuthCommonCacheConfig(null, null, null, null), new ObjectMapper(new SmileFactory()), new NoopBasicAuthorizerCacheNotifier(), null);
    updater.start();
    authorizer = new BasicRoleBasedAuthorizer(null, DB_AUTHORIZER_NAME, null, null, null, null, null, new MetadataStoreRoleProvider(new MetadataStoragePollingBasicAuthorizerCacheManager(updater)));
    ldapAuthorizer = new BasicRoleBasedAuthorizer(null, LDAP_AUTHORIZER_NAME, null, null, null, null, null, new LDAPRoleProvider(new MetadataStoragePollingBasicAuthorizerCacheManager(updater), groupFilters));
}
Also used : BasicAttribute(javax.naming.directory.BasicAttribute) BasicAttributes(javax.naming.directory.BasicAttributes) CoordinatorBasicAuthorizerMetadataStorageUpdater(org.apache.druid.security.basic.authorization.db.updater.CoordinatorBasicAuthorizerMetadataStorageUpdater) MetadataStoragePollingBasicAuthorizerCacheManager(org.apache.druid.security.basic.authorization.db.cache.MetadataStoragePollingBasicAuthorizerCacheManager) BasicAuthCommonCacheConfig(org.apache.druid.security.basic.BasicAuthCommonCacheConfig) SearchResult(javax.naming.directory.SearchResult) TestDerbyConnector(org.apache.druid.metadata.TestDerbyConnector) LDAPRoleProvider(org.apache.druid.security.basic.authorization.LDAPRoleProvider) MetadataStorageTablesConfig(org.apache.druid.metadata.MetadataStorageTablesConfig) SmileFactory(com.fasterxml.jackson.dataformat.smile.SmileFactory) AuthorizerMapper(org.apache.druid.server.security.AuthorizerMapper) BasicRoleBasedAuthorizer(org.apache.druid.security.basic.authorization.BasicRoleBasedAuthorizer) MetadataStoreRoleProvider(org.apache.druid.security.basic.authorization.MetadataStoreRoleProvider) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Example 2 with BasicAuthCommonCacheConfig

use of org.apache.druid.security.basic.BasicAuthCommonCacheConfig in project druid by druid-io.

the class CoordinatorBasicAuthorizerResourceTest method setUp.

@Before
public void setUp() {
    connector = derbyConnectorRule.getConnector();
    tablesConfig = derbyConnectorRule.metadataTablesConfigSupplier().get();
    connector.createConfigTable();
    AuthorizerMapper authorizerMapper = new AuthorizerMapper(ImmutableMap.of(AUTHORIZER_NAME, new BasicRoleBasedAuthorizer(null, AUTHORIZER_NAME, null, null, null, null, null, null), AUTHORIZER_NAME2, new BasicRoleBasedAuthorizer(null, AUTHORIZER_NAME2, null, null, null, null, null, null), AUTHORIZER_NAME3, new BasicRoleBasedAuthorizer(null, AUTHORIZER_NAME3, null, null, "adminGroupMapping", null, null, null)));
    storageUpdater = new CoordinatorBasicAuthorizerMetadataStorageUpdater(authorizerMapper, connector, tablesConfig, new BasicAuthCommonCacheConfig(null, null, null, null), new ObjectMapper(new SmileFactory()), new NoopBasicAuthorizerCacheNotifier(), null);
    resource = new BasicAuthorizerResource(new CoordinatorBasicAuthorizerResourceHandler(storageUpdater, authorizerMapper, new ObjectMapper(new SmileFactory())), authValidator);
    storageUpdater.start();
}
Also used : SmileFactory(com.fasterxml.jackson.dataformat.smile.SmileFactory) CoordinatorBasicAuthorizerMetadataStorageUpdater(org.apache.druid.security.basic.authorization.db.updater.CoordinatorBasicAuthorizerMetadataStorageUpdater) AuthorizerMapper(org.apache.druid.server.security.AuthorizerMapper) BasicAuthCommonCacheConfig(org.apache.druid.security.basic.BasicAuthCommonCacheConfig) BasicAuthorizerResource(org.apache.druid.security.basic.authorization.endpoint.BasicAuthorizerResource) BasicRoleBasedAuthorizer(org.apache.druid.security.basic.authorization.BasicRoleBasedAuthorizer) CoordinatorBasicAuthorizerResourceHandler(org.apache.druid.security.basic.authorization.endpoint.CoordinatorBasicAuthorizerResourceHandler) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Example 3 with BasicAuthCommonCacheConfig

use of org.apache.druid.security.basic.BasicAuthCommonCacheConfig in project druid by druid-io.

the class CoordinatorBasicAuthenticatorMetadataStorageUpdaterTest method setUp.

@Before
public void setUp() {
    objectMapper = new ObjectMapper(new SmileFactory());
    TestDerbyConnector connector = derbyConnectorRule.getConnector();
    MetadataStorageTablesConfig tablesConfig = derbyConnectorRule.metadataTablesConfigSupplier().get();
    connector.createConfigTable();
    updater = new CoordinatorBasicAuthenticatorMetadataStorageUpdater(new AuthenticatorMapper(ImmutableMap.of("test", new BasicHTTPAuthenticator(null, "test", "test", null, null, null, null, null, false, null))), connector, tablesConfig, new BasicAuthCommonCacheConfig(null, null, null, null), objectMapper, new NoopBasicAuthenticatorCacheNotifier(), null);
    updater.start();
}
Also used : AuthenticatorMapper(org.apache.druid.server.security.AuthenticatorMapper) BasicHTTPAuthenticator(org.apache.druid.security.basic.authentication.BasicHTTPAuthenticator) MetadataStorageTablesConfig(org.apache.druid.metadata.MetadataStorageTablesConfig) SmileFactory(com.fasterxml.jackson.dataformat.smile.SmileFactory) CoordinatorBasicAuthenticatorMetadataStorageUpdater(org.apache.druid.security.basic.authentication.db.updater.CoordinatorBasicAuthenticatorMetadataStorageUpdater) BasicAuthCommonCacheConfig(org.apache.druid.security.basic.BasicAuthCommonCacheConfig) TestDerbyConnector(org.apache.druid.metadata.TestDerbyConnector) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Example 4 with BasicAuthCommonCacheConfig

use of org.apache.druid.security.basic.BasicAuthCommonCacheConfig in project druid by druid-io.

the class CoordinatorBasicAuthorizerMetadataStorageUpdaterTest method setUp.

@Before
public void setUp() {
    objectMapper = new ObjectMapper(new SmileFactory());
    TestDerbyConnector connector = derbyConnectorRule.getConnector();
    MetadataStorageTablesConfig tablesConfig = derbyConnectorRule.metadataTablesConfigSupplier().get();
    connector.createConfigTable();
    updater = new CoordinatorBasicAuthorizerMetadataStorageUpdater(new AuthorizerMapper(ImmutableMap.of(AUTHORIZER_NAME, new BasicRoleBasedAuthorizer(null, AUTHORIZER_NAME, null, null, null, null, null, null))), connector, tablesConfig, new BasicAuthCommonCacheConfig(null, null, null, null), objectMapper, new NoopBasicAuthorizerCacheNotifier(), null);
    updater.start();
}
Also used : MetadataStorageTablesConfig(org.apache.druid.metadata.MetadataStorageTablesConfig) SmileFactory(com.fasterxml.jackson.dataformat.smile.SmileFactory) CoordinatorBasicAuthorizerMetadataStorageUpdater(org.apache.druid.security.basic.authorization.db.updater.CoordinatorBasicAuthorizerMetadataStorageUpdater) AuthorizerMapper(org.apache.druid.server.security.AuthorizerMapper) BasicAuthCommonCacheConfig(org.apache.druid.security.basic.BasicAuthCommonCacheConfig) BasicRoleBasedAuthorizer(org.apache.druid.security.basic.authorization.BasicRoleBasedAuthorizer) TestDerbyConnector(org.apache.druid.metadata.TestDerbyConnector) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Example 5 with BasicAuthCommonCacheConfig

use of org.apache.druid.security.basic.BasicAuthCommonCacheConfig in project druid by druid-io.

the class CoordinatorBasicAuthenticatorResourceTest method setUp.

@Before
public void setUp() {
    req = EasyMock.createStrictMock(HttpServletRequest.class);
    objectMapper = new ObjectMapper(new SmileFactory());
    TestDerbyConnector connector = derbyConnectorRule.getConnector();
    MetadataStorageTablesConfig tablesConfig = derbyConnectorRule.metadataTablesConfigSupplier().get();
    connector.createConfigTable();
    ObjectMapper objectMapper = new ObjectMapper(new SmileFactory());
    AuthenticatorMapper authenticatorMapper = new AuthenticatorMapper(ImmutableMap.of(AUTHENTICATOR_NAME, new BasicHTTPAuthenticator(null, AUTHENTICATOR_NAME, null, new DefaultPasswordProvider("druid"), new DefaultPasswordProvider("druid"), null, null, null, false, null), AUTHENTICATOR_NAME2, new BasicHTTPAuthenticator(null, AUTHENTICATOR_NAME2, null, new DefaultPasswordProvider("druid"), new DefaultPasswordProvider("druid"), null, null, null, false, null), AUTHENTICATOR_NAME_LDAP, new BasicHTTPAuthenticator(null, AUTHENTICATOR_NAME2, null, new DefaultPasswordProvider("druid"), new DefaultPasswordProvider("druid"), null, null, null, false, null)));
    storageUpdater = new CoordinatorBasicAuthenticatorMetadataStorageUpdater(authenticatorMapper, connector, tablesConfig, new BasicAuthCommonCacheConfig(null, null, null, null), objectMapper, new NoopBasicAuthenticatorCacheNotifier(), null);
    resource = new BasicAuthenticatorResource(new CoordinatorBasicAuthenticatorResourceHandler(storageUpdater, authenticatorMapper, objectMapper), authValidator);
    storageUpdater.start();
}
Also used : CoordinatorBasicAuthenticatorResourceHandler(org.apache.druid.security.basic.authentication.endpoint.CoordinatorBasicAuthenticatorResourceHandler) CoordinatorBasicAuthenticatorMetadataStorageUpdater(org.apache.druid.security.basic.authentication.db.updater.CoordinatorBasicAuthenticatorMetadataStorageUpdater) BasicAuthCommonCacheConfig(org.apache.druid.security.basic.BasicAuthCommonCacheConfig) TestDerbyConnector(org.apache.druid.metadata.TestDerbyConnector) HttpServletRequest(javax.servlet.http.HttpServletRequest) AuthenticatorMapper(org.apache.druid.server.security.AuthenticatorMapper) BasicHTTPAuthenticator(org.apache.druid.security.basic.authentication.BasicHTTPAuthenticator) MetadataStorageTablesConfig(org.apache.druid.metadata.MetadataStorageTablesConfig) SmileFactory(com.fasterxml.jackson.dataformat.smile.SmileFactory) BasicAuthenticatorResource(org.apache.druid.security.basic.authentication.endpoint.BasicAuthenticatorResource) DefaultPasswordProvider(org.apache.druid.metadata.DefaultPasswordProvider) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 SmileFactory (com.fasterxml.jackson.dataformat.smile.SmileFactory)5 BasicAuthCommonCacheConfig (org.apache.druid.security.basic.BasicAuthCommonCacheConfig)5 Before (org.junit.Before)5 MetadataStorageTablesConfig (org.apache.druid.metadata.MetadataStorageTablesConfig)4 TestDerbyConnector (org.apache.druid.metadata.TestDerbyConnector)4 BasicRoleBasedAuthorizer (org.apache.druid.security.basic.authorization.BasicRoleBasedAuthorizer)3 CoordinatorBasicAuthorizerMetadataStorageUpdater (org.apache.druid.security.basic.authorization.db.updater.CoordinatorBasicAuthorizerMetadataStorageUpdater)3 AuthorizerMapper (org.apache.druid.server.security.AuthorizerMapper)3 BasicHTTPAuthenticator (org.apache.druid.security.basic.authentication.BasicHTTPAuthenticator)2 CoordinatorBasicAuthenticatorMetadataStorageUpdater (org.apache.druid.security.basic.authentication.db.updater.CoordinatorBasicAuthenticatorMetadataStorageUpdater)2 AuthenticatorMapper (org.apache.druid.server.security.AuthenticatorMapper)2 BasicAttribute (javax.naming.directory.BasicAttribute)1 BasicAttributes (javax.naming.directory.BasicAttributes)1 SearchResult (javax.naming.directory.SearchResult)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 DefaultPasswordProvider (org.apache.druid.metadata.DefaultPasswordProvider)1 BasicAuthenticatorResource (org.apache.druid.security.basic.authentication.endpoint.BasicAuthenticatorResource)1 CoordinatorBasicAuthenticatorResourceHandler (org.apache.druid.security.basic.authentication.endpoint.CoordinatorBasicAuthenticatorResourceHandler)1 LDAPRoleProvider (org.apache.druid.security.basic.authorization.LDAPRoleProvider)1