cm-cloud/cloud-token-in/src/test/java/com/cm/DecodeTest.java
2019-07-27 23:03:27 +08:00

51 lines
2.3 KiB
Java

package com.cm;
import com.cm.params.ParamsIn;
import com.cm.token.TokenDecoder;
import org.junit.Test;
/**
* @author Administrator
* @version 1.0
* @className DecodeTest
* @description TODO
* @date 2018/12/7 17:32
**/
public class DecodeTest {
@Test
public void tokenTest() throws Exception {
TokenDecoder tokenDecoder1 = TokenDecoder.getDecoder("OFZRQ2JDU2lCelgwcUozaUpWL3ROZWw2Y3VsbXhrOGhCMDNDYXN3am5RWHBlbkxwWnNaUElRZE53bXJNSTUwRldRbFdiQ3JnRFoxNlJlcXpkdUxwUHhSQm9RcVFlV2pLZ1lOU2tkemNUb3lsR1l4UTRvbnBmckVEWGdRUFJkWEc=").decode();
boolean isEffective1 = tokenDecoder1.isTokenEffective();
String[] tokenContents1 = tokenDecoder1.getTokenContents();
System.out.println("isEffective1: " + isEffective1);
for (int i = 0; i < tokenContents1.length; i++) {
System.out.println("tokenContents1_" + i + ": " + tokenContents1[i]);
}
// TokenDecoder tokenDecoder2 = TokenDecoder.getDecoder("c084dUxLUDdEaWhXZWpzZmw5MTV4b0ZHY2FreHRMZkIxSG9lejA5UFYyb3VOR0FwVUFEUHBYalJSUjgxS3J3R3JSc0RYNWJoWWh0KzQzSGdMRGVQV1E9PQ==").decode();
// boolean isEffective2 = tokenDecoder2.isTokenEffective();
// String[] tokenContents2 = tokenDecoder2.getTokenContents();
// System.out.println("isEffective2: " + isEffective2);
// for (int i = 0; i < tokenContents2.length; i++) {
// System.out.println("tokenContents2_" + i + ": " + tokenContents2[i]);
// }
//
// TokenDecoder tokenDecoder3 = TokenDecoder.getDecoder("Yy9aUm1qRGp1UlBRZWRNR01DTllmMHd0b2YwZlRCeGF2UG9jbWV3TnJLbm03VHFmTDY3b2ovbGQ3Qjc3S3JReTIyajRuUTN3bFNMM2VNdDFJMFNveGc9PQ==").decode();
// boolean isEffective3 = tokenDecoder3.isTokenEffective();
// String[] tokenContents3 = tokenDecoder3.getTokenContents();
// System.out.println("isEffective3: " + isEffective3);
// for (int i = 0; i < tokenContents3.length; i++) {
// System.out.println("tokenContents3_" + i + ": " + tokenContents3[i]);
// }
}
@Test
public void paramsTest() throws Exception {
System.out.println(ParamsIn.paramsOutDecoder("RlUraFNINTlsdlZZa1c2Z2RJWHFSVmlnOXZnWXFLaVFTZDVrQVFFOU55OD0="));
System.out.println(ParamsIn.paramsInEncode("张三李四王五赵六"));
}
}