Last active
September 13, 2017 22:13
-
-
Save gmarziou/b7d59bec6925dc073fa242ecfce109f0 to your computer and use it in GitHub Desktop.
Size of JHipster JWT
This file contains hidden or 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
Current | No role | Deflate | # | |
--------+---------+---------+--- | |
176 | 170 | 200 | 1 | |
191 | 178 | 210 | 2 | |
206 | 186 | 219 | 3 | |
220 | 194 | 228 | 4 | |
235 | 202 | 238 | 5 | |
250 | 210 | 247 | 6 | |
264 | 218 | 255 | 7 | |
279 | 226 | 263 | 8 | |
294 | 234 | 271 | 9 | |
308 | 242 | 280 | 10 | |
323 | 250 | 288 | 11 | |
338 | 258 | 296 | 12 | |
352 | 266 | 304 | 13 | |
367 | 274 | 314 | 14 | |
382 | 282 | 320 | 15 | |
396 | 290 | 326 | 16 | |
411 | 298 | 331 | 17 | |
426 | 306 | 336 | 18 | |
440 | 314 | 344 | 19 | |
455 | 322 | 350 | 20 | |
470 | 330 | 355 | 21 | |
484 | 338 | 362 | 22 | |
499 | 346 | 368 | 23 | |
514 | 354 | 375 | 24 | |
528 | 362 | 380 | 25 | |
543 | 370 | 386 | 26 | |
558 | 378 | 391 | 27 | |
572 | 386 | 396 | 28 | |
587 | 394 | 404 | 29 | |
602 | 402 | 408 | 30 | |
616 | 410 | 415 | 31 | |
631 | 418 | 420 | 32 | |
646 | 426 | 426 | 33 | |
660 | 434 | 432 | 34 | |
675 | 442 | 438 | 35 | |
690 | 450 | 444 | 36 | |
704 | 458 | 450 | 37 | |
719 | 466 | 454 | 38 | |
734 | 474 | 459 | 39 | |
748 | 482 | 463 | 40 | |
763 | 490 | 467 | 41 | |
778 | 498 | 475 | 42 | |
792 | 506 | 479 | 43 | |
807 | 514 | 486 | 44 | |
822 | 522 | 491 | 45 | |
836 | 530 | 498 | 46 | |
851 | 538 | 503 | 47 | |
866 | 546 | 508 | 48 | |
880 | 554 | 514 | 49 | |
895 | 562 | 519 | 50 | |
ROLE_ADMIN,ROLE_DKGKX,ROLE_TZZXV,ROLE_VSLUW,ROLE_YAVQJ,ROLE_XFBTD,ROLE_TFTOF,ROLE_YQWJQ,ROLE_USHAV,ROLE_CEKCZ,ROLE_RFKVV,ROLE_RJPPF,ROLE_WKOYN,ROLE_IJQZY,ROLE_NFVRW,ROLE_KSDRY,ROLE_XAOCS,ROLE_FUZYE,ROLE_KQQJX,ROLE_VYHRL,ROLE_DFRBT,ROLE_AEDGR,ROLE_GHCEC,ROLE_SHNQJ,ROLE_SEFCW,ROLE_UJWFQ,ROLE_NYFLS,ROLE_CQGKC,ROLE_BDLUC,ROLE_VZEZY,ROLE_CKVAV,ROLE_UTYGQ,ROLE_XXNFE,ROLE_JWPTS,ROLE_MVZKF,ROLE_GFEPQ,ROLE_ZRKZQ,ROLE_BSDRR,ROLE_UWFTQ,ROLE_FUTRL,ROLE_RFMJG,ROLE_IVPTY,ROLE_SSDAD,ROLE_FUTNU,ROLE_QORVD,ROLE_BATRA,ROLE_EEZJS,ROLE_AQBDX,ROLE_EYYFR,ROLE_FLABD,ROLE_NANUM |
This file contains hidden or 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
package io.github.jhipster.security.jwt; | |
import io.jsonwebtoken.CompressionCodecs; | |
import io.jsonwebtoken.Jwts; | |
import io.jsonwebtoken.SignatureAlgorithm; | |
import org.apache.commons.lang3.RandomStringUtils; | |
import java.util.Date; | |
public class TokenGeneratorCLI { | |
private static final String AUTHORITIES_KEY = "auth"; | |
public static void main(String[] args) { | |
String authorities= "ROLE_ADMIN"; | |
String roles = "ADMIN"; | |
long now = (new Date()).getTime(); | |
Date validity; | |
validity = new Date(now + 100000000); | |
String secretKey = "c9d37cefc48581919939d587c750ea215020765b"; | |
String subject = "user"; | |
System.out.println("Current | No role | Deflate | # "); | |
System.out.println("--------+---------+---------+---"); | |
for (int i = 1; i <= 50; i++) { | |
String token = Jwts.builder() | |
.setSubject(subject) | |
.claim(AUTHORITIES_KEY, authorities) | |
.signWith(SignatureAlgorithm.HS512, secretKey) | |
.setExpiration(validity) | |
.compact(); | |
String noPrefix = Jwts.builder() | |
.setSubject(subject) | |
.claim(AUTHORITIES_KEY, roles) | |
.signWith(SignatureAlgorithm.HS512, secretKey) | |
.setExpiration(validity) | |
.compact(); | |
String compressed = Jwts.builder() | |
.setSubject(subject) | |
.claim(AUTHORITIES_KEY, authorities) | |
.compressWith(CompressionCodecs.DEFLATE) | |
.signWith(SignatureAlgorithm.HS512, secretKey) | |
.setExpiration(validity) | |
.compact(); | |
System.out.println(" " + token.length() + " | " + noPrefix.length() + " | " + compressed.length() + " | " + i); | |
String name = RandomStringUtils.randomAlphabetic(5).toUpperCase(); | |
authorities = authorities + ",ROLE_" + name; | |
roles= roles + "," + name; | |
} | |
System.out.println(authorities); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment