@BeforeClass
 public static void initializeOpenSAML() throws Exception {
   DocumentBuilderFactory newFactory = DocumentBuilderFactory.newInstance();
   System.out.println(newFactory.getClass().getName());
   DefaultBootstrap.bootstrap();
   builderFactory = Configuration.getBuilderFactory();
 }
Ejemplo n.º 2
0
  private AttributeStatement buildAttributeStatement(Map<String, String> claims) {
    AttributeStatement attStmt = null;
    if (claims != null) {
      attStmt = new AttributeStatementBuilder().buildObject();
      Iterator<String> ite = claims.keySet().iterator();

      for (int i = 0; i < claims.size(); i++) {
        Attribute attrib = new AttributeBuilder().buildObject();
        String claimUri = ite.next();
        attrib.setName(claimUri);
        // look
        // https://wiki.shibboleth.net/confluence/display/OpenSAML/OSTwoUsrManJavaAnyTypes
        XSStringBuilder stringBuilder =
            (XSStringBuilder) Configuration.getBuilderFactory().getBuilder(XSString.TYPE_NAME);
        XSString stringValue =
            stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
        stringValue.setValue(claims.get(claimUri));
        attrib.getAttributeValues().add(stringValue);
        attStmt.getAttributes().add(attrib);
      }
    }
    return attStmt;
  }
 /** Constructor. */
 public SAML1ScopedStringAttributeEncoder() {
   super();
   attributeBuilder =
       (SAMLObjectBuilder<Attribute>)
           Configuration.getBuilderFactory().getBuilder(Attribute.DEFAULT_ELEMENT_NAME);
 }
 /** Constructor. */
 public SAML1NameIdentifierAttributeDefinition() {
   super();
   nameIdBuilder =
       (SAMLObjectBuilder<NameIdentifier>)
           Configuration.getBuilderFactory().getBuilder(NameIdentifier.DEFAULT_ELEMENT_NAME);
 }