• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java RequestAbstractType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.opensaml.saml2.core.RequestAbstractType的典型用法代码示例。如果您正苦于以下问题:Java RequestAbstractType类的具体用法?Java RequestAbstractType怎么用?Java RequestAbstractType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RequestAbstractType类属于org.opensaml.saml2.core包,在下文中一共展示了RequestAbstractType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: populateVelocityContext

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
/**
 * Populate the Velocity context instance which will be used to render the POST body.
 * 
 * @param velocityContext the Velocity context instance to populate with data
 * @param messageContext the SAML message context source of data
 * @param endpointURL endpoint URL to which to encode message
 * @throws MessageEncodingException thrown if there is a problem encoding the message
 */
protected void populateVelocityContext(VelocityContext velocityContext, SAMLMessageContext messageContext,
        String endpointURL) throws MessageEncodingException {
    
    Encoder esapiEncoder = ESAPI.encoder();

    String encodedEndpointURL = esapiEncoder.encodeForHTMLAttribute(endpointURL);
    log.debug("Encoding action url of '{}' with encoded value '{}'", endpointURL, encodedEndpointURL);
    velocityContext.put("action", encodedEndpointURL);
    velocityContext.put("binding", getBindingURI());

    log.debug("Marshalling and Base64 encoding SAML message");
    if (messageContext.getOutboundSAMLMessage().getDOM() == null) {
        marshallMessage(messageContext.getOutboundSAMLMessage());
    }
    try {
        String messageXML = XMLHelper.nodeToString(messageContext.getOutboundSAMLMessage().getDOM());
        String encodedMessage = Base64.encodeBytes(messageXML.getBytes("UTF-8"), Base64.DONT_BREAK_LINES);
        if (messageContext.getOutboundSAMLMessage() instanceof RequestAbstractType) {
            velocityContext.put("SAMLRequest", encodedMessage);
        } else if (messageContext.getOutboundSAMLMessage() instanceof StatusResponseType) {
            velocityContext.put("SAMLResponse", encodedMessage);
        } else {
            throw new MessageEncodingException(
                    "SAML message is neither a SAML RequestAbstractType or StatusResponseType");
        }
    } catch (UnsupportedEncodingException e) {
        log.error("UTF-8 encoding is not supported, this VM is not Java compliant.");
        throw new MessageEncodingException("Unable to encode message, UTF-8 encoding is not supported");
    }

    String relayState = messageContext.getRelayState();
    if (checkRelayState(relayState)) {
        String encodedRelayState = esapiEncoder.encodeForHTMLAttribute(relayState);
        log.debug("Setting RelayState parameter to: '{}', encoded as '{}'", relayState, encodedRelayState);
        velocityContext.put("RelayState", encodedRelayState);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:46,代码来源:HTTPPostEncoder.java


示例2: getIntendedDestinationEndpointURI

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
/**
 * {@inheritDoc} 
 * 
 * <p>This SAML 2-specific implementation extracts the value of the protocol message Destination attribute.</p>
 * 
 * */
protected String getIntendedDestinationEndpointURI(SAMLMessageContext samlMsgCtx) throws MessageDecodingException {
    SAMLObject samlMessage = samlMsgCtx.getInboundSAMLMessage();
    String messageDestination = null;
    if (samlMessage instanceof RequestAbstractType) {
        RequestAbstractType request =  (RequestAbstractType) samlMessage;
        messageDestination = DatatypeHelper.safeTrimOrNullString(request.getDestination());
    } else if (samlMessage instanceof StatusResponseType) {
        StatusResponseType response = (StatusResponseType) samlMessage;
        messageDestination = DatatypeHelper.safeTrimOrNullString(response.getDestination());
    } else {
        log.error("Invalid SAML message type encountered: {}", samlMessage.getElementQName().toString());
        throw new MessageDecodingException("Invalid SAML message type encountered");
    }
    return messageDestination;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:BaseSAML2MessageDecoder.java


示例3: processAttribute

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
    RequestAbstractType req = (RequestAbstractType) samlObject;

    if (attribute.getLocalName().equals(RequestAbstractType.VERSION_ATTRIB_NAME)) {
        req.setVersion(SAMLVersion.valueOf(attribute.getValue()));
    } else if (attribute.getLocalName().equals(RequestAbstractType.ID_ATTRIB_NAME)) {
        req.setID(attribute.getValue());
        attribute.getOwnerElement().setIdAttributeNode(attribute, true);
    } else if (attribute.getLocalName().equals(RequestAbstractType.ISSUE_INSTANT_ATTRIB_NAME)
            && !DatatypeHelper.isEmpty(attribute.getValue())) {
        req.setIssueInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()));
    } else if (attribute.getLocalName().equals(RequestAbstractType.DESTINATION_ATTRIB_NAME)) {
        req.setDestination(attribute.getValue());
    } else if (attribute.getLocalName().equals(RequestAbstractType.CONSENT_ATTRIB_NAME)) {
        req.setConsent(attribute.getValue());
    } else {
        super.processAttribute(samlObject, attribute);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:RequestAbstractTypeUnmarshaller.java


示例4: buildRedirectURL

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
public String buildRedirectURL(Credential signingCredential, String relayState) throws MessageEncodingException {
	SAMLMessageContext<?, RequestAbstractType, ?> messageContext = new BasicSAMLMessageContext<SAMLObject, RequestAbstractType, SAMLObject>();
	// Build the parameters for the request
	messageContext.setOutboundSAMLMessage(request);
	messageContext.setRelayState(relayState);

	// Sign the parameters
	messageContext.setOutboundSAMLMessageSigningCredential(signingCredential);

          String messageStr = XMLHelper.nodeToString(marshallMessage(request));

          ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
          Deflater deflater = new Deflater(Deflater.DEFLATED, true);
          DeflaterOutputStream deflaterStream = new DeflaterOutputStream(bytesOut, deflater);
          try {
		deflaterStream.write(messageStr.getBytes("UTF-8"));
		deflaterStream.finish();
	} catch (IOException e) {
		throw new RuntimeException("Unable to deflate message", e);
	}

          String encoded = Base64.encodeBytes(bytesOut.toByteArray(), Base64.DONT_BREAK_LINES);
	return super.buildRedirectURL(messageContext, request.getDestination(), encoded);
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:25,代码来源:OIORequest.java


示例5: validateXMLSignature

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
@Override
public boolean validateXMLSignature(RequestAbstractType request, X509Credential cred,
                                    String alias) throws IdentityException {

    boolean isSignatureValid = false;

    if (request.getSignature() != null) {
        try {
            SignatureValidator validator = new SignatureValidator(cred);
            validator.validate(request.getSignature());
            isSignatureValid = true;
        } catch (ValidationException e) {
            throw IdentityException.error("Signature Validation Failed for the SAML Assertion : Signature is " +
                                        "invalid.", e);
        }
    }
    return isSignatureValid;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:19,代码来源:DefaultSSOSigner.java


示例6: buildRedirectURL

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
/**
 * Builds the URL to redirect the client to.
 * 
 * @param messagesContext current message context
 * @param endpointURL endpoint URL to send encoded message to
 * @param message Deflated and Base64 encoded message
 * 
 * @return URL to redirect client to
 * 
 * @throws MessageEncodingException thrown if the SAML message is neither a RequestAbstractType or Response
 */
protected String buildRedirectURL(SAMLMessageContext messagesContext, String endpointURL, String message)
        throws MessageEncodingException {
    log.debug("Building URL to redirect client to");
    URLBuilder urlBuilder = new URLBuilder(endpointURL);

    List<Pair<String, String>> queryParams = urlBuilder.getQueryParams();
    queryParams.clear();

    if (messagesContext.getOutboundSAMLMessage() instanceof RequestAbstractType) {
        queryParams.add(new Pair<String, String>("SAMLRequest", message));
    } else if (messagesContext.getOutboundSAMLMessage() instanceof StatusResponseType) {
        queryParams.add(new Pair<String, String>("SAMLResponse", message));
    } else {
        throw new MessageEncodingException(
                "SAML message is neither a SAML RequestAbstractType or StatusResponseType");
    }

    String relayState = messagesContext.getRelayState();
    if (checkRelayState(relayState)) {
        queryParams.add(new Pair<String, String>("RelayState", relayState));
    }

    Credential signingCredential = messagesContext.getOuboundSAMLMessageSigningCredential();
    if (signingCredential != null) {
        // TODO pull SecurityConfiguration from SAMLMessageContext? needs to be added
        String sigAlgURI = getSignatureAlgorithmURI(signingCredential, null);
        Pair<String, String> sigAlg = new Pair<String, String>("SigAlg", sigAlgURI);
        queryParams.add(sigAlg);
        String sigMaterial = urlBuilder.buildQueryString();

        queryParams.add(new Pair<String, String>("Signature", generateSignature(signingCredential, sigAlgURI,
                sigMaterial)));
    }

    return urlBuilder.buildURL();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:48,代码来源:HTTPRedirectDeflateEncoder.java


示例7: populateMessageIdIssueInstantIssuer

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
/**
 * Extracts the message ID, issue instant, and issuer from the incoming SAML message and populates the message
 * context with it.
 * 
 * @param messageContext current message context
 * 
 * @throws MessageDecodingException thrown if there is a problem populating the message context
 */
protected void populateMessageIdIssueInstantIssuer(SAMLMessageContext messageContext)
        throws MessageDecodingException {
    if (!(messageContext instanceof SAMLMessageContext)) {
        log.debug("Invalid message context type, this policy rule only support SAMLMessageContext");
        return;
    }
    SAMLMessageContext samlMsgCtx = (SAMLMessageContext) messageContext;

    SAMLObject samlMsg = samlMsgCtx.getInboundSAMLMessage();
    if (samlMsg == null) {
        log.error("Message context did not contain inbound SAML message");
        throw new MessageDecodingException("Message context did not contain inbound SAML message");
    }

    if (samlMsg instanceof RequestAbstractType) {
        log.debug("Extracting ID, issuer and issue instant from request");
        extractRequestInfo(samlMsgCtx, (RequestAbstractType) samlMsg);
    } else if (samlMsg instanceof StatusResponseType) {
        log.debug("Extracting ID, issuer and issue instant from status response");
        extractResponseInfo(samlMsgCtx, (StatusResponseType) samlMsg);
    } else {
        throw new MessageDecodingException("SAML 2 message was not a request or a response");
    }

    if (samlMsgCtx.getInboundMessageIssuer() == null) {
        log.warn("Issuer could not be extracted from SAML 2 message");
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:38,代码来源:BaseSAML2MessageDecoder.java


示例8: validateVersion

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
/**
 * Validates the Version attribute.
 * 
 * @param request request to validate
 * @throws ValidationException if invalid
 */
protected void validateVersion(RequestAbstractType request) throws ValidationException {
    if (request.getVersion() == null) {
        throw new ValidationException("Version attribute must not be null");
    }
    if (request.getVersion().toString() != SAMLVersion.VERSION_20.toString()) {
        throw new ValidationException("Wrong SAML Version");
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:RequestAbstractTypeSchemaValidator.java


示例9: processChildElement

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
        throws UnmarshallingException {
    RequestAbstractType req = (RequestAbstractType) parentSAMLObject;

    if (childSAMLObject instanceof Issuer) {
        req.setIssuer((Issuer) childSAMLObject);
    } else if (childSAMLObject instanceof Signature) {
        req.setSignature((Signature) childSAMLObject);
    } else if (childSAMLObject instanceof Extensions) {
        req.setExtensions((Extensions) childSAMLObject);
    } else {
        super.processChildElement(parentSAMLObject, childSAMLObject);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:RequestAbstractTypeUnmarshaller.java


示例10: marshallAttributes

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
    RequestAbstractType req = (RequestAbstractType) samlObject;

    if (req.getVersion() != null) {
        domElement.setAttributeNS(null, RequestAbstractType.VERSION_ATTRIB_NAME, req.getVersion().toString());
    }

    if (req.getID() != null) {
        domElement.setAttributeNS(null, RequestAbstractType.ID_ATTRIB_NAME, req.getID());
        domElement.setIdAttributeNS(null, RequestAbstractType.ID_ATTRIB_NAME, true);
    }

    if (req.getVersion() != null) {
        domElement.setAttributeNS(null, RequestAbstractType.VERSION_ATTRIB_NAME, req.getVersion().toString());
    }

    if (req.getIssueInstant() != null) {
        String iiStr = Configuration.getSAMLDateFormatter().print(req.getIssueInstant());
        domElement.setAttributeNS(null, RequestAbstractType.ISSUE_INSTANT_ATTRIB_NAME, iiStr);
    }

    if (req.getDestination() != null) {
        domElement.setAttributeNS(null, RequestAbstractType.DESTINATION_ATTRIB_NAME, req.getDestination());
    }

    if (req.getConsent() != null) {
        domElement.setAttributeNS(null, RequestAbstractType.CONSENT_ATTRIB_NAME, req.getConsent());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:RequestAbstractTypeMarshaller.java


示例11: setUp

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
	DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
	documentBuilderFactory.setNamespaceAware(true);
	Document doc = documentBuilderFactory.newDocumentBuilder().parse(OIORequest.class.getResourceAsStream("request.xml"));
	Configuration.getBuilderFactory();
	UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
	Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(doc.getDocumentElement());
	request = (RequestAbstractType) unmarshaller.unmarshall(doc.getDocumentElement());
	request.getIssuer().setValue("IssuerValue");
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:12,代码来源:UtilsTest.java


示例12: populateVelocityContext

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
/**
 * Populate the Velocity context instance which will be used to render the POST body.
 * 
 * @param velocityContext the Velocity context instance to populate with data
 * @param messageContext the SAML message context source of data
 * @param endpointURL endpoint URL to which to encode message
 * @throws MessageEncodingException thrown if there is a problem encoding the message
 */
protected void populateVelocityContext(VelocityContext velocityContext, SAMLMessageContext messageContext,
        String endpointURL) throws MessageEncodingException {

    log.debug("Encoding action url of: {}", endpointURL);
    velocityContext.put("action", endpointURL);

    log.debug("Marshalling and Base64 encoding SAML message");
    if(messageContext.getOutboundSAMLMessage().getDOM() == null){
        marshallMessage(messageContext.getOutboundSAMLMessage());
    }
    String messageXML = XMLHelper.nodeToString(messageContext.getOutboundSAMLMessage().getDOM());
    String encodedMessage = Base64.encodeBytes(messageXML.getBytes(), Base64.DONT_BREAK_LINES);        
    if (messageContext.getOutboundSAMLMessage() instanceof RequestAbstractType) {
        velocityContext.put("SAMLRequest", encodedMessage);
    } else if (messageContext.getOutboundSAMLMessage() instanceof StatusResponseType) {
        velocityContext.put("SAMLResponse", encodedMessage);
    } else {
        throw new MessageEncodingException(
                "SAML message is neither a SAML RequestAbstractType or StatusResponseType");
    }

    String relayState = messageContext.getRelayState();
    if (checkRelayState(relayState)) {
        log.debug("Encoding relay state of: {}", relayState);
        velocityContext.put("RelayState", relayState);
    }
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:36,代码来源:HTTPPostEncoder.java


示例13: testRequestDecoding

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
/**
 * Test decoding a SAML httpRequest.
 */
public void testRequestDecoding() throws Exception {
    httpRequest.setParameter("SAMLRequest", "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHNhbWxwOkF1dGhuUm"
            + "VxdWVzdCBJRD0iZm9vIiBJc3N1ZUluc3RhbnQ9IjE5NzAtMDEtMDFUMDA6MDA6MDAuMDAwWiIgVmVyc2lvbj0iMi4wIiB4bW"
            + "xuczpzYW1scD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOnByb3RvY29sIi8+");
    
    decoder.decode(messageContext);

    assertTrue(messageContext.getInboundMessage() instanceof RequestAbstractType);
    assertTrue(messageContext.getInboundSAMLMessage() instanceof RequestAbstractType);
    assertEquals(expectedRelayValue, messageContext.getRelayState());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:15,代码来源:HTTPPostDecoderTest.java


示例14: testRequestDecoding

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
public void testRequestDecoding() throws Exception{
    AuthnRequest samlRequest = (AuthnRequest) unmarshallElement("/data/org/opensaml/saml2/binding/AuthnRequest.xml");
    samlRequest.setDestination(null);
    
    httpRequest.setParameter("SAMLRequest", encodeMessage(samlRequest));

    decoder.decode(messageContext);

    assertTrue(messageContext.getInboundMessage() instanceof RequestAbstractType);
    assertTrue(messageContext.getInboundSAMLMessage() instanceof RequestAbstractType);
    assertEquals(expectedRelayValue, messageContext.getRelayState());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:13,代码来源:HTTPRedirectDeflateDecoderTest.java


示例15: testIDFailure

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
/**
 * Tests empty ID attribute
 */
public void testIDFailure() {
    RequestAbstractType request = (RequestAbstractType) target;

    request.setID(null);
    assertValidationFail("ID attribute was null");

    request.setID("");
    assertValidationFail("ID attribute was empty string");

    request.setID("               ");
    assertValidationFail("ID attribute was all whitespace");
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:16,代码来源:RequestSchemaTestBase.java


示例16: populateRequiredAttributes

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
/**
 * Used by subclasses to populate the required attribute values that this test expects.
 * 
 * @param samlObject
 */
protected void populateRequiredAttributes(SAMLObject samlObject) {
    RequestAbstractType req = (RequestAbstractType) samlObject;

    req.setID(expectedID);
    req.setIssueInstant(expectedIssueInstant);
    // NOTE: the SAML Version attribute is set automatically by the impl superclass

}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:14,代码来源:RequestTestBase.java


示例17: populateOptionalAttributes

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
/**
 * Used by subclasses to populate the optional attribute values that this test expects.
 * 
 * @param samlObject
 */
protected void populateOptionalAttributes(SAMLObject samlObject) {
    RequestAbstractType req = (RequestAbstractType) samlObject;

    req.setConsent(expectedConsent);
    req.setDestination(expectedDestination);

}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:13,代码来源:RequestTestBase.java


示例18: helperTestSingleElementUnmarshall

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
protected void helperTestSingleElementUnmarshall(SAMLObject samlObject) {
    RequestAbstractType req = (RequestAbstractType) samlObject;

    assertEquals("Unmarshalled ID attribute was not the expected value", expectedID, req.getID());
    assertEquals("Unmarshalled Version attribute was not the expected value", expectedSAMLVersion.toString(), req
            .getVersion().toString());
    assertEquals("Unmarshalled IssueInstant attribute was not the expected value", 0, expectedIssueInstant
            .compareTo(req.getIssueInstant()));

    assertNull("Consent was not null", req.getConsent());
    assertNull("Destination was not null", req.getDestination());

}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:14,代码来源:RequestTestBase.java


示例19: helperTestSingleElementOptionalAttributesUnmarshall

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
protected void helperTestSingleElementOptionalAttributesUnmarshall(SAMLObject samlObject) {
    RequestAbstractType req = (RequestAbstractType) samlObject;

    assertEquals("Unmarshalled ID attribute was not the expected value", expectedID, req.getID());
    assertEquals("Unmarshalled Version attribute was not the expected value", expectedSAMLVersion.toString(), req
            .getVersion().toString());
    assertEquals("Unmarshalled IssueInstant attribute was not the expected value", 0, expectedIssueInstant
            .compareTo(req.getIssueInstant()));

    assertEquals("Unmarshalled Consent attribute was not the expected value", expectedConsent, req.getConsent());
    assertEquals("Unmarshalled Destination attribute was not the expected value", expectedDestination, req
            .getDestination());

}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:15,代码来源:RequestTestBase.java


示例20: findSaml20IdpConnectorToUse

import org.opensaml.saml2.core.RequestAbstractType; //导入依赖的package包/类
/**
 * Find the SAML 2.0 IdP Connector to use to process the SAML Object.
 * 
 * @param samlObject
 *            the SAML 2.0 object to process
 * @return the SAML 2.0 IdP connector attached
 * @throws SamlProcessingException
 *             if no IdP connector found
 */
protected ISaml20IdpConnector findSaml20IdpConnectorToUse(final SAMLObject samlObject)
		throws SamlProcessingException {
	ISaml20IdpConnector samlConnector = null;

	Assert.notNull(samlObject, "No signable SAML objet provided !");

	if (StatusResponseType.class.isAssignableFrom(samlObject.getClass())) {
		// The SAML object is a Response, so the original request must be in the cache !
		final StatusResponseType samlResponse = (StatusResponseType) samlObject;
		final String originalRequestId = samlResponse.getInResponseTo();

		if (StringUtils.hasText(originalRequestId)) {
			final IRequestWaitingForResponse originalRequestData = this.saml20Storage.findRequestWaitingForResponse(originalRequestId);
			if (originalRequestData != null) {
				samlConnector = originalRequestData.getIdpConnectorBuilder();
			}
		}

	} else if (RequestAbstractType.class.isAssignableFrom(samlObject.getClass())) {
		// Search IdPConnector by Issuer
		final RequestAbstractType samlRequest = (RequestAbstractType) samlObject;

		final Issuer issuer = samlRequest.getIssuer();
		if (issuer != null) {
			final String issuerEntityId = issuer.getValue();
			samlConnector = this.idpConnectorsByEntityId.get(issuerEntityId);
		}

	}

	if (samlConnector == null) {
		throw new SamlProcessingException("Unable to find an IdP Connector to process the SAML request !");
	}

	return samlConnector;
}
 
开发者ID:mxbossard,项目名称:java-saml2-sp,代码行数:46,代码来源:OpenSaml20SpProcessor.java



注:本文中的org.opensaml.saml2.core.RequestAbstractType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IASTName类代码示例发布时间:2022-05-23
下一篇:
Java ExtendedOptionsImpl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap