Browse Source
* Adds custom provider class to security config * Implementation of KIP-492 Reviewers: Sriharsha Chintalapani <sriharsha@apache.org> , Jeff Huangpull/7253/head
saisandeep
5 years ago
committed by
Harsha
19 changed files with 434 additions and 16 deletions
@ -0,0 +1,28 @@
@@ -0,0 +1,28 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.apache.kafka.common.config; |
||||
|
||||
/** |
||||
* Contains the common security config for SSL and SASL |
||||
*/ |
||||
public class SecurityConfig { |
||||
|
||||
public static final String SECURITY_PROVIDERS_CONFIG = "security.providers"; |
||||
public static final String SECURITY_PROVIDERS_DOC = "A list of configurable creators each returning a provider " + |
||||
"implementing security algorithms"; |
||||
|
||||
} |
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.apache.kafka.common.security; |
||||
|
||||
import org.apache.kafka.common.Configurable; |
||||
|
||||
import java.security.Provider; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* An interface for generating security providers. |
||||
*/ |
||||
public interface SecurityProviderCreator extends Configurable { |
||||
|
||||
/** |
||||
* Configure method is used to configure the generator to create the Security Provider |
||||
* @param config configuration parameters for initialising security provider |
||||
*/ |
||||
default void configure(Map<String, ?> config) { |
||||
|
||||
} |
||||
|
||||
/** |
||||
* Generate the security provider configured |
||||
*/ |
||||
Provider getProvider(); |
||||
} |
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.apache.kafka.common.security.ssl.mock; |
||||
|
||||
import java.security.Provider; |
||||
|
||||
public class TestPlainSaslServerProvider extends Provider { |
||||
|
||||
public TestPlainSaslServerProvider() { |
||||
this("TestPlainSaslServerProvider", 0.1, "test plain sasl server provider"); |
||||
} |
||||
|
||||
protected TestPlainSaslServerProvider(String name, double version, String info) { |
||||
super(name, version, info); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.apache.kafka.common.security.ssl.mock; |
||||
|
||||
import org.apache.kafka.common.security.SecurityProviderCreator; |
||||
|
||||
import java.security.Provider; |
||||
|
||||
public class TestPlainSaslServerProviderCreator implements SecurityProviderCreator { |
||||
|
||||
private TestPlainSaslServerProvider provider; |
||||
|
||||
@Override |
||||
public Provider getProvider() { |
||||
if (provider == null) { |
||||
provider = new TestPlainSaslServerProvider(); |
||||
} |
||||
return provider; |
||||
} |
||||
} |
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.apache.kafka.common.security.ssl.mock; |
||||
|
||||
import org.apache.kafka.common.security.SecurityProviderCreator; |
||||
|
||||
import java.security.Provider; |
||||
|
||||
public class TestProviderCreator implements SecurityProviderCreator { |
||||
|
||||
private TestProvider provider; |
||||
|
||||
@Override |
||||
public Provider getProvider() { |
||||
if (provider == null) { |
||||
provider = new TestProvider(); |
||||
} |
||||
return provider; |
||||
} |
||||
} |
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.apache.kafka.common.security.ssl.mock; |
||||
|
||||
import java.security.Provider; |
||||
|
||||
public class TestScramSaslServerProvider extends Provider { |
||||
|
||||
public TestScramSaslServerProvider() { |
||||
this("TestScramSaslServerProvider", 0.1, "test scram sasl server provider"); |
||||
} |
||||
|
||||
protected TestScramSaslServerProvider(String name, double version, String info) { |
||||
super(name, version, info); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.apache.kafka.common.security.ssl.mock; |
||||
|
||||
import org.apache.kafka.common.security.SecurityProviderCreator; |
||||
|
||||
import java.security.Provider; |
||||
|
||||
public class TestScramSaslServerProviderCreator implements SecurityProviderCreator { |
||||
|
||||
private TestScramSaslServerProvider provider; |
||||
|
||||
@Override |
||||
public Provider getProvider() { |
||||
if (provider == null) { |
||||
provider = new TestScramSaslServerProvider(); |
||||
} |
||||
return provider; |
||||
} |
||||
} |
Loading…
Reference in new issue