Class OIDCRPFlowFromAuthenticationResponseTest

  • All Implemented Interfaces:
    junit.framework.Test

    public class OIDCRPFlowFromAuthenticationResponseTest
    extends OIDCRPFlowTest
    RP flow tests that start after the OpenID Provider redirect back to the RP's callback endpoint. As the initial actions are not run by these tests, most the context setup needs to be mocked.
    • Constructor Detail

      • OIDCRPFlowFromAuthenticationResponseTest

        public OIDCRPFlowFromAuthenticationResponseTest()
    • Method Detail

      • basicSetup

        private void basicSetup()
        Basic setup suitable for all tests.
      • queueMockServerResponse

        private void queueMockServerResponse​(okhttp3.mockwebserver.MockWebServer mockOPServer,
                                             int code,
                                             String body,
                                             String contentType)
        Queue a mock response. Simulating a response from the OP.
        Parameters:
        mockOPServer - the mock server
        code - the response HTTP code
        body - the response body
        contentType - the content type header
      • test_IDTokenHS256_PlainUserInfo

        public void test_IDTokenHS256_PlainUserInfo()
                                             throws Exception
        Test the flow from the external authorization request to the end of the flow. Using a MAC-signed id_token and plain UserInfo JSON Response.
        Throws:
        Exception - on error.
      • test_IDTokenHS256_UserInfoHS256

        public void test_IDTokenHS256_UserInfoHS256()
                                             throws Exception
        Throws:
        Exception
      • test_IDTokenHS256_UserInfoJWTNotSigned

        public void test_IDTokenHS256_UserInfoJWTNotSigned()
                                                    throws Exception
        Throws:
        Exception
      • test_IDTokenHS256_DirA128CBC_HS256_UserInfoES256_RSA_OAEP_256A256GCM

        public void test_IDTokenHS256_DirA128CBC_HS256_UserInfoES256_RSA_OAEP_256A256GCM()
                                                                                  throws Exception
        Throws:
        Exception
      • test_IDTokenHS256_RSA_OAEP_256_A256GCM_PlainUserInfo

        public void test_IDTokenHS256_RSA_OAEP_256_A256GCM_PlainUserInfo()
                                                                  throws Exception
        Uses symmetric MAC and asymmetric encryption. Plain UserInfo response.
        Throws:
        Exception - on error.
      • test_IDTokenHS256_PlainJWTUserInfoResponse

        public void test_IDTokenHS256_PlainJWTUserInfoResponse()
                                                        throws Exception
        Test a plain UserInfo JWT type. This can not happen, and should trigger an error on signature validation.
        Throws:
        Exception - on error.
      • test_IDTokenHS256_UserInfoHS256_WithACRAMRTranslation

        public void test_IDTokenHS256_UserInfoHS256_WithACRAMRTranslation()
                                                                   throws Exception
        Throws:
        Exception
      • testUnsupportedOIDCFlow

        public void testUnsupportedOIDCFlow()
                                     throws Exception
        Test the flow terminates correctly when an unsupported flow is used - which is unlikely to get this far.
        Throws:
        Exception - on error.
      • testErrorAuthenticationResponse

        public void testErrorAuthenticationResponse()
                                             throws Exception
        Test the flow from the external authorization request to the end of the flow when an error is returned from the downstream OP.
        Throws:
        Exception - on error.
      • test_IDTokenHS256_NoIssuer_PlainUserInfo

        public void test_IDTokenHS256_NoIssuer_PlainUserInfo()
                                                      throws Exception
        Test a suitable error occurs if the id_token does not contain an issuer.
        Throws:
        Exception - on error.
      • test_IDTokenHS256_NoSub_PlainUserInfo

        public void test_IDTokenHS256_NoSub_PlainUserInfo()
                                                   throws Exception
        Test a suitable error occurs if the id_token does not contain a subject.
        Throws:
        Exception - on error.
      • test_IDTokenHS256_NoAudience_PlainUserInfo

        public void test_IDTokenHS256_NoAudience_PlainUserInfo()
                                                        throws Exception
        Test a suitable error occurs if the id_token does not contain an audience.
        Throws:
        Exception - on error.
      • test_IDTokenHS256_NoIssuedAt_PlainUserInfo

        public void test_IDTokenHS256_NoIssuedAt_PlainUserInfo()
                                                        throws Exception
        Test a suitable error occurs if the id_token does not contain an issued-at time.
        Throws:
        Exception - on error.
      • test_IDTokenHS256_InvalidNonce_PlainUserInfo

        public void test_IDTokenHS256_InvalidNonce_PlainUserInfo()
                                                          throws Exception
        Test a suitable error occurs if the id_token does not contain a valid nonce.
        Throws:
        Exception - on error.
      • test_IDTokenHS256_InvalidPlainUserInfo_NoSub

        public void test_IDTokenHS256_InvalidPlainUserInfo_NoSub()
                                                          throws Exception
        Test the flow from the external authorization request to the end of the flow. Using a MAC signed id_token and an invalid UserInfo JSON Response - it has no subject.
        Throws:
        Exception - on error.
      • test_IDTokenHS256_InvalidPlainUserInfo_SubDoesNotMatchIdToken

        public void test_IDTokenHS256_InvalidPlainUserInfo_SubDoesNotMatchIdToken()
                                                                           throws Exception
        Test the flow from the external authorization request to the end of the flow. Using a MAC signed id_token and an invalid UserInfo JSON Response - it has no subject.
        Throws:
        Exception - on error.