Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 07A9A1866C for ; Mon, 11 Jan 2016 16:20:17 +0000 (UTC) Received: (qmail 6286 invoked by uid 500); 11 Jan 2016 16:20:16 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 6187 invoked by uid 500); 11 Jan 2016 16:20:16 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 6178 invoked by uid 99); 11 Jan 2016 16:20:16 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Jan 2016 16:20:16 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 61A84E07F7; Mon, 11 Jan 2016 16:20:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: coheigea@apache.org To: commits@cxf.apache.org Message-Id: <80186ec74bbb4f5f8fd207d09ed1f143@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cxf-fediz git commit: Adding a test Date: Mon, 11 Jan 2016 16:20:16 +0000 (UTC) Repository: cxf-fediz Updated Branches: refs/heads/master 256a8599b -> db74b690c Adding a test Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/db74b690 Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/db74b690 Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/db74b690 Branch: refs/heads/master Commit: db74b690ce3421efa81a0ecd1919e64e937741f8 Parents: 256a859 Author: Colm O hEigeartaigh Authored: Mon Jan 11 16:19:47 2016 +0000 Committer: Colm O hEigeartaigh Committed: Mon Jan 11 16:19:47 2016 +0000 ---------------------------------------------------------------------- .../core/federation/FederationResponseTest.java | 35 ++++++++++++++++++++ .../src/test/resources/fediz_test_config.xml | 31 +++++++++++++++++ 2 files changed, 66 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/db74b690/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationResponseTest.java ---------------------------------------------------------------------- diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationResponseTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationResponseTest.java index 125a2ec..d6d97f8 100644 --- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationResponseTest.java +++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationResponseTest.java @@ -1572,6 +1572,41 @@ public class FederationResponseTest { } } + @org.junit.Test + public void testUnableToFindTruststore() throws Exception { + SAML2CallbackHandler callbackHandler = new SAML2CallbackHandler(); + callbackHandler.setStatement(SAML2CallbackHandler.Statement.ATTR); + callbackHandler.setConfirmationMethod(SAML2Constants.CONF_BEARER); + callbackHandler.setIssuer(TEST_RSTR_ISSUER); + callbackHandler.setSubjectName(TEST_USER); + ConditionsBean cp = new ConditionsBean(); + AudienceRestrictionBean audienceRestriction = new AudienceRestrictionBean(); + audienceRestriction.getAudienceURIs().add(TEST_AUDIENCE); + cp.setAudienceRestrictions(Collections.singletonList(audienceRestriction)); + callbackHandler.setConditions(cp); + + SAMLCallback samlCallback = new SAMLCallback(); + SAMLUtil.doSAMLCallback(callbackHandler, samlCallback); + SamlAssertionWrapper assertion = new SamlAssertionWrapper(samlCallback); + String rstr = createSamlToken(assertion, "mystskey", true); + + FedizRequest wfReq = new FedizRequest(); + wfReq.setAction(FederationConstants.ACTION_SIGNIN); + wfReq.setResponseToken(rstr); + + configurator = null; + FedizContext config = getFederationConfigurator().getFedizContext("BAD_KEYSTORE"); + + FedizProcessor wfProc = new FederationProcessorImpl(); + try { + wfProc.processRequest(wfReq, config); + fail("Failure expected on being unable to find the truststore"); + } catch (ProcessingException ex) { + ex.printStackTrace(); + // expected + } + } + private String encryptAndSignToken( SamlAssertionWrapper assertion ) throws Exception { http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/db74b690/plugins/core/src/test/resources/fediz_test_config.xml ---------------------------------------------------------------------- diff --git a/plugins/core/src/test/resources/fediz_test_config.xml b/plugins/core/src/test/resources/fediz_test_config.xml index 0feb9b9..82d1a3a 100644 --- a/plugins/core/src/test/resources/fediz_test_config.xml +++ b/plugins/core/src/test/resources/fediz_test_config.xml @@ -345,4 +345,35 @@ + + + http://host_one:port/url + + + + + + + + + + + 1000 + + target realm + http://url_to_the_issuer + ; + http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role + + 10000 + reply value + REQUEST + + + + + +