This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch 3_0_X
in repository https://gitbox.apache.org/repos/asf/syncope.git


The following commit(s) were added to refs/heads/3_0_X by this push:
     new 20a7bdde51 Fixing deprecations
20a7bdde51 is described below

commit 20a7bdde51294fc3ebb4e33f820464fbb3967f68
Author: Francesco Chicchiriccò <[email protected]>
AuthorDate: Sat Sep 7 12:19:28 2024 +0200

    Fixing deprecations
---
 .../console/clientapps/ClientAppModalPanelBuilder.java     |  2 +-
 .../apache/syncope/fit/console/LinkedAccountsITCase.java   |  2 +-
 .../test/java/org/apache/syncope/fit/core/JWTITCase.java   |  2 +-
 .../org/apache/syncope/fit/core/LinkedAccountITCase.java   | 14 +++++++-------
 .../test/java/org/apache/syncope/fit/core/RESTITCase.java  |  2 +-
 .../java/org/apache/syncope/fit/core/SearchITCase.java     |  8 ++++----
 .../test/java/org/apache/syncope/fit/core/UserITCase.java  |  2 +-
 7 files changed, 16 insertions(+), 16 deletions(-)

diff --git 
a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java
 
b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java
index 94432309ad..bd6c27c25c 100644
--- 
a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java
+++ 
b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java
@@ -292,7 +292,7 @@ public class ClientAppModalPanelBuilder<T extends 
ClientAppTO> extends AbstractM
 
                     AjaxTextFieldPanel clientSecret = new AjaxTextFieldPanel(
                             "field", "clientSecret", new 
PropertyModel<>(clientAppTO, "clientSecret"), false);
-                    
clientSecret.setChoices(List.of(RandomStringUtils.randomAlphanumeric(15)));
+                    
clientSecret.setChoices(List.of(RandomStringUtils.secure().nextNumeric(15)));
                     fields.add(clientSecret.setRequired(true));
 
                     fields.add(new AjaxCheckBoxPanel(
diff --git 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LinkedAccountsITCase.java
 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LinkedAccountsITCase.java
index 7e3f3e7421..74bcaaa44b 100644
--- 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LinkedAccountsITCase.java
+++ 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/LinkedAccountsITCase.java
@@ -82,7 +82,7 @@ public class LinkedAccountsITCase extends 
AbstractConsoleITCase {
         doLogin(ADMIN_UNAME, ADMIN_PWD);
 
         // create user with linked account
-        String email = "linkedAccount" + RandomStringUtils.randomNumeric(4) + 
"@syncope.apache.org";
+        String email = "linkedAccount" + 
RandomStringUtils.insecure().nextNumeric(4) + "@syncope.apache.org";
         UserCR userCR = UserITCase.getSample(email);
         String connObjectKeyValue = "uid=" + userCR.getUsername() + 
",ou=People,o=isp";
 
diff --git 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/JWTITCase.java 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/JWTITCase.java
index 8ada145a3a..4e03db45c1 100644
--- 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/JWTITCase.java
+++ 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/JWTITCase.java
@@ -469,7 +469,7 @@ public class JWTITCase extends AbstractITCase {
                 notBeforeTime(currentTime);
 
         AccessTokenJWSSigner customJWSSigner =
-                new AccessTokenJWSSigner(JWS_ALGORITHM, 
RandomStringUtils.randomAlphanumeric(512));
+                new AccessTokenJWSSigner(JWS_ALGORITHM, 
RandomStringUtils.insecure().nextAlphanumeric(512));
 
         SignedJWT jwt = new SignedJWT(new 
JWSHeader(customJWSSigner.getJwsAlgorithm()), claimsSet.build());
         jwt.sign(customJWSSigner);
diff --git 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LinkedAccountITCase.java
 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LinkedAccountITCase.java
index dbe5fe359d..e6d17d6960 100644
--- 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LinkedAccountITCase.java
+++ 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/LinkedAccountITCase.java
@@ -81,7 +81,7 @@ public class LinkedAccountITCase extends AbstractITCase {
     public void createWithLinkedAccountThenUpdateThenRemove() throws 
NamingException {
         // 1. create user with linked account
         UserCR userCR = UserITCase.getSample(
-                "linkedAccount" + RandomStringUtils.randomNumeric(5) + 
"@syncope.apache.org");
+                "linkedAccount" + RandomStringUtils.insecure().nextNumeric(5) 
+ "@syncope.apache.org");
         String connObjectKeyValue = "firstAccountOf" + userCR.getUsername();
         String privilege = 
APPLICATION_SERVICE.read("mightyApp").getPrivileges().get(0).getKey();
 
@@ -157,7 +157,7 @@ public class LinkedAccountITCase extends AbstractITCase {
     public void createWithLinkedAccountThenUpdateUsingPutThenRemove() throws 
NamingException {
         // 1. create user with linked account
         UserCR userCR = UserITCase.getSample(
-                "linkedAccount" + RandomStringUtils.randomNumeric(5) + 
"@syncope.apache.org");
+                "linkedAccount" + RandomStringUtils.insecure().nextNumeric(5) 
+ "@syncope.apache.org");
         String connObjectKeyValue = "uid=" + userCR.getUsername() + 
",ou=People,o=isp";
         String privilege = 
APPLICATION_SERVICE.read("mightyApp").getPrivileges().get(0).getKey();
 
@@ -197,7 +197,7 @@ public class LinkedAccountITCase extends AbstractITCase {
     public void createWithoutLinkedAccountThenAdd() throws NamingException {
         // 1. create user without linked account
         UserCR userCR = UserITCase.getSample(
-                "linkedAccount" + RandomStringUtils.randomNumeric(5) + 
"@syncope.apache.org");
+                "linkedAccount" + RandomStringUtils.insecure().nextNumeric(5) 
+ "@syncope.apache.org");
         String connObjectKeyValue = "uid=" + userCR.getUsername() + 
",ou=People,o=isp";
 
         UserTO user = createUser(userCR).getEntity();
@@ -246,7 +246,7 @@ public class LinkedAccountITCase extends AbstractITCase {
 
         // 2. create user without linked account
         UserCR userCR = UserITCase.getSample(
-                "linkedAccount" + RandomStringUtils.randomNumeric(5) + 
"@syncope.apache.org");
+                "linkedAccount" + RandomStringUtils.insecure().nextNumeric(5) 
+ "@syncope.apache.org");
         String connObjectKeyValue = "uid=" + userCR.getUsername() + 
",ou=People,o=isp";
 
         UserTO user = createUser(userCR).getEntity();
@@ -269,7 +269,7 @@ public class LinkedAccountITCase extends AbstractITCase {
         userUR = new UserUR();
         userUR.setKey(user.getKey());
         userUR.getLinkedAccounts().add(new 
LinkedAccountUR.Builder().linkedAccountTO(account).build());
-        
+
         // 4.1 SYNCOPE-1824 update with a wrong password, a error must be 
raised
         account.setPassword("password");
         try {
@@ -280,7 +280,7 @@ public class LinkedAccountITCase extends AbstractITCase {
             assertEquals("InvalidUser [InvalidPassword: Password must be 10 or 
more characters in length.]",
                     sce.getMessage());
         }
-        
+
         // set a correct password
         account.setPassword("Password123");
         user = updateUser(userUR).getEntity();
@@ -323,7 +323,7 @@ public class LinkedAccountITCase extends AbstractITCase {
         try {
             // 1. create user with linked account
             UserCR userCR = UserITCase.getSample(
-                    "linkedAccount" + RandomStringUtils.randomNumeric(5) + 
"@syncope.apache.org");
+                    "linkedAccount" + 
RandomStringUtils.insecure().nextNumeric(5) + "@syncope.apache.org");
 
             LinkedAccountTO account = new 
LinkedAccountTO.Builder(RESOURCE_NAME_REST, connObjectKeyValue).build();
             userCR.getLinkedAccounts().add(account);
diff --git 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RESTITCase.java 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RESTITCase.java
index 6a8c168b05..23102e45c7 100644
--- 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RESTITCase.java
+++ 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/RESTITCase.java
@@ -78,7 +78,7 @@ public class RESTITCase extends AbstractITCase {
 
         // service with invalid JWT string: 401 unauthorized
         try {
-            CLIENT_FACTORY.create(RandomStringUtils.random(20, true, 
true)).self();
+            CLIENT_FACTORY.create(RandomStringUtils.insecure().next(20, true, 
true)).self();
             fail("This should not happen");
         } catch (AccessControlException e) {
             assertNotNull(e);
diff --git 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java
 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java
index 492b01f00e..f7266d49ce 100644
--- 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java
+++ 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java
@@ -441,7 +441,7 @@ public class SearchITCase extends AbstractITCase {
 
     @Test
     public void searchBySecurityAnswer() {
-        String securityAnswer = RandomStringUtils.randomAlphanumeric(10);
+        String securityAnswer = 
RandomStringUtils.insecure().nextAlphanumeric(10);
         UserCR userCR = 
UserITCase.getUniqueSample("[email protected]");
         userCR.setSecurityQuestion("887028ea-66fc-41e7-b397-620d7ea6dfbb");
         userCR.setSecurityAnswer(securityAnswer);
@@ -1030,14 +1030,14 @@ public class SearchITCase extends AbstractITCase {
                 // ignore
             }
         }
-        
+
         try {
             assertFalse(USER_SERVICE.search(new 
AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).details(false)
                     
.fiql(SyncopeClient.getUserSearchConditionBuilder().is("username")
                             .equalToIgnoreCase("user test 
1826").query()).build()).getResult().isEmpty());
             assertFalse(ANY_OBJECT_SERVICE.search(new 
AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM)
                     
.details(false).fiql(SyncopeClient.getAnyObjectSearchConditionBuilder(PRINTER).is("name")
-                            .equalToIgnoreCase("obj test 
1826").query()).build()).getResult().isEmpty());
+                    .equalToIgnoreCase("obj test 
1826").query()).build()).getResult().isEmpty());
             assertFalse(USER_SERVICE.search(new 
AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).details(false)
                     
.fiql(SyncopeClient.getUserSearchConditionBuilder().is("username")
                             .equalToIgnoreCase("user 1826 
test").query()).build()).getResult().isEmpty());
@@ -1051,5 +1051,5 @@ public class SearchITCase extends AbstractITCase {
             deleteUser("user test 182");
         }
     }
-    
+
 }
diff --git 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
index 14b94ce4e6..381328eaf9 100644
--- 
a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
+++ 
b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
@@ -1400,7 +1400,7 @@ public class UserITCase extends AbstractITCase {
             assertEquals("InvalidPassword: Password pwned", 
e.getElements().iterator().next());
         }
 
-        userCR.setPassword('1' + RandomStringUtils.randomAlphanumeric(10));
+        userCR.setPassword('1' + 
RandomStringUtils.insecure().nextAlphanumeric(10));
         UserTO userTO = createUser(userCR).getEntity();
         assertNotNull(userTO.getKey());
     }

Reply via email to