Class JWTSignatureValidationUtilTest
- java.lang.Object
-
- net.shibboleth.oidc.security.impl.JWTSignatureValidationUtilTest
-
public class JWTSignatureValidationUtilTest extends Object
Unit tests forJWTSignatureValidationUtil.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) BasicJWKCredentialecCredential(package private) StringinvalidJwtEventId(package private) BasicJWKCredentialrsaCredential(package private) BasicJWKCredentialsharedCredential
-
Constructor Summary
Constructors Constructor Description JWTSignatureValidationUtilTest()
-
Method Summary
-
-
-
Field Detail
-
invalidJwtEventId
final String invalidJwtEventId
- See Also:
- Constant Field Values
-
rsaCredential
BasicJWKCredential rsaCredential
-
ecCredential
BasicJWKCredential ecCredential
-
sharedCredential
BasicJWKCredential sharedCredential
-
-
Method Detail
-
init
@BeforeClass public void init() throws NoSuchAlgorithmException
- Throws:
NoSuchAlgorithmException
-
validateSignature_shouldReturnInvalidSecCfgWhenNoSecCtx
public void validateSignature_shouldReturnInvalidSecCfgWhenNoSecCtx()
-
validateSignature_shouldReturnInvalidSecCfgWhenNoSecCtxObject
public void validateSignature_shouldReturnInvalidSecCfgWhenNoSecCtxObject()
-
validateSignature_shouldReturnInvalidSecCfgWhenNoSigningParameters
public void validateSignature_shouldReturnInvalidSecCfgWhenNoSigningParameters()
-
validateSignature_shouldReturnInvalidSecCfgWhenWrongSigningParameters
public void validateSignature_shouldReturnInvalidSecCfgWhenWrongSigningParameters()
-
validateSignature_shouldReturnNullWhenValidRSASignature
public void validateSignature_shouldReturnNullWhenValidRSASignature() throws com.nimbusds.jose.JOSEException, ParseException, NoSuchAlgorithmException- Throws:
com.nimbusds.jose.JOSEExceptionParseExceptionNoSuchAlgorithmException
-
validateSignature_shouldReturnEventIdWhenInvalidRSASignature
public void validateSignature_shouldReturnEventIdWhenInvalidRSASignature() throws NoSuchAlgorithmException, com.nimbusds.jose.JOSEException, ParseException- Throws:
NoSuchAlgorithmExceptioncom.nimbusds.jose.JOSEExceptionParseException
-
validateSignature_shouldReturnNullWhenValidECSignature
public void validateSignature_shouldReturnNullWhenValidECSignature() throws com.nimbusds.jose.JOSEException, ParseException, NoSuchAlgorithmException- Throws:
com.nimbusds.jose.JOSEExceptionParseExceptionNoSuchAlgorithmException
-
validateSignature_shouldReturnEventIdWhenInvalidECSignature
public void validateSignature_shouldReturnEventIdWhenInvalidECSignature() throws com.nimbusds.jose.JOSEException, ParseException, NoSuchAlgorithmException- Throws:
com.nimbusds.jose.JOSEExceptionParseExceptionNoSuchAlgorithmException
-
validateSignature_shouldReturnNullWhenValidMACSignature
public void validateSignature_shouldReturnNullWhenValidMACSignature() throws com.nimbusds.jose.JOSEException, ParseException- Throws:
com.nimbusds.jose.JOSEExceptionParseException
-
validateSignature_shouldReturnEventIdWhenInvalidMACSignature
public void validateSignature_shouldReturnEventIdWhenInvalidMACSignature() throws com.nimbusds.jose.JOSEException, ParseException- Throws:
com.nimbusds.jose.JOSEExceptionParseException
-
validateSignature_credentialOnly_shouldReturnNullWhenValidMACSignature
public void validateSignature_credentialOnly_shouldReturnNullWhenValidMACSignature() throws com.nimbusds.jose.JOSEException, ParseException- Throws:
com.nimbusds.jose.JOSEExceptionParseException
-
validateSignature_credentialOnly_shouldReturnEventIdWhenInvalidMACSignature
public void validateSignature_credentialOnly_shouldReturnEventIdWhenInvalidMACSignature() throws com.nimbusds.jose.JOSEException, ParseException- Throws:
com.nimbusds.jose.JOSEExceptionParseException
-
signRSA
protected com.nimbusds.jwt.SignedJWT signRSA(PrivateKey privateKey) throws com.nimbusds.jose.JOSEException, ParseException
- Throws:
com.nimbusds.jose.JOSEExceptionParseException
-
signEC
protected com.nimbusds.jwt.SignedJWT signEC(ECPrivateKey privateKey) throws com.nimbusds.jose.JOSEException, ParseException
- Throws:
com.nimbusds.jose.JOSEExceptionParseException
-
createKeyPairCredential
protected BasicJWKCredential createKeyPairCredential(String keyPairAlgorithm, String jwsAlgorithm, String kid, int keysize) throws NoSuchAlgorithmException
- Throws:
NoSuchAlgorithmException
-
createSharedSecretCredential
protected BasicJWKCredential createSharedSecretCredential(String jwsAlgorithm, String kid)
-
generateSecretKey
protected SecretKey generateSecretKey()
-
signMAC
protected com.nimbusds.jwt.SignedJWT signMAC(SecretKey secretKey) throws com.nimbusds.jose.JOSEException, ParseException
- Throws:
com.nimbusds.jose.JOSEExceptionParseException
-
initSecurityParamsContext
protected SecurityParametersContext initSecurityParamsContext(String algorithm, BasicJWKCredential... credentials)
-
-