SAMLProcessorImpl implements SAMLProcessor { public SAMLMessageContext retrieveMessage(SAMLMessageContext samlContext, SAMLBinding binding) throws SAMLException, MetadataProviderException, MessageDecodingException, org.opensaml.xml.security.SecurityException { log.debug("Retrieving message using binding {}", binding.getBindingURI()); verifyContext(samlContext); populateSecurityPolicy(samlContext, binding); QName peerEntityRole = samlContext.getPeerEntityRole(); if (peerEntityRole == null) { peerEntityRole = IDPSSODescriptor.DEFAULT_ELEMENT_NAME; } samlContext.setPeerEntityRole(peerEntityRole); samlContext.setInboundSAMLProtocol(SAMLConstants.SAML20P_NS); samlContext.setInboundSAMLBinding(binding.getBindingURI()); MessageDecoder decoder = binding.getMessageDecoder(); decoder.decode(samlContext); if (samlContext.getPeerEntityMetadata() == null) { throw new MetadataProviderException("Metadata for issuer " + samlContext.getInboundMessageIssuer() + " wasn't found"); } samlContext.setPeerEntityId(samlContext.getPeerEntityMetadata().getEntityID()); samlContext.setPeerExtendedMetadata(((MetadataManager) samlContext.getMetadataProvider()).getExtendedMetadata(samlContext.getPeerEntityId())); return samlContext; } SAMLProcessorImpl(SAMLBinding binding);  SAMLProcessorImpl(Collection<SAMLBinding> bindings); SAMLMessageContext retrieveMessage(SAMLMessageContext samlContext, SAMLBinding binding); SAMLMessageContext retrieveMessage(SAMLMessageContext samlContext, String binding); SAMLMessageContext retrieveMessage(SAMLMessageContext samlContext); SAMLMessageContext sendMessage(SAMLMessageContext samlContext, boolean sign); SAMLMessageContext sendMessage(SAMLMessageContext samlContext, boolean sign, String bindingName);  }
@Test public void testPOSTResponseParsing() throws Exception { prepareHttpRequest("message/SAMLResponse.xml", "POST", "http: replayMock(); SAMLMessageContext context = processor.retrieveMessage(samlContext); verifyMock(); assertNotNull(context.getInboundSAMLMessage()); assertTrue(context.getInboundSAMLMessage() instanceof Response); assertEquals("s22520705f2c89536ee66a2c4c92f2832ce9cdc019", context.getInboundSAMLMessageId()); assertEquals("http: }
@Test(expected = SecurityException.class) public void testMessageRecipientInvalid() throws Exception { prepareHttpRequest("message/SAMLResponse.xml", "POST", "http: replayMock(); processor.retrieveMessage(samlContext); verifyMock(); }
@Test(expected = SecurityException.class) public void testMessageInvalidSignature() throws Exception { prepareHttpRequest("message/SAMLResponseInvalidSignature.xml", "POST", "http: replayMock(); processor.retrieveMessage(samlContext); verifyMock(); }