File tree 1 file changed +5
-2
lines changed
src/java/main/com/cronos/onlinereview/util 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 20
20
import java .util .Date ;
21
21
22
22
import org .apache .struts2 .ServletActionContext ;
23
- import org .apache .xerces . utils .Base64 ;
23
+ import org .apache .commons . codec . binary .Base64 ;
24
24
25
25
import com .fasterxml .jackson .databind .JsonNode ;
26
26
import com .fasterxml .jackson .databind .ObjectMapper ;
@@ -101,12 +101,15 @@ public JwtTokenUpdater check() throws Exception {
101
101
if (tokenSplit .length <= 1 ) {
102
102
valid = false ;
103
103
} else {
104
- StringBuffer payloadStr = new StringBuffer (tokenSplit [1 ]);
104
+ /* StringBuffer payloadStr = new StringBuffer(tokenSplit[1]);
105
105
while (payloadStr.length() % 4 != 0) {
106
106
payloadStr.append('=');
107
107
}
108
108
109
109
String payload = new String(Base64.decode(payloadStr.toString().getBytes(StandardCharsets.UTF_8)));
110
+ */
111
+
112
+ String payload = new String (Base64 .decodeBase64 (tokenSplit [1 ]), "UTF-8" );
110
113
JsonNode jsonNode = objectMapper .readValue (payload .toString (), JsonNode .class );
111
114
112
115
long exp = jsonNode .get ("exp" ).asLong ();
You can’t perform that action at this time.
0 commit comments