-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2fe6c2
commit 5b645b3
Showing
27 changed files
with
561 additions
and
584 deletions.
There are no files selected for viewing
This file contains 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 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
29 changes: 29 additions & 0 deletions
29
driver/src/main/java/org/neo4j/driver/SecuritySettings.java
This file contains 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,29 @@ | ||
/* | ||
* Copyright (c) "Neo4j" | ||
* Neo4j Sweden AB [http://neo4j.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Licensed 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.neo4j.driver; | ||
|
||
import java.io.Serializable; | ||
|
||
public interface SecuritySettings extends Serializable { | ||
// TODO | ||
boolean encrypted(); | ||
|
||
// TODO | ||
Config.TrustStrategy trustStrategy(); | ||
} |
This file contains 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
75 changes: 75 additions & 0 deletions
75
driver/src/main/java/org/neo4j/driver/internal/InternalSecuritySettings.java
This file contains 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,75 @@ | ||
/* | ||
* Copyright (c) "Neo4j" | ||
* Neo4j Sweden AB [http://neo4j.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Licensed 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.neo4j.driver.internal; | ||
|
||
import org.neo4j.driver.Config; | ||
|
||
public class InternalSecuritySettings implements org.neo4j.driver.SecuritySettings { | ||
private static final long serialVersionUID = 4494615367164106576L; | ||
|
||
private static final boolean DEFAULT_ENCRYPTED = false; | ||
private static final Config.TrustStrategy DEFAULT_TRUST_STRATEGY = Config.TrustStrategy.trustSystemCertificates(); | ||
public static final InternalSecuritySettings DEFAULT = | ||
new InternalSecuritySettings(DEFAULT_ENCRYPTED, DEFAULT_TRUST_STRATEGY); | ||
private final boolean encrypted; | ||
private final Config.TrustStrategy trustStrategy; | ||
|
||
public InternalSecuritySettings(boolean encrypted, Config.TrustStrategy trustStrategy) { | ||
this.encrypted = encrypted; | ||
this.trustStrategy = trustStrategy == null ? DEFAULT_TRUST_STRATEGY : trustStrategy; | ||
} | ||
|
||
public boolean encrypted() { | ||
return encrypted; | ||
} | ||
|
||
public Config.TrustStrategy trustStrategy() { | ||
return trustStrategy; | ||
} | ||
|
||
public static class SecuritySettingsBuilder { | ||
private boolean isCustomized = false; | ||
private boolean encrypted; | ||
private Config.TrustStrategy trustStrategy; | ||
|
||
public SecuritySettingsBuilder withEncryption() { | ||
encrypted = true; | ||
isCustomized = true; | ||
return this; | ||
} | ||
|
||
public SecuritySettingsBuilder withoutEncryption() { | ||
encrypted = false; | ||
isCustomized = true; | ||
return this; | ||
} | ||
|
||
public SecuritySettingsBuilder withTrustStrategy(Config.TrustStrategy strategy) { | ||
trustStrategy = strategy; | ||
isCustomized = true; | ||
return this; | ||
} | ||
|
||
public InternalSecuritySettings build() { | ||
return isCustomized | ||
? new InternalSecuritySettings(encrypted, trustStrategy) | ||
: InternalSecuritySettings.DEFAULT; | ||
} | ||
} | ||
} |
This file contains 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 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
Oops, something went wrong.