Class JWTCredentialValidatorTest


  • public class JWTCredentialValidatorTest
    extends net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest
    Unit tests for JWTCredentialValidator.
    • Field Detail

      • clientId

        com.nimbusds.oauth2.sdk.id.ClientID clientId
      • clientSecret

        com.nimbusds.oauth2.sdk.auth.Secret clientSecret
      • endpointUri

        URI endpointUri
      • 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
    • Constructor Detail

      • JWTCredentialValidatorTest

        public JWTCredentialValidatorTest()
    • Method Detail

      • 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:
        NoSuchAlgorithmException
        com.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.JOSEException
        NoSuchAlgorithmException
      • 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
      • testNoClaimsValidator

        public void testNoClaimsValidator()
                                   throws Exception
        Throws:
        Exception
      • 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
      • testInvalidPrivateKeyJwt_jitReplayDetected

        public void testInvalidPrivateKeyJwt_jitReplayDetected()
                                                        throws Exception
        Throws:
        Exception