@Test public void generateArtifactRequestTest() { ArtifactResolve ar = artifactBindingHelper.generateArtifactResolveRequest("test1234", pkEntry, idpUrl); Assert.assertEquals("test1234", ar.getArtifact().getArtifact()); Assert.assertTrue(ar.isSigned()); Assert.assertNotNull(ar.getSignature().getKeyInfo().getX509Datas()); Assert.assertEquals(ar.getDestination(), idpUrl); Assert.assertEquals(issuerName, ar.getIssuer().getValue()); }
protected ArtifactResolve generateArtifactResolveRequest(String artifactString, KeyStore.PrivateKeyEntry pkEntry, String idpUrl) { XMLObjectBuilderFactory xmlObjectBuilderFactory = Configuration.getBuilderFactory(); Artifact artifact = (Artifact) xmlObjectBuilderFactory.getBuilder(Artifact.DEFAULT_ELEMENT_NAME).buildObject(Artifact.DEFAULT_ELEMENT_NAME); artifact.setArtifact(artifactString); Issuer issuer = (Issuer) xmlObjectBuilderFactory.getBuilder(Issuer.DEFAULT_ELEMENT_NAME).buildObject(Issuer.DEFAULT_ELEMENT_NAME); issuer.setValue(issuerName); ArtifactResolve artifactResolve = (ArtifactResolve) xmlObjectBuilderFactory.getBuilder(ArtifactResolve.DEFAULT_ELEMENT_NAME).buildObject(ArtifactResolve.DEFAULT_ELEMENT_NAME); artifactResolve.setIssuer(issuer); artifactResolve.setIssueInstant(new DateTime()); artifactResolve.setID(UUID.randomUUID().toString()); artifactResolve.setDestination(idpUrl); artifactResolve.setArtifact(artifact); Signature signature = samlHelper.getDigitalSignature(pkEntry); artifactResolve.setSignature(signature); try { Configuration.getMarshallerFactory().getMarshaller(artifactResolve).marshall(artifactResolve); } catch (MarshallingException ex) { LOG.error("Error composing artifact resolution request: Marshalling artifact resolution request failed", ex); throw new IllegalArgumentException("Couldn't compose artifact resolution request", ex); } try { Signer.signObject(signature); } catch (SignatureException ex) { LOG.error("Error composing artifact resolution request: Failed to sign artifact resolution request", ex); throw new IllegalArgumentException("Couldn't compose artifact resolution request", ex); } return artifactResolve; }
ArtifactBindingHelper { protected ArtifactResolve generateArtifactResolveRequest(String artifactString, KeyStore.PrivateKeyEntry pkEntry, String idpUrl) { XMLObjectBuilderFactory xmlObjectBuilderFactory = Configuration.getBuilderFactory(); Artifact artifact = (Artifact) xmlObjectBuilderFactory.getBuilder(Artifact.DEFAULT_ELEMENT_NAME).buildObject(Artifact.DEFAULT_ELEMENT_NAME); artifact.setArtifact(artifactString); Issuer issuer = (Issuer) xmlObjectBuilderFactory.getBuilder(Issuer.DEFAULT_ELEMENT_NAME).buildObject(Issuer.DEFAULT_ELEMENT_NAME); issuer.setValue(issuerName); ArtifactResolve artifactResolve = (ArtifactResolve) xmlObjectBuilderFactory.getBuilder(ArtifactResolve.DEFAULT_ELEMENT_NAME).buildObject(ArtifactResolve.DEFAULT_ELEMENT_NAME); artifactResolve.setIssuer(issuer); artifactResolve.setIssueInstant(new DateTime()); artifactResolve.setID(UUID.randomUUID().toString()); artifactResolve.setDestination(idpUrl); artifactResolve.setArtifact(artifact); Signature signature = samlHelper.getDigitalSignature(pkEntry); artifactResolve.setSignature(signature); try { Configuration.getMarshallerFactory().getMarshaller(artifactResolve).marshall(artifactResolve); } catch (MarshallingException ex) { LOG.error("Error composing artifact resolution request: Marshalling artifact resolution request failed", ex); throw new IllegalArgumentException("Couldn't compose artifact resolution request", ex); } try { Signer.signObject(signature); } catch (SignatureException ex) { LOG.error("Error composing artifact resolution request: Failed to sign artifact resolution request", ex); throw new IllegalArgumentException("Couldn't compose artifact resolution request", ex); } return artifactResolve; } }
ArtifactBindingHelper { protected ArtifactResolve generateArtifactResolveRequest(String artifactString, KeyStore.PrivateKeyEntry pkEntry, String idpUrl) { XMLObjectBuilderFactory xmlObjectBuilderFactory = Configuration.getBuilderFactory(); Artifact artifact = (Artifact) xmlObjectBuilderFactory.getBuilder(Artifact.DEFAULT_ELEMENT_NAME).buildObject(Artifact.DEFAULT_ELEMENT_NAME); artifact.setArtifact(artifactString); Issuer issuer = (Issuer) xmlObjectBuilderFactory.getBuilder(Issuer.DEFAULT_ELEMENT_NAME).buildObject(Issuer.DEFAULT_ELEMENT_NAME); issuer.setValue(issuerName); ArtifactResolve artifactResolve = (ArtifactResolve) xmlObjectBuilderFactory.getBuilder(ArtifactResolve.DEFAULT_ELEMENT_NAME).buildObject(ArtifactResolve.DEFAULT_ELEMENT_NAME); artifactResolve.setIssuer(issuer); artifactResolve.setIssueInstant(new DateTime()); artifactResolve.setID(UUID.randomUUID().toString()); artifactResolve.setDestination(idpUrl); artifactResolve.setArtifact(artifact); Signature signature = samlHelper.getDigitalSignature(pkEntry); artifactResolve.setSignature(signature); try { Configuration.getMarshallerFactory().getMarshaller(artifactResolve).marshall(artifactResolve); } catch (MarshallingException ex) { LOG.error("Error composing artifact resolution request: Marshalling artifact resolution request failed", ex); throw new IllegalArgumentException("Couldn't compose artifact resolution request", ex); } try { Signer.signObject(signature); } catch (SignatureException ex) { LOG.error("Error composing artifact resolution request: Failed to sign artifact resolution request", ex); throw new IllegalArgumentException("Couldn't compose artifact resolution request", ex); } return artifactResolve; }  }
ArtifactBindingHelper { protected ArtifactResolve generateArtifactResolveRequest(String artifactString, KeyStore.PrivateKeyEntry pkEntry, String idpUrl) { XMLObjectBuilderFactory xmlObjectBuilderFactory = Configuration.getBuilderFactory(); Artifact artifact = (Artifact) xmlObjectBuilderFactory.getBuilder(Artifact.DEFAULT_ELEMENT_NAME).buildObject(Artifact.DEFAULT_ELEMENT_NAME); artifact.setArtifact(artifactString); Issuer issuer = (Issuer) xmlObjectBuilderFactory.getBuilder(Issuer.DEFAULT_ELEMENT_NAME).buildObject(Issuer.DEFAULT_ELEMENT_NAME); issuer.setValue(issuerName); ArtifactResolve artifactResolve = (ArtifactResolve) xmlObjectBuilderFactory.getBuilder(ArtifactResolve.DEFAULT_ELEMENT_NAME).buildObject(ArtifactResolve.DEFAULT_ELEMENT_NAME); artifactResolve.setIssuer(issuer); artifactResolve.setIssueInstant(new DateTime()); artifactResolve.setID(UUID.randomUUID().toString()); artifactResolve.setDestination(idpUrl); artifactResolve.setArtifact(artifact); Signature signature = samlHelper.getDigitalSignature(pkEntry); artifactResolve.setSignature(signature); try { Configuration.getMarshallerFactory().getMarshaller(artifactResolve).marshall(artifactResolve); } catch (MarshallingException ex) { LOG.error("Error composing artifact resolution request: Marshalling artifact resolution request failed", ex); throw new IllegalArgumentException("Couldn't compose artifact resolution request", ex); } try { Signer.signObject(signature); } catch (SignatureException ex) { LOG.error("Error composing artifact resolution request: Failed to sign artifact resolution request", ex); throw new IllegalArgumentException("Couldn't compose artifact resolution request", ex); } return artifactResolve; }   }
ArtifactBindingHelper { protected ArtifactResolve generateArtifactResolveRequest(String artifactString, KeyStore.PrivateKeyEntry pkEntry, String idpUrl) { XMLObjectBuilderFactory xmlObjectBuilderFactory = Configuration.getBuilderFactory(); Artifact artifact = (Artifact) xmlObjectBuilderFactory.getBuilder(Artifact.DEFAULT_ELEMENT_NAME).buildObject(Artifact.DEFAULT_ELEMENT_NAME); artifact.setArtifact(artifactString); Issuer issuer = (Issuer) xmlObjectBuilderFactory.getBuilder(Issuer.DEFAULT_ELEMENT_NAME).buildObject(Issuer.DEFAULT_ELEMENT_NAME); issuer.setValue(issuerName); ArtifactResolve artifactResolve = (ArtifactResolve) xmlObjectBuilderFactory.getBuilder(ArtifactResolve.DEFAULT_ELEMENT_NAME).buildObject(ArtifactResolve.DEFAULT_ELEMENT_NAME); artifactResolve.setIssuer(issuer); artifactResolve.setIssueInstant(new DateTime()); artifactResolve.setID(UUID.randomUUID().toString()); artifactResolve.setDestination(idpUrl); artifactResolve.setArtifact(artifact); Signature signature = samlHelper.getDigitalSignature(pkEntry); artifactResolve.setSignature(signature); try { Configuration.getMarshallerFactory().getMarshaller(artifactResolve).marshall(artifactResolve); } catch (MarshallingException ex) { LOG.error("Error composing artifact resolution request: Marshalling artifact resolution request failed", ex); throw new IllegalArgumentException("Couldn't compose artifact resolution request", ex); } try { Signer.signObject(signature); } catch (SignatureException ex) { LOG.error("Error composing artifact resolution request: Failed to sign artifact resolution request", ex); throw new IllegalArgumentException("Couldn't compose artifact resolution request", ex); } return artifactResolve; }    }