org.opensaml.saml2.core.Response.getSignature()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中org.opensaml.saml2.core.Response.getSignature方法的一些代码示例,展示了Response.getSignature的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.getSignature方法的具体详情如下:
包路径:org.opensaml.saml2.core.Response
类名称:Response
方法名:getSignature

Response.getSignature介绍

暂无

代码示例

代码示例来源:origin: apache/cloudstack

Signature sig = processedSAMLResponse.getSignature();
if (idpMetadata.getSigningCertificate() != null && sig != null) {
  BasicX509Credential credential = new BasicX509Credential();

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.authenticator.saml2.sso

/**
 * Validate the signature of a SAML2 Response
 *
 * @param response   SAML2 Response
 * @param domainName domain name of the subject
 * @return true, if signature is valid.
 */
private boolean validateSignature(Response response, String domainName) {
  boolean isSignatureValid = false;
  if (response == null || response.getSignature() == null) {
    log.error("SAML Response is not signed or response not available. Authentication process will be " +
        "terminated.");
  } else {
    if (log.isDebugEnabled()) {
      log.debug("Validating SAML Response Signature.");
    }
    isSignatureValid = validateSignature(response.getSignature(), domainName);
  }
  return isSignatureValid;
}

代码示例来源:origin: org.wso2.carbon.identity.carbon.auth.saml2/org.wso2.carbon.identity.authenticator.saml2.sso

/**
 * Validate the signature of a SAML2 Response
 *
 * @param response   SAML2 Response
 * @param domainName domain name of the subject
 * @return true, if signature is valid.
 */
private boolean validateSignature(Response response, String domainName) {
  boolean isSignatureValid = false;
  if (response == null || response.getSignature() == null) {
    log.error("SAML Response is not signed or response not available. Authentication process will be " +
        "terminated.");
  } else {
    if (log.isDebugEnabled()) {
      log.debug("Validating SAML Response Signature.");
    }
    isSignatureValid = validateSignature(response.getSignature(), domainName);
  }
  return isSignatureValid;
}

代码示例来源:origin: org.adeptnet.auth/auth-saml

private void validatePOST(final Response response) throws ValidationException {
  // signature must match our SP's signature.
  final Signature sig1 = response.getSignature();
  sigValidator.validate(sig1);
  validate(response);
}

代码示例来源:origin: org.wso2.carbon.commons/org.wso2.carbon.hostobjects.sso

signatureValidator.validate(resp.getSignature());
isSigValid = true;
return isSigValid;

代码示例来源:origin: coveo/saml-client

private void validateSignature(Response response) throws SamlException {
 Signature responseSignature = response.getSignature();
 Signature assertionSignature = response.getAssertions().get(0).getSignature();
 if (responseSignature == null && assertionSignature == null) {
  throw new SamlException("No signature is present in either response or assertion");
 }
 if (responseSignature != null && !validate(responseSignature)) {
  throw new SamlException("The response signature is invalid");
 }
 if (assertionSignature != null && !validate(assertionSignature)) {
  throw new SamlException("The assertion signature is invalid");
 }
}

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.entitlement.proxy

if (validateSignature(samlResponseObject.getSignature())) {
  List<Assertion> assertionList = samlResponseObject.getAssertions();

代码示例来源:origin: be.fedict.eid-idp/eid-idp-sp-protocol-saml2

if (null == samlResponse.getSignature() && expectResponseSigned) {
  throw new AuthenticationResponseProcessorException(
      "Expected a signed response but was not so! ");
  if (null != samlResponse.getSignature()) {
          .getCertificates(samlResponse.getSignature()
              .getKeyInfo());

代码示例来源:origin: org.wso2.carbon.identity.agent.entitlement.mediator/org.wso2.carbon.identity.entitlement.proxy

if (validateSignature(samlResponseObject.getSignature())) {
  List<Assertion> assertionList = samlResponseObject.getAssertions();

代码示例来源:origin: be.fedict.eid-idp/eid-idp-sp-protocol-saml2

if (null != response.getSignature()) {
  Saml2Util.validateSignature(response.getSignature());

代码示例来源:origin: org.wso2.carbon.identity.authenticator.outbound.saml2sso/org.wso2.carbon.identity.authenticator.outbound.saml2sso

validator.validate(assertion.getSignature());
if (isAuthnResponseSigned(identityProviderConfig)) {
  if (response.getSignature() == null) {
    throw new SAML2SSOAuthenticationException("SAMLResponse signing is enabled, but signature " +
                         "element not found in Response element.");
    try {
      validator = new SignatureValidator(credential);
      validator.validate(response.getSignature());
    } catch (ValidationException e) {
      throw new SAML2SSOAuthenticationException("Signature validation failed for Response", e);

代码示例来源:origin: be.fedict.eid-idp/eid-idp-sp-protocol-saml2

.unmarshall(responseElement);
LOG.debug("validate Response signature");
Saml2Util.validateSignature(tempResponse.getSignature());

代码示例来源:origin: org.wso2.carbon.identity.agent.sso.java/org.wso2.carbon.identity.sso.agent

/**
 * Validate the signature of a SAML2 Response and Assertion
 *
 * @param response SAML2 Response
 * @return true, if signature is valid.
 */
protected void validateSignature(Response response, Assertion assertion) throws SSOAgentException {
  if (SSOAgentDataHolder.getInstance().getSignatureValidator() != null) {
    //Custom implemetation of signature validation
    SAMLSignatureValidator signatureValidatorUtility = (SAMLSignatureValidator) SSOAgentDataHolder
        .getInstance().getSignatureValidator();
    signatureValidatorUtility.validateSignature(response, assertion, ssoAgentConfig);
  } else {
    //If custom implementation not found, Execute the default implementation
    if (ssoAgentConfig.getSAML2().isResponseSigned()) {
      if (response.getSignature() == null) {
        throw new SSOAgentException("SAML2 Response signing is enabled, but signature element not found in SAML2 Response element");
      } else {
        validateSignature(response.getSignature());
      }
    }
    if (ssoAgentConfig.getSAML2().isAssertionSigned()) {
      if (assertion.getSignature() == null) {
        throw new SSOAgentException("SAML2 Assertion signing is enabled, but signature element not found in SAML2 Assertion element");
      } else {
        validateSignature(assertion.getSignature());
      }
    }
  }
}

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.sso.agent

/**
 * Validate the signature of a SAML2 Response and Assertion
 *
 * @param response SAML2 Response
 * @return true, if signature is valid.
 */
protected void validateSignature(Response response, Assertion assertion) throws SSOAgentException {
  if (SSOAgentDataHolder.getInstance().getSignatureValidator() != null) {
    //Custom implemetation of signature validation
    SAMLSignatureValidator signatureValidatorUtility = (SAMLSignatureValidator) SSOAgentDataHolder
        .getInstance().getSignatureValidator();
    signatureValidatorUtility.validateSignature(response, assertion, ssoAgentConfig);
  } else {
    //If custom implementation not found, Execute the default implementation
    if (ssoAgentConfig.getSAML2().isResponseSigned()) {
      if (response.getSignature() == null) {
        throw new SSOAgentException("SAML2 Response signing is enabled, but signature element not found in SAML2 Response element");
      } else {
        validateSignature(response.getSignature());
      }
    }
    if (ssoAgentConfig.getSAML2().isAssertionSigned()) {
      if (assertion.getSignature() == null) {
        throw new SSOAgentException("SAML2 Assertion signing is enabled, but signature element not found in SAML2 Assertion element");
      } else {
        validateSignature(assertion.getSignature());
      }
    }
  }
}

代码示例来源:origin: org.springframework.security.extensions/spring-security-saml2-core

if (response.getSignature() != null && !context.isInboundSAMLMessageAuthenticated()) {
  log.debug("Verifying Response signature");
  verifySignature(response.getSignature(), context.getPeerEntityId(), context.getLocalTrustEngine());
  context.setInboundSAMLMessageAuthenticated(true);

代码示例来源:origin: lastpass/saml-sdk-java

Signature sig = response.getSignature();
if (sig != null)
  sigValidator.validate(sig);

代码示例来源:origin: org.apache.ws.security/wss4j

signObject(response.getSignature());
} else if (xmlObject instanceof org.opensaml.saml2.core.Assertion) {
  org.opensaml.saml2.core.Assertion saml2 =

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.wss4j

signObject(response.getSignature());
} else if (xmlObject instanceof org.opensaml.saml2.core.Assertion) {
  org.opensaml.saml2.core.Assertion saml2 =

相关文章