Skip to content

Instantly share code, notes, and snippets.

Avatar
😬
Breaking Things

Arpit Jain calvincodes

😬
Breaking Things
View GitHub Profile
View jar-packaged-handler-jetty-error-logs
➜ war-packaging git:(master) ✗ java -jar ~/Desktop/jetty-home/start.jar
05/28/20 11:26:18 [INFO] Logging initialized @163ms to org.eclipse.jetty.util.log.Slf4jLog
05/28/20 11:26:19 [WARNING] Config error at <Call name="insertHandler"><Arg>
<New id="CustomJettyHandler" class="com.github.calvincodes.CustomHandlerJarPackaged"/>
</Arg></Call>
05/28/20 11:26:19 [WARNING]
java.lang.IllegalStateException: No Method: <Call name="insertHandler"><Arg>
<New id="CustomJettyHandler" class="com.github.calvincodes.CustomHandlerJarPackaged"/>
</Arg></Call> on class org.eclipse.jetty.server.Server
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.call(XmlConfiguration.java:971)
View jar-packaged-handler-jetty-list-config
➜ war-packaging git:(master) ✗ java -jar ~/Desktop/jetty-home/start.jar --list-config
Java Environment:
-----------------
java.home = /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre (null)
java.vm.vendor = Oracle Corporation (null)
java.vm.version = 25.181-b13 (null)
java.vm.name = Java HotSpot(TM) 64-Bit Server VM (null)
java.vm.info = mixed mode (null)
java.runtime.name = Java(TM) SE Runtime Environment (null)
View war-packaged-handler-jetty-error-logs
➜ war-packaging git:(master) ✗ java -jar ~/Desktop/jetty-home/start.jar
05/28/20 11:05:21 [INFO] Logging initialized @167ms to org.eclipse.jetty.util.log.Slf4jLog
05/28/20 11:05:22 [WARNING] Config error at <Call name="insertHandler"><Arg>
<New id="CustomJettyHandler" class="com.github.calvincodes.CustomHandlerWarPackaged"/>
</Arg></Call>
05/28/20 11:05:22 [WARNING]
java.security.PrivilegedActionException: java.lang.ClassNotFoundException: com.github.calvincodes.CustomHandlerWarPackaged
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1878)
Caused by: java.lang.ClassNotFoundException: com.github.calvincodes.CustomHandlerWarPackaged
View war-packaged-handler-jetty-list-config
➜ war-packaging git:(master) ✗ java -jar ~/Desktop/jetty-home/start.jar --list-config
Java Environment:
-----------------
java.home = /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre (null)
java.vm.vendor = Oracle Corporation (null)
java.vm.version = 25.181-b13 (null)
java.vm.name = Java HotSpot(TM) 64-Bit Server VM (null)
java.vm.info = mixed mode (null)
java.runtime.name = Java(TM) SE Runtime Environment (null)
@calvincodes
calvincodes / jwt_creation_4_to_5.scala
Created Aug 14, 2019
Describes Step 4 to 5 of JWT creation
View jwt_creation_4_to_5.scala
val hash = hash_alg(data, secret_key) // Step 4
val signature = base64UrlEncode(hash) // Step 5
@calvincodes
calvincodes / jwt_creation_1_to_3.scala
Created Aug 14, 2019
Describes Step 1 to 3 of JWT creation
View jwt_creation_1_to_3.scala
val header = base64UrlEncode(header_json) // Step 1
val payload = base64UrlEncode(payload_json) // Step 2
val data = header + "." + payload // Step 3
@calvincodes
calvincodes / jwt_verification_6.scala
Created Aug 14, 2019
Describes Step 6 of JWT verification
View jwt_verification_6.scala
// For reference
// received_jwt = abcde.fghij.klmno (header.payload.signature)
// Step 6.1
val received_signature = extract_sig(received_jwt) // klmno
// Step 6.2
val can_trust = (received_signature == expected_signature)
@calvincodes
calvincodes / jwt_verification_4_to_5.scala
Created Aug 14, 2019
Describes Step 4 to 5 of JWT verification
View jwt_verification_4_to_5.scala
val hash_of_rcvd_data = hash_alg(rcvd_data, secret_key) // Step 4
val expected_signature = base64UrlEncode(hash_of_rcvd_data) // Step 5
@calvincodes
calvincodes / jwt_verification_1_to_3.scala
Created Aug 14, 2019
Describes Step 1 to 3 of JWT verification
View jwt_verification_1_to_3.scala
// For reference
// received_jwt = abcde.fghij.klmno (header.payload.signature)
// Step 1
val received_header = extract_header(received_jwt) // abcde
// Step 2
val received_payload = extract_payload(received_jwt) // fghij
// Step 3
@calvincodes
calvincodes / payload.json
Created Aug 13, 2019
Sample JWT Payload
View payload.json
{
"id": "12345-abcde-67890-fghij",
"loginSource": "google_oauth",
"maxIdleTime": "1h"
}