You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2022/10/06 08:40:12 UTC
[cayenne] branch master updated: CAY-2751 Simplify DataNode configuration - remove leftovers - add upgrade notes
This is an automated email from the ASF dual-hosted git repository.
ntimofeev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git
The following commit(s) were added to refs/heads/master by this push:
new b6ae60bf3 CAY-2751 Simplify DataNode configuration - remove leftovers - add upgrade notes
b6ae60bf3 is described below
commit b6ae60bf37c64435244a11e9d6480e73aee0daed
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Thu Oct 6 11:40:04 2022 +0300
CAY-2751 Simplify DataNode configuration
- remove leftovers
- add upgrade notes
---
UPGRADE.txt | 3 +
.../cayenne/configuration/PasswordEncoding.java | 59 --------------
.../configuration/PlainTextPasswordEncoder.java | 38 ---------
.../configuration/Rot13PasswordEncoder.java | 81 -------------------
.../configuration/Rot47PasswordEncoder.java | 90 ----------------------
.../configuration/Rot13PasswordEncoderTest.java | 43 -----------
.../configuration/Rot47PasswordEncoderTest.java | 43 -----------
7 files changed, 3 insertions(+), 354 deletions(-)
diff --git a/UPGRADE.txt b/UPGRADE.txt
index 2d69d5fb6..b7bf1e789 100644
--- a/UPGRADE.txt
+++ b/UPGRADE.txt
@@ -25,6 +25,9 @@ Most notable removals are SelectQuery and these Cayenne modules:
* Per CAY-2747 Cayenne XML schemas are updated, so you need to update you projects (just open them in the Modeler
or use cayenne-project-compatibility module)
+* Per CAY-2751 there's no more JNDI DataSource provided by Cayenne, nor there's a password encoding capabilities.
+If you need these you should provide you own custom DataSource.
+
* Per CAY-2752 code generation configuration has minor changes. You need to review and update
Maven, Gradle and Ant configs accordingly.
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/PasswordEncoding.java b/cayenne-server/src/main/java/org/apache/cayenne/configuration/PasswordEncoding.java
deleted file mode 100644
index f1928a394..000000000
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/PasswordEncoding.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*****************************************************************
- * 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
- *
- * https://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.cayenne.configuration;
-
-/**
- * Password encoders are used to translate the text of the database password, on loading
- * and on saving, from one form to another. It can facilitate the obscuring of the
- * password text to make database connection information less obvious to someone who
- * stumbles onto the password. Cayenne only includes facilities to obscure, not encrypt,
- * the database password. The mechanism is user-extensible, though, so should stronger
- * security features be required, they can be added and integrated into both the modeler
- * and framework.
- *
- * @since 3.0
- */
-public interface PasswordEncoding {
-
- final String[] standardEncoders = new String[] {
- PlainTextPasswordEncoder.class.getName(),
- Rot13PasswordEncoder.class.getName(), Rot47PasswordEncoder.class.getName()
- };
-
- /**
- * Decodes an encoded database password.
- *
- * @param encodedPassword - The encoded password to be decoded
- * @param key - An optional data element which can be used to unlock the password.
- * Some encoders may require the key.
- * @return The decoded normal/plain password.
- */
- String decodePassword(String encodedPassword, String key);
-
- /**
- * Encodes a normal/plain database password.
- *
- * @param normalPassword - The normal/plain password to be encoded
- * @param key - An optional data element which can be used to lock the password. Some
- * encoders may require the key.
- * @return The encoded password.
- */
- String encodePassword(String normalPassword, String key);
-}
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/PlainTextPasswordEncoder.java b/cayenne-server/src/main/java/org/apache/cayenne/configuration/PlainTextPasswordEncoder.java
deleted file mode 100644
index 6309dcba5..000000000
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/PlainTextPasswordEncoder.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*****************************************************************
- * 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
- *
- * https://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.cayenne.configuration;
-
-/**
- * The plain text password encoder passes the text of the database password
- * straight-through without any alteration. This is identical to the behavior of pre-3.0
- * versions of Cayenne, where the password was stored in the XML model in clear text.
- *
- * @since 3.0
- */
-public class PlainTextPasswordEncoder implements PasswordEncoding {
-
- public String decodePassword(String encodedPassword, String key) {
- return encodedPassword;
- }
-
- public String encodePassword(String normalPassword, String key) {
- return normalPassword;
- }
-}
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/Rot13PasswordEncoder.java b/cayenne-server/src/main/java/org/apache/cayenne/configuration/Rot13PasswordEncoder.java
deleted file mode 100644
index 261ac3a98..000000000
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/Rot13PasswordEncoder.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*****************************************************************
- * 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
- *
- * https://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.cayenne.configuration;
-
-/**
- * The ROT-13 password encoder passes the text of the database password through a simple
- * Caesar cipher to obscure the password text. The ROT-13 cipher only processes letters --
- * numbers and symbols are left untouched. ROT-13 is also a symmetrical cipher and
- * therefore provides no real encryption since applying the cipher to the encrypted text
- * produces the original source text. See the Wikipedia entry on <a
- * href="http://en.wikipedia.org/wiki/Rot-13">ROT13</a> for more information on this
- * topic.
- *
- * @since 3.0
- */
-public class Rot13PasswordEncoder implements PasswordEncoding {
-
- public String decodePassword(String encodedPassword, String key) {
- return rotate(encodedPassword);
- }
-
- public String encodePassword(String normalPassword, String key) {
- return rotate(normalPassword);
- }
-
- /**
- * Applies a ROT-13 Caesar cipher to the supplied value. Each letter in the supplied
- * value is substituted with a new value rotated by 13 places in the alphabet. See <a
- * href="http://en.wikipedia.org/wiki/ROT13">ROT13</a> for more information.
- * <p>
- * A Unix command to perform a ROT-13 cipher is:
- *
- * <pre>
- * tr "[a-m][n-z][A-M][N-Z]" "[n-z][a-m][N-Z][A-M]"
- * </pre>
- *
- * @param value The text to be rotated.
- * @return The rotated text.
- */
- public String rotate(String value) {
- if (value == null) {
- return null;
- }
-
- int length = value.length();
- StringBuilder result = new StringBuilder();
-
- for (int i = 0; i < length; i++) {
- char c = value.charAt(i);
-
- // If c is a letter, rotate it by 13. Numbers/symbols are untouched.
- if ((c >= 'a' && c <= 'm') || (c >= 'A' && c <= 'M')) {
- c += 13; // The first half of the alphabet goes forward 13 letters
- } else if ((c >= 'n' && c <= 'z') || (c >= 'N' && c <= 'Z')) {
- c -= 13; // The last half of the alphabet goes backward 13 letters
- }
-
- result.append(c);
- }
-
- return result.toString();
- }
-
-}
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/Rot47PasswordEncoder.java b/cayenne-server/src/main/java/org/apache/cayenne/configuration/Rot47PasswordEncoder.java
deleted file mode 100644
index 85185325b..000000000
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/Rot47PasswordEncoder.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*****************************************************************
- * 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
- *
- * https://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.cayenne.configuration;
-
-/**
- * The ROT-47 password encoder passes the text of the database password through a simple
- * Caesar cipher to obscure the password text. The ROT-47 cipher is similar to the ROT-13
- * cipher, but processes numbers and symbols as well. See the Wikipedia entry on <a
- * href="http://en.wikipedia.org/wiki/Rot-13">ROT13</a> for more information on this
- * topic.
- *
- * @since 3.0
- */
-public class Rot47PasswordEncoder implements PasswordEncoding {
-
- public String decodePassword(String encodedPassword, String key) {
- return rotate(encodedPassword);
- }
-
- public String encodePassword(String normalPassword, String key) {
- return rotate(normalPassword);
- }
-
- /**
- * Applies a ROT-47 Caesar cipher to the supplied value. Each letter in the supplied
- * value is substituted with a new value rotated by 47 places. See <a
- * href="http://en.wikipedia.org/wiki/ROT13">ROT13</a> for more information (there is
- * a subsection for ROT-47).
- * <p>
- * A Unix command to perform a ROT-47 cipher is:
- *
- * <pre>
- * tr '!-~' 'P-~!-O'
- * </pre>
- *
- * @param value The text to be rotated.
- * @return The rotated text.
- */
- public String rotate(String value) {
- if (value == null) {
- return null;
- }
-
- int length = value.length();
- StringBuilder result = new StringBuilder();
-
- for (int i = 0; i < length; i++) {
- char c = value.charAt(i);
-
- // Process letters, numbers, and symbols -- ignore spaces.
- if (c != ' ') {
- // Add 47 (it is ROT-47, after all).
- c += 47;
-
- // If character is now above printable range, make it printable.
- // Range of printable characters is ! (33) to ~ (126). A value
- // of 127 (just above ~) would therefore get rotated down to a
- // 33 (the !). The value 94 comes from 127 - 33 = 94, which is
- // therefore the value that needs to be subtracted from the
- // non-printable character to put it into the correct printable
- // range.
- if (c > '~') {
- c -= 94;
- }
- }
-
- result.append(c);
- }
-
- return result.toString();
- }
-
-}
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/configuration/Rot13PasswordEncoderTest.java b/cayenne-server/src/test/java/org/apache/cayenne/configuration/Rot13PasswordEncoderTest.java
deleted file mode 100644
index ec0099da0..000000000
--- a/cayenne-server/src/test/java/org/apache/cayenne/configuration/Rot13PasswordEncoderTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************
- * 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
- *
- * https://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.cayenne.configuration;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class Rot13PasswordEncoderTest {
-
- private final String message = "The Quick Brown Fox Jumps Over The Lazy Dog";
- private final String encoded = "Gur Dhvpx Oebja Sbk Whzcf Bire Gur Ynml Qbt";
-
- @Test
- public void testEncode() {
- Rot13PasswordEncoder encoder = new Rot13PasswordEncoder();
- assertEquals(encoded, encoder.encodePassword(message, null));
- }
-
- @Test
- public void testDecode() {
- Rot13PasswordEncoder encoder = new Rot13PasswordEncoder();
- assertEquals(message, encoder.decodePassword(encoded, null));
- }
-
-}
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/configuration/Rot47PasswordEncoderTest.java b/cayenne-server/src/test/java/org/apache/cayenne/configuration/Rot47PasswordEncoderTest.java
deleted file mode 100644
index cb5bfe2df..000000000
--- a/cayenne-server/src/test/java/org/apache/cayenne/configuration/Rot47PasswordEncoderTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************
- * 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
- *
- * https://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.cayenne.configuration;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class Rot47PasswordEncoderTest {
-
- private final String message = "The Quick Brown Fox Jumps Over The Lazy Dog";
- private final String encoded = "%96 \"F:4< qC@H? u@I yF>AD ~G6C %96 {2KJ s@8";
-
- @Test
- public void testEncode() {
- Rot47PasswordEncoder encoder = new Rot47PasswordEncoder();
- assertEquals(encoded, encoder.encodePassword(message, null));
- }
-
- @Test
- public void testDecode() {
- Rot47PasswordEncoder encoder = new Rot47PasswordEncoder();
- assertEquals(message, encoder.decodePassword(encoded, null));
- }
-
-}