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

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

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

Response.getEncryptedAssertions介绍

[英]Return the list of EncryptedAssertion child elements.
[中]返回EncryptedAssertion子元素的列表。

代码示例

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

Decrypter decrypter = new Decrypter(null, keyInfoResolver, keyResolver);
decrypter.setRootInNewDocument(true);
List<EncryptedAssertion> encryptedAssertions = processedSAMLResponse.getEncryptedAssertions();
if (encryptedAssertions != null) {
  for (EncryptedAssertion encryptedAssertion : encryptedAssertions) {

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

/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
    throws UnmarshallingException {
  Response resp = (Response) parentSAMLObject;
  if (childSAMLObject instanceof Assertion) {
    resp.getAssertions().add((Assertion) childSAMLObject);
  } else if (childSAMLObject instanceof EncryptedAssertion) {
    resp.getEncryptedAssertions().add((EncryptedAssertion) childSAMLObject);
  } else {
    super.processChildElement(parentSAMLObject, childSAMLObject);
  }
}

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

/**
 * Retrieve all supplied assertions, decrypting any encrypted
 * assertions if necessary.
 */
private List<Assertion> getAssertions(Response response)
  throws DecryptionException
{
  List<Assertion> assertions = new ArrayList<Assertion>();
  assertions.addAll(response.getAssertions());
  for (EncryptedAssertion e : response.getEncryptedAssertions()) {
    assertions.add(decrypt(e));
  }
  return assertions;
}

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

/**
 * Get the Assertion from the SAML2 Response
 *
 * @param response SAML2 Response
 * @return assertion
 */
private Assertion getAssertionFromResponse(Response response) {
  Assertion assertion = null;
  List<Assertion> assertions = response.getAssertions();
  if (assertions != null && !assertions.isEmpty()) {
    assertion = assertions.get(0);
  } else {
    List<EncryptedAssertion> encryptedAssertions = response.getEncryptedAssertions();
    EncryptedAssertion encryptedAssertion;
    if (encryptedAssertions.size() > 0) {
      encryptedAssertion = encryptedAssertions.get(0);
      try {
        String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
        assertion = getDecryptedAssertion(encryptedAssertion, tenantDomain);
      } catch (SAML2SSOUIAuthenticatorException e) {
        log.error("Error while obtaining the assertion from saml response.", e);
      }
    }
  }
  return assertion;
}

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

/**
 * Get the username from the SAML2 Response
 *
 * @param response SAML2 Response
 * @return username username contained in the SAML Response
 */
public static String getUsernameFromResponse(Response response) {
  List<Assertion> assertions = response.getAssertions();
  Assertion assertion = null;
  if (assertions != null && assertions.size() > 0) {
    // There can be only one assertion in a SAML Response, so get the
    // first one
    assertion = assertions.get(0);
    return getUsernameFromAssertion(assertion);
  } else {
    List<EncryptedAssertion> encryptedAssertions = response.getEncryptedAssertions();
    EncryptedAssertion encryptedAssertion;
    if (encryptedAssertions.size() > 0) {
      encryptedAssertion = encryptedAssertions.get(0);
      String tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
      try {
        assertion = getDecryptedAssertion(encryptedAssertion, tenantDomain);
      } catch (SAML2SSOUIAuthenticatorException e) {
        log.error("Error while obtaining user name from response.");
      }
      return getUsernameFromAssertion(assertion);
    }
  }
  return null;
}

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

assertion = assertions.get(0);
} else {
  List<EncryptedAssertion> encryptedAssertions = samlResponse.getEncryptedAssertions();
  EncryptedAssertion encryptedAssertion;
  if (encryptedAssertions.size() > 0) {

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

List<EncryptedAssertion> encryptedAssertions = saml2Response.getEncryptedAssertions();
EncryptedAssertion encryptedAssertion = null;
if (!CollectionUtils.isEmpty(encryptedAssertions)) {

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

List<EncryptedAssertion> encryptedAssertions = saml2Response.getEncryptedAssertions();
EncryptedAssertion encryptedAssertion = null;
if (!CollectionUtils.isEmpty(encryptedAssertions)) {

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.tools.saml.validator

alias,
        domainName);
response.getEncryptedAssertions().add(encryptedAssertion);

代码示例来源:origin: org.wso2.carbon.identity.tool.validator.sso.saml2/org.wso2.carbon.identity.tools.saml.validator

alias,
        domainName);
response.getEncryptedAssertions().add(encryptedAssertion);

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

EncryptedAssertion encryptedAssertion = SAMLSSOUtil.setEncryptedAssertion(assertion,
    EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES256, alias, domainName);
response.getEncryptedAssertions().add(encryptedAssertion);

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

List<EncryptedAssertion> encryptedAssertions = response.getEncryptedAssertions();
EncryptedAssertion encryptedAssertion = null;
if (CollectionUtils.isNotEmpty(encryptedAssertions)) {

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

if (response.getEncryptedAssertions().size() > 0) {
  assertionList = new ArrayList<Assertion>(response.getAssertions().size() + response.getEncryptedAssertions().size());
  assertionList.addAll(response.getAssertions());
  List<EncryptedAssertion> encryptedAssertionList = response.getEncryptedAssertions();
  for (EncryptedAssertion ea : encryptedAssertionList) {
    try {

代码示例来源:origin: org.wso2.carbon.identity.inbound.auth.saml.cloud/org.wso2.carbon.identity.sso.saml.cloud

EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES256, alias,
                     domainName);
response.getEncryptedAssertions().add(encryptedAssertion);

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

response.getEncryptedAssertions().add(encryptedAssertion);

相关文章