File tree Expand file tree Collapse file tree
server/src/main/java/com/cloud/projects Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717package com .cloud .projects ;
1818
1919import java .io .UnsupportedEncodingException ;
20+ import java .security .SecureRandom ;
2021import java .util .List ;
2122import java .util .Map ;
2223import java .util .Optional ;
23- import java .util .Random ;
2424import java .util .TimeZone ;
2525import java .util .UUID ;
2626import java .util .concurrent .Executors ;
106106public class ProjectManagerImpl extends ManagerBase implements ProjectManager , Configurable {
107107 public static final Logger s_logger = Logger .getLogger (ProjectManagerImpl .class );
108108
109+ private static final SecureRandom secureRandom = new SecureRandom ();
110+
109111 @ Inject
110112 private DomainDao _domainDao ;
111113 @ Inject
@@ -1349,10 +1351,9 @@ private boolean suspendProject(ProjectVO project) throws ConcurrentOperationExce
13491351
13501352 public static String generateToken (int length ) {
13511353 String charset = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
1352- Random rand = new Random (System .currentTimeMillis ());
13531354 StringBuffer sb = new StringBuffer ();
13541355 for (int i = 0 ; i < length ; i ++) {
1355- int pos = rand .nextInt (charset .length ());
1356+ int pos = secureRandom .nextInt (charset .length ());
13561357 sb .append (charset .charAt (pos ));
13571358 }
13581359 return sb .toString ();
You can’t perform that action at this time.
0 commit comments