Class JWSAssemblyUtilsTest
- java.lang.Object
-
- net.shibboleth.oidc.security.impl.JWSAssemblyUtilsTest
-
public class JWSAssemblyUtilsTest extends Object
Test forJWSAssemblyUtils.
-
-
Field Summary
Fields Modifier and Type Field Description private static StringSIMPLE_CLAIMS_PAYLOADA Simple JSON claims payload from RFC7515.
-
Constructor Summary
Constructors Constructor Description JWSAssemblyUtilsTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidtestAssembleMacJws()Test JWS generation and compare the generated HMAC against a newly generated HMAC from the same set of payload and content bytes.voidtestAssembleMacJwsCheckWithDifferentAlgorithm()Test verify the computed JWS HMAC using a HMAC generated with a different key.voidtestAssembleMacJwsCheckWithDifferentKey()Test verify the computed JWS HMAC using a HMAC generated with a different key.
-
-
-
Field Detail
-
SIMPLE_CLAIMS_PAYLOAD
private static final String SIMPLE_CLAIMS_PAYLOAD
A Simple JSON claims payload from RFC7515.- See Also:
- Constant Field Values
-
-
Method Detail
-
testAssembleMacJws
public final void testAssembleMacJws() throws ExceptionTest JWS generation and compare the generated HMAC against a newly generated HMAC from the same set of payload and content bytes.Note, as there is no process of 'canonicalization' we can not reliably compare a newly generated version of this JWS using a different JWT generation method - there is no invariant form e.g. they order the claims differently. As a result, we check the HMAC(Header.Payload) by taking the header and payload bytes from the generated JWS and compare to the generated signature component from the same JWS.
Use HMAC-SHA-256 for compatibility with the RFC.
- Throws:
Exception- on error
-
testAssembleMacJwsCheckWithDifferentKey
public final void testAssembleMacJwsCheckWithDifferentKey() throws ExceptionTest verify the computed JWS HMAC using a HMAC generated with a different key. Probably little worth in this test, other than to check generation is happening using the stated key.- Throws:
Exception- on error
-
testAssembleMacJwsCheckWithDifferentAlgorithm
public final void testAssembleMacJwsCheckWithDifferentAlgorithm() throws ExceptionTest verify the computed JWS HMAC using a HMAC generated with a different key. Probably little worth in this test, other than to check generation is happening using the stated algorithm.- Throws:
Exception- on error
-
-