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

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

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

Attribute.getNameFormat介绍

[英]Get the name format of this attribute.
[中]获取此属性的名称格式。

代码示例

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

/** {@inheritDoc} */
  protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException {
    Attribute attribute = (Attribute) samlElement;

    if (attribute.getName() != null) {
      domElement.setAttributeNS(null, Attribute.NAME_ATTTRIB_NAME, attribute.getName());
    }

    if (attribute.getNameFormat() != null) {
      domElement.setAttributeNS(null, Attribute.NAME_FORMAT_ATTRIB_NAME, attribute.getNameFormat());
    }

    if (attribute.getFriendlyName() != null) {
      domElement.setAttributeNS(null, Attribute.FRIENDLY_NAME_ATTRIB_NAME, attribute.getFriendlyName());
    }

    marshallUnknownAttributes(attribute, domElement);
  }
}

代码示例来源:origin: Talend/tesb-rt-se

private String getRoleFromAssertion(SamlAssertionWrapper assertion) {
  Assertion saml2Assertion = assertion.getSaml2();
  if (saml2Assertion == null) {
    return null;
  }
  
  List<AttributeStatement> attributeStatements = saml2Assertion.getAttributeStatements();
  if (attributeStatements == null || attributeStatements.isEmpty()) {
    return null;
  }
  
  String nameFormat = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims";
  for (AttributeStatement statement : attributeStatements) {
    List<Attribute> attributes = statement.getAttributes();
    for (Attribute attribute : attributes) {
      if ("role".equals(attribute.getName()) 
        && nameFormat.equals(attribute.getNameFormat())) {
        Element attributeValueElement = attribute.getAttributeValues().get(0).getDOM();
        return attributeValueElement.getTextContent();
      }
    }
  }
  return null;
}

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

&& (input.getNameFormat() == null || input.getNameFormat().equals(a.getNameFormat()))) {

代码示例来源:origin: org.apache.cxf.fediz/fediz-idp-core

if (ClaimTypes.URI_BASE.toString().equals(attribute.getNameFormat())
  && !attrName.isAbsolute()) {
  c.setClaimType(URI.create(ClaimTypes.URI_BASE + "/" + attribute.getName()));

代码示例来源:origin: org.apache.cxf.fediz/fediz-idp-core

private void createAndSetStatement(SAMLCallback callback) {
  AuthenticationStatementBean authBean = new AuthenticationStatementBean();
  authBean.setAuthenticationMethod("Password");
  callback.setAuthenticationStatementData(Collections.singletonList(authBean));
  if (attributeStatements != null && !attributeStatements.isEmpty()) {
    List<AttributeStatementBean> attrStatementBeans = new ArrayList<>();
    for (AttributeStatement attrStatement : attributeStatements) {
      AttributeStatementBean attrStatementBean = new AttributeStatementBean();
      List<AttributeBean> attrBeans = new ArrayList<>();
      for (Attribute attribute : attrStatement.getAttributes()) {
        AttributeBean attributeBean = new AttributeBean();
        attributeBean.setQualifiedName(attribute.getName());
        attributeBean.setNameFormat(attribute.getNameFormat());
        List<Object> attributeValues = new ArrayList<>();
        for (XMLObject attrVal : attribute.getAttributeValues()) {
          attributeValues.add(attrVal.getDOM().getTextContent());
        }
        attributeBean.setAttributeValues(attributeValues);
        attrBeans.add(attributeBean);
      }
      attrStatementBean.setSamlAttributes(attrBeans);
      attrStatementBeans.add(attrStatementBean);
    }
    callback.setAttributeStatementData(attrStatementBeans);
  }
}

代码示例来源:origin: spring-projects/spring-security-saml

protected List<Attribute> getAttributes(
  List<AttributeStatement> attributeStatements, List<SimpleKey>
  localKeys
) {
  List<Attribute> result = new LinkedList<>();
  for (AttributeStatement stmt : ofNullable(attributeStatements).orElse(emptyList())) {
    for (org.opensaml.saml.saml2.core.Attribute a : ofNullable(stmt.getAttributes()).orElse(emptyList())) {
      result.add(
        new Attribute()
          .setFriendlyName(a.getFriendlyName())
          .setName(a.getName())
          .setNameFormat(AttributeNameFormat.fromUrn(a.getNameFormat()))
          .setValues(getJavaValues(a.getAttributeValues()))
      );
    }
    for (EncryptedAttribute encryptedAttribute : ofNullable(stmt.getEncryptedAttributes()).orElse(emptyList())) {
      org.opensaml.saml.saml2.core.Attribute a = (org.opensaml.saml.saml2.core.Attribute) decrypt
        (encryptedAttribute, localKeys);
      result.add(
        new Attribute()
          .setFriendlyName(a.getFriendlyName())
          .setName(a.getName())
          .setNameFormat(AttributeNameFormat.fromUrn(a.getNameFormat()))
          .setValues(getJavaValues(a.getAttributeValues()))
      );
    }
  }
  return result;
}

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

samlAttribute.setFriendlyName(attribute.getFriendlyName());
samlAttribute.setName(attribute.getName());
samlAttribute.setNameFormat(attribute.getNameFormat());
attribute.getAttributeValues().forEach(xmlObject -> {
  final Element dom = xmlObject.getDOM();

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

claim.setNameFormat(atr.getNameFormat());
claim.setFriendlyName(atr.getFriendlyName());

相关文章