Class JWTCredentialValidatorTest
- java.lang.Object
-
- org.opensaml.core.testing.OpenSAMLInitBaseTestCase
-
- net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest
-
- net.shibboleth.idp.plugin.oidc.op.authn.impl.JWTCredentialValidatorTest
-
public class JWTCredentialValidatorTest extends net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTestUnit tests forJWTCredentialValidator.
-
-
Field Summary
Fields Modifier and Type Field Description private net.shibboleth.idp.authn.impl.ValidateCredentialsactionprivate net.shibboleth.oidc.jwt.claims.ClaimsValidatorclaimsValidator(package private) com.nimbusds.oauth2.sdk.id.ClientIDclientId(package private) com.nimbusds.oauth2.sdk.auth.SecretclientSecret(package private) URIendpointUri(package private) RSAPrivateKeyrsaPrivateKey(package private) RSAPublicKeyrsaPublicKeyprivate net.shibboleth.idp.plugin.oidc.op.authn.impl.JWTCredentialValidatorvalidator
-
Constructor Summary
Constructors Constructor Description JWTCredentialValidatorTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.nimbusds.jwt.JWTClaimsSetclaimsSetWithExpInThePast()protected com.nimbusds.jwt.JWTClaimsSetclaimsSetWithIatInTheFuture()protected com.nimbusds.jwt.JWTClaimsSetclaimsSetWithoutJit()protected voidcompleteSetup(com.nimbusds.oauth2.sdk.TokenRequest request, com.nimbusds.oauth2.sdk.auth.ClientAuthenticationMethod storedMethod, boolean sameSecret)protected net.shibboleth.oidc.jwt.claims.ClaimsValidatorconstructClaimsValidator(javax.servlet.http.HttpServletRequest httpRequest, ReplayCache replayCache)protected com.nimbusds.jwt.SignedJWTcreatePrivateKeyJWT(com.nimbusds.jwt.JWTClaimsSet claimsSet)protected com.nimbusds.jwt.SignedJWTcreateSecretJWT(com.nimbusds.jwt.JWTClaimsSet claimsSet)protected com.nimbusds.jwt.SignedJWTcreateSecretJWT(com.nimbusds.jwt.JWTClaimsSet claimsSet, String clientSecret)protected voidinitializeTokenRequest(com.nimbusds.oauth2.sdk.auth.ClientAuthenticationMethod method, com.nimbusds.jwt.SignedJWT jwt, boolean sameSecret)voidinitKeys()voidsetUp()protected voidtestFailingJwtAuth(com.nimbusds.oauth2.sdk.auth.ClientAuthenticationMethod method, com.nimbusds.jwt.SignedJWT jwt, boolean replay, boolean sameSecret)voidtestInvalidPrivateKeyJwt_expInThePast()voidtestInvalidPrivateKeyJwt_iatInTheFuture()voidtestInvalidPrivateKeyJwt_jitReplayDetected()voidtestInvalidPrivateKeyJwt_signature()voidtestInvalidPrivateKeyJwt_withoutJit()voidtestInvalidSecretJwt_expInThePast()voidtestInvalidSecretJwt_iatInTheFuture()voidtestInvalidSecretJwt_jitReplayDetected()voidtestInvalidSecretJwt_signature()voidtestInvalidSecretJwt_withoutJit()voidtestNoClaimsValidator()voidtestPrivateKeyJwt()voidtestSecretJwt()protected com.nimbusds.jwt.JWTClaimsSetvalidClaimsSet()
-
-
-
Field Detail
-
clientId
com.nimbusds.oauth2.sdk.id.ClientID clientId
-
clientSecret
com.nimbusds.oauth2.sdk.auth.Secret clientSecret
-
endpointUri
URI endpointUri
-
rsaPrivateKey
RSAPrivateKey rsaPrivateKey
-
rsaPublicKey
RSAPublicKey rsaPublicKey
-
claimsValidator
private net.shibboleth.oidc.jwt.claims.ClaimsValidator claimsValidator
-
validator
private net.shibboleth.idp.plugin.oidc.op.authn.impl.JWTCredentialValidator validator
-
action
private net.shibboleth.idp.authn.impl.ValidateCredentials action
-
-
Method Detail
-
initKeys
@BeforeClass public void initKeys() throws NoSuchAlgorithmException
- Throws:
NoSuchAlgorithmException
-
setUp
@BeforeMethod public void setUp() throws ComponentInitializationException
- Overrides:
setUpin classnet.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest- Throws:
ComponentInitializationException
-
completeSetup
protected void completeSetup(com.nimbusds.oauth2.sdk.TokenRequest request, com.nimbusds.oauth2.sdk.auth.ClientAuthenticationMethod storedMethod, boolean sameSecret) throws NoSuchAlgorithmException, com.nimbusds.jose.JOSEException- Throws:
NoSuchAlgorithmExceptioncom.nimbusds.jose.JOSEException
-
initializeTokenRequest
protected void initializeTokenRequest(com.nimbusds.oauth2.sdk.auth.ClientAuthenticationMethod method, com.nimbusds.jwt.SignedJWT jwt, boolean sameSecret) throws com.nimbusds.jose.JOSEException, NoSuchAlgorithmException- Throws:
com.nimbusds.jose.JOSEExceptionNoSuchAlgorithmException
-
constructClaimsValidator
protected net.shibboleth.oidc.jwt.claims.ClaimsValidator constructClaimsValidator(javax.servlet.http.HttpServletRequest httpRequest, ReplayCache replayCache)
-
testFailingJwtAuth
protected void testFailingJwtAuth(com.nimbusds.oauth2.sdk.auth.ClientAuthenticationMethod method, com.nimbusds.jwt.SignedJWT jwt, boolean replay, boolean sameSecret) throws Exception- Throws:
Exception
-
claimsSetWithIatInTheFuture
protected com.nimbusds.jwt.JWTClaimsSet claimsSetWithIatInTheFuture()
-
claimsSetWithExpInThePast
protected com.nimbusds.jwt.JWTClaimsSet claimsSetWithExpInThePast()
-
claimsSetWithoutJit
protected com.nimbusds.jwt.JWTClaimsSet claimsSetWithoutJit()
-
validClaimsSet
protected com.nimbusds.jwt.JWTClaimsSet validClaimsSet()
-
createSecretJWT
protected com.nimbusds.jwt.SignedJWT createSecretJWT(com.nimbusds.jwt.JWTClaimsSet claimsSet) throws com.nimbusds.jose.JOSEException- Throws:
com.nimbusds.jose.JOSEException
-
createSecretJWT
protected com.nimbusds.jwt.SignedJWT createSecretJWT(com.nimbusds.jwt.JWTClaimsSet claimsSet, String clientSecret) throws com.nimbusds.jose.JOSEException- Throws:
com.nimbusds.jose.JOSEException
-
createPrivateKeyJWT
protected com.nimbusds.jwt.SignedJWT createPrivateKeyJWT(com.nimbusds.jwt.JWTClaimsSet claimsSet) throws com.nimbusds.jose.JOSEException- Throws:
com.nimbusds.jose.JOSEException
-
testSecretJwt
public void testSecretJwt() throws com.nimbusds.jose.JOSEException, NoSuchAlgorithmException- Throws:
com.nimbusds.jose.JOSEExceptionNoSuchAlgorithmException
-
testPrivateKeyJwt
public void testPrivateKeyJwt() throws com.nimbusds.jose.JOSEException, NoSuchAlgorithmException- Throws:
com.nimbusds.jose.JOSEExceptionNoSuchAlgorithmException
-
testInvalidSecretJwt_signature
public void testInvalidSecretJwt_signature() throws Exception- Throws:
Exception
-
testInvalidSecretJwt_iatInTheFuture
public void testInvalidSecretJwt_iatInTheFuture() throws Exception- Throws:
Exception
-
testInvalidSecretJwt_expInThePast
public void testInvalidSecretJwt_expInThePast() throws Exception- Throws:
Exception
-
testInvalidSecretJwt_withoutJit
public void testInvalidSecretJwt_withoutJit() throws Exception- Throws:
Exception
-
testInvalidSecretJwt_jitReplayDetected
public void testInvalidSecretJwt_jitReplayDetected() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJwt_signature
public void testInvalidPrivateKeyJwt_signature() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJwt_iatInTheFuture
public void testInvalidPrivateKeyJwt_iatInTheFuture() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJwt_expInThePast
public void testInvalidPrivateKeyJwt_expInThePast() throws Exception- Throws:
Exception
-
testInvalidPrivateKeyJwt_withoutJit
public void testInvalidPrivateKeyJwt_withoutJit() throws Exception- Throws:
Exception
-
-