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

x33g5p2x  于2022-01-16 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(178)

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

Assertion.getSignature介绍

暂无

代码示例

代码示例来源:origin: codice/ddf

public void resignAssertion(Assertion assertion) throws SignatureException {
 final Signature signature = assertion.getSignature();
 if (signature == null) {
  signSamlObject(assertion);
  return;
 }
 final String digestAlgorithm =
   ((SAMLObjectContentReference) signature.getContentReferences().get(0)).getDigestAlgorithm();
 signSamlObject(
   assertion,
   signature.getSignatureAlgorithm(),
   signature.getCanonicalizationAlgorithm(),
   digestAlgorithm);
}

代码示例来源:origin: org.opensaml/opensaml-saml-api

Signature signature = token.getSignature();

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

private void signAssertion(
  SamlAssertionWrapper assertion,
  TokenRenewerParameters tokenParameters
) throws Exception {
  if (signToken) {
    STSPropertiesMBean stsProperties = tokenParameters.getStsProperties();
    String realm = tokenParameters.getRealm();
    RealmProperties samlRealm = null;
    if (realm != null && realmMap.containsKey(realm)) {
      samlRealm = realmMap.get(realm);
    }
    signToken(assertion, samlRealm, stsProperties, tokenParameters.getKeyRequirements());
  } else {
    if (assertion.getSaml1().getSignature() != null) {
      assertion.getSaml1().setSignature(null);
    } else if (assertion.getSaml2().getSignature() != null) {
      assertion.getSaml2().setSignature(null);
    }
  }
}

代码示例来源:origin: org.apache.cxf.services.sts/cxf-services-sts-core

private void signAssertion(
  SamlAssertionWrapper assertion,
  TokenRenewerParameters tokenParameters
) throws Exception {
  if (signToken) {
    STSPropertiesMBean stsProperties = tokenParameters.getStsProperties();
    String realm = tokenParameters.getRealm();
    RealmProperties samlRealm = null;
    if (realm != null && realmMap.containsKey(realm)) {
      samlRealm = realmMap.get(realm);
    }
    signToken(assertion, samlRealm, stsProperties, tokenParameters.getKeyRequirements());
  } else {
    if (assertion.getSaml1().getSignature() != null) {
      assertion.getSaml1().setSignature(null);
    } else if (assertion.getSaml2().getSignature() != null) {
      assertion.getSaml2().setSignature(null);
    }
  }
}

代码示例来源:origin: org.wso2.appserver/appserver-webapp-security

if (assertion.getSignature() == null) {
  throw new SSOException("SAML 2.0 Assertion signing is enabled, but signature element not found in " +
      "SAML 2.0 Assertion element");
} else {
  try {
    org.opensaml.xmlsec.signature.support.SignatureValidator.validate(assertion.getSignature(),
        new X509CredentialImplementation(ssoX509Credential.getEntityCertificate()));
  } catch (SignatureException e) {

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

if (!samlResponse.isSigned() && enforceAssertionsSigned && assertion.getSignature() == null) {
  LOG.fine("The enclosed assertions in the SAML Response must be signed");
  throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity");

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

private static void signXMLObject(XMLObject xmlObject) throws WSSecurityException {
  if (xmlObject instanceof org.opensaml.saml.saml1.core.Response) {
    org.opensaml.saml.saml1.core.Response response =
        (org.opensaml.saml.saml1.core.Response)xmlObject;
    // Sign any Assertions
    if (response.getAssertions() != null) {
      for (org.opensaml.saml.saml1.core.Assertion assertion : response.getAssertions()) {
        signObject(assertion.getSignature());
      }
    }
    signObject(response.getSignature());
  } else if (xmlObject instanceof org.opensaml.saml.saml2.core.Response) {
    org.opensaml.saml.saml2.core.Response response =
        (org.opensaml.saml.saml2.core.Response)xmlObject;
    // Sign any Assertions
    if (response.getAssertions() != null) {
      for (org.opensaml.saml.saml2.core.Assertion assertion : response.getAssertions()) {
        signObject(assertion.getSignature());
      }
    }
    signObject(response.getSignature());
  } else if (xmlObject instanceof SignableSAMLObject) {
    signObject(((SignableSAMLObject)xmlObject).getSignature());
  }
}

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

/**
 * Validate the given assertion:
 * - issueInstant
 * - issuer
 * - subject
 * - conditions
 * - authnStatements
 * - signature
 *
 * @param assertion the assertion
 * @param context   the context
 * @param engine    the engine
 * @param decrypter the decrypter
 */
protected final void validateAssertion(final Assertion assertion, final SAML2MessageContext context,
                    final SignatureTrustEngine engine, final Decrypter decrypter) {
  validateIssueInstant(assertion.getIssueInstant());
  validateIssuer(assertion.getIssuer(), context);
  if (assertion.getSubject() != null) {
    validateSubject(assertion.getSubject(), context, decrypter);
  } else {
    throw new SAMAssertionSubjectException("Assertion subject cannot be null");
  }
  validateAssertionConditions(assertion.getConditions(), context);
  validateAuthenticationStatements(assertion.getAuthnStatements(), context);
  validateAssertionSignature(assertion.getSignature(), context, engine);
}

代码示例来源:origin: org.wso2.appserver/appserver-webapp-security

if (assertion.getSignature() == null) {
  throw new SSOException("SAML 2.0 Assertion signing is enabled, but signature element not found in" +
      " SAML 2.0 Assertion element");
} else {
  try {
    org.opensaml.xmlsec.signature.support.SignatureValidator.validate(assertion.getSignature(),
        new X509CredentialImplementation(ssoX509Credential.getEntityCertificate()));
  } catch (SignatureException e) {

代码示例来源:origin: codice/ddf

List<Assertion> assertions = ((Response) samlObject).getAssertions();
for (Assertion assertion : assertions) {
 assertion.getSignature().setSigningCredential(signingCredential);

相关文章