Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

UserAuthBinding secret generator updated

  • Loading branch information...
commit 9e938cd533f442de85e0c83e569fe119bcb879b1 1 parent 195c3e6
@srnca srnca authored
Showing with 2 additions and 8 deletions.
  1. +2 −8 Service/app/models/UserAuthBinding.java
View
10 Service/app/models/UserAuthBinding.java
@@ -24,20 +24,14 @@
* @return secret converted to string
*/
public String generateSecret() {
- char[] setOfChars = {'0','1','2','3','4','5','6','7','8','9',
- 'a','b','c','d','e','f','g','h','i','j','k','l','m',
- 'n','o','p','q','r','s','t','u','v','w','x','y','z',
- 'A','B','C','D','E','F','G','H','I','J','K','L','M',
- 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
- ';','$','_','-','!','?','#',':','*','='};
-
+ String SECRET_CHARSET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ;$_-!?#:*=";
Random random = new Random();
StringBuilder strBuild = null;
List<User> users = User.findAll();
do {
strBuild = new StringBuilder();
for (int i=0; i<50; i++)
- strBuild.append(setOfChars[random.nextInt(setOfChars.length-1)]);
+ strBuild.append(SECRET_CHARSET.charAt(random.nextInt(SECRET_CHARSET.length()-1)));
for (User user : users) {
if ((strBuild != null) && (strBuild.toString().equals(user.secret)))
strBuild = null;
Please sign in to comment.
Something went wrong with that request. Please try again.