use of org.keycloak.dom.saml.v2.assertion.AttributeType in project keycloak by keycloak.
the class SAMLMetadataWriter method write.
public void write(IDPSSODescriptorType idpSSODescriptor) throws ProcessingException {
if (idpSSODescriptor == null)
throw new ProcessingException(logger.nullArgumentError("IDPSSODescriptorType"));
StaxUtil.writeStartElement(writer, METADATA_PREFIX, JBossSAMLConstants.IDP_SSO_DESCRIPTOR.get(), JBossSAMLURIConstants.METADATA_NSURI.get());
Boolean wantsAuthnRequestsSigned = idpSSODescriptor.isWantAuthnRequestsSigned();
if (wantsAuthnRequestsSigned != null) {
StaxUtil.writeAttribute(writer, new QName(JBossSAMLConstants.WANT_AUTHN_REQUESTS_SIGNED.get()), wantsAuthnRequestsSigned.toString());
}
writeProtocolSupportEnumeration(idpSSODescriptor.getProtocolSupportEnumeration());
// Get the key descriptors
List<KeyDescriptorType> keyDescriptors = idpSSODescriptor.getKeyDescriptor();
for (KeyDescriptorType keyDescriptor : keyDescriptors) {
writeKeyDescriptor(keyDescriptor);
}
List<IndexedEndpointType> artifactResolutionServices = idpSSODescriptor.getArtifactResolutionService();
for (IndexedEndpointType indexedEndpoint : artifactResolutionServices) {
writeArtifactResolutionService(indexedEndpoint);
}
List<EndpointType> sloServices = idpSSODescriptor.getSingleLogoutService();
for (EndpointType endpoint : sloServices) {
writeSingleLogoutService(endpoint);
}
List<String> nameIDFormats = idpSSODescriptor.getNameIDFormat();
for (String nameIDFormat : nameIDFormats) {
writeNameIDFormat(nameIDFormat);
}
List<EndpointType> ssoServices = idpSSODescriptor.getSingleSignOnService();
for (EndpointType endpoint : ssoServices) {
writeSingleSignOnService(endpoint);
}
List<AttributeType> attributes = idpSSODescriptor.getAttribute();
for (AttributeType attribType : attributes) {
write(attribType);
}
StaxUtil.writeEndElement(writer);
StaxUtil.flush(writer);
}
use of org.keycloak.dom.saml.v2.assertion.AttributeType in project keycloak by keycloak.
the class StatementUtil method getX500Attribute.
private static AttributeType getX500Attribute(String name) {
AttributeType att = new AttributeType(name);
att.getOtherAttributes().put(X500_QNAME, "LDAP");
att.setNameFormat(JBossSAMLURIConstants.ATTRIBUTE_FORMAT_URI.get());
return att;
}
use of org.keycloak.dom.saml.v2.assertion.AttributeType in project keycloak by keycloak.
the class StatementUtil method createAttributeStatement.
/**
* Given a set of roles, create an attribute statement
*
* @param roles
*
* @return
*/
public static AttributeStatementType createAttributeStatement(List<String> roles) {
AttributeStatementType attrStatement = null;
for (String role : roles) {
if (attrStatement == null) {
attrStatement = new AttributeStatementType();
}
AttributeType attr = new AttributeType(AttributeConstants.ROLE_IDENTIFIER_ASSERTION);
attr.addAttributeValue(role);
attrStatement.addAttribute(new ASTChoiceType(attr));
}
return attrStatement;
}
use of org.keycloak.dom.saml.v2.assertion.AttributeType in project keycloak by keycloak.
the class StatementUtil method createAttributeStatementForRoles.
/**
* Given a set of roles, create an attribute statement
*
* @param roles
* @param multivalued if you want the attribute to be multi valued
*
* @return
*/
public static AttributeStatementType createAttributeStatementForRoles(List<String> roles, boolean multivalued) {
if (!multivalued) {
return createAttributeStatement(roles);
}
AttributeStatementType attrStatement = new AttributeStatementType();
AttributeType attr = new AttributeType(AttributeConstants.ROLE_IDENTIFIER_ASSERTION);
for (String role : roles) {
attr.addAttributeValue(role);
}
attrStatement.addAttribute(new ASTChoiceType(attr));
return attrStatement;
}
use of org.keycloak.dom.saml.v2.assertion.AttributeType in project keycloak by keycloak.
the class StatementUtil method createAttributeStatement.
/**
* Given an attribute type and a value, create {@link AttributeStatementType}
*
* @param key attribute type
* @param value attribute value
*
* @return
*/
public static AttributeStatementType createAttributeStatement(String key, String value) {
AttributeStatementType attrStatement = new AttributeStatementType();
AttributeType attr = new AttributeType(key);
attr.addAttributeValue(value);
attrStatement.addAttribute(new ASTChoiceType(attr));
return attrStatement;
}
Aggregations