JWSHeader header = JWSHeader.parse(b64header);
assertEquals("HS256 alg check", JWSAlgorithm.HS256, header.getAlgorithm());
assertEquals("JWT type check", new JOSEObjectType("JWT"), header.getType());
JWSObject jwsObject = new JWSObject(header, payload);
assertEquals("State check", JWSObject.State.UNSIGNED, jwsObject.getState());
MACSigner signer = new MACSigner(sharedSecret);
assertEquals("Shared secret check", sharedSecret, signer.getSharedSecret());
jwsObject.sign(signer);
assertEquals("State check", JWSObject.State.SIGNED, jwsObject.getState());
MACVerifier verifier = new MACVerifier(sharedSecret);
assertEquals("Shared secret check", sharedSecret, verifier.getSharedSecret());
boolean verified = jwsObject.verify(verifier);
assertTrue("Verified signature", verified);
assertEquals("State check", JWSObject.State.VERIFIED, jwsObject.getState());
}