-
Notifications
You must be signed in to change notification settings - Fork 24
ARIES-2197 Add TLS/MTLS support to TCP Provider #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
amichair
wants to merge
7
commits into
apache:master
Choose a base branch
from
amichair:ARIES-2197
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9d194b2
Change TcpInvocationHandler to invoke Object methods locally
55bd345
ARIES-2120 Change DistributionProvider to return a Closeable Imported…
47105d6
Improve TcpProvider performance test
48531b5
ARIES 2121 Add TCP provider connection persistence with connection po…
4a6a85d
Add retries when connection is stale
c521c5e
Rename EndpointPropertiesParser to Config and LocalHostUtil to NetUti…
9e2a4d2
ARIES-2197 Add TLS/MTLS support to TCP Provider
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/Config.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| /* | ||
| * 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.aries.rsa.provider.tcp; | ||
|
|
||
| import java.util.Map; | ||
| import java.util.UUID; | ||
|
|
||
| /** | ||
| * A convenience class for extracting endpoint configuration properties, | ||
| * provider properties and defaults. | ||
| */ | ||
| public class Config { | ||
|
|
||
| // endpoint service properties | ||
| static final String PORT = "aries.rsa.port"; | ||
| static final String HOSTNAME = "aries.rsa.hostname"; | ||
| static final String BIND_ADDRESS = "aries.rsa.bindAddress"; | ||
| static final String ID = "aries.rsa.id"; | ||
| static final String THREADS = "aries.rsa.numThreads"; | ||
| static final String TIMEOUT = "osgi.basic.timeout"; | ||
|
|
||
| // provider component properties | ||
| static final String KEYSTORE = "aries.rsa.keyStore"; | ||
| static final String TRUSTSTORE = "aries.rsa.trustStore"; | ||
| static final String KEYSTORE_PASSWORD = "aries.rsa.keyStorePassword"; | ||
| static final String TRUSTSTORE_PASSWORD = "aries.rsa.trustStorePassword"; | ||
| static final String KEY_ALIAS = "aries.rsa.keyAlias"; | ||
| static final String MTLS = "aries.rsa.mtls"; | ||
|
|
||
| static final int DYNAMIC_PORT = 0; | ||
| static final int DEFAULT_TIMEOUT_MILLIS = 300000; | ||
| static final int DEFAULT_NUM_THREADS = 10; | ||
|
|
||
| private final Map<String, Object> props; | ||
| private final String uuid = UUID.randomUUID().toString(); // fallback id | ||
|
|
||
| public Config(Map<String, Object> props) { | ||
| this.props = props; | ||
| } | ||
|
|
||
| public int getTimeoutMillis() { | ||
| return getInt(TIMEOUT, DEFAULT_TIMEOUT_MILLIS); | ||
| } | ||
|
|
||
| int getInt(String key, int defaultValue) { | ||
| Object value = props.get(key); | ||
| return value != null ? Integer.parseInt(value.toString()) : defaultValue; | ||
| } | ||
|
|
||
| String getString(String key, String defaultValue) { | ||
| Object value = props.get(key); | ||
| return value != null ? value.toString() : defaultValue; | ||
| } | ||
|
|
||
| public int getPort() { | ||
| return getInt(PORT, DYNAMIC_PORT); | ||
| } | ||
|
|
||
| public String getHostname() { | ||
| String hostName = getString(HOSTNAME, System.getProperty(HOSTNAME)); | ||
| if (hostName == null) { | ||
| hostName = NetUtil.getLocalIp(); | ||
| } | ||
| return hostName; | ||
| } | ||
|
|
||
| public String getBindAddress() { | ||
| return getString(BIND_ADDRESS, System.getProperty(BIND_ADDRESS)); | ||
| } | ||
|
|
||
| public String getId() { | ||
| return getString(ID, uuid); | ||
| } | ||
|
|
||
| public int getNumThreads() { | ||
| return getInt(THREADS, DEFAULT_NUM_THREADS); | ||
| } | ||
|
|
||
| public String getKeyStore() { | ||
| return getString(KEYSTORE, System.getProperty(KEYSTORE)); | ||
| } | ||
|
|
||
| public String getTrustStore() { | ||
| return getString(TRUSTSTORE, System.getProperty(TRUSTSTORE)); | ||
| } | ||
|
|
||
| public String getKeyStorePassword() { | ||
| return getString(KEYSTORE_PASSWORD, System.getProperty(KEYSTORE_PASSWORD)); | ||
| } | ||
|
|
||
| public String getTrustStorePassword() { | ||
| return getString(TRUSTSTORE_PASSWORD, System.getProperty(TRUSTSTORE_PASSWORD)); | ||
| } | ||
|
|
||
| public String getKeyAlias() { | ||
| return getString(KEY_ALIAS, System.getProperty(KEY_ALIAS)); | ||
| } | ||
|
|
||
| public boolean isMtls() { | ||
| return Boolean.parseBoolean(getString(MTLS, System.getProperty(MTLS))); | ||
| } | ||
| } | ||
90 changes: 0 additions & 90 deletions
90
provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/EndpointPropertiesParser.java
This file was deleted.
Oops, something went wrong.
92 changes: 0 additions & 92 deletions
92
provider/tcp/src/main/java/org/apache/aries/rsa/provider/tcp/LocalHostUtil.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of uuid we can call the field
fallbackId