Class SpEntityDescriptorBuilder
- java.lang.Object
-
- se.litsec.opensaml.core.AbstractSAMLObjectBuilder<EntityDescriptor>
-
- se.litsec.opensaml.saml2.metadata.build.AbstractEntityDescriptorBuilder<SpEntityDescriptorBuilder>
-
- se.litsec.opensaml.saml2.metadata.build.SpEntityDescriptorBuilder
-
- All Implemented Interfaces:
SAMLObjectBuilder<EntityDescriptor>
public class SpEntityDescriptorBuilder extends AbstractEntityDescriptorBuilder<SpEntityDescriptorBuilder>
A builder for building anmd:EntityDescription(metadata) object for a Service Provider.- Author:
- Martin Lindström (martin.lindstrom@litsec.se)
-
-
Field Summary
-
Fields inherited from class se.litsec.opensaml.saml2.metadata.build.AbstractEntityDescriptorBuilder
ENTITY_CATEGORY_ATTRIBUTE_NAME, ENTITY_CATEGORY_TEMPLATE
-
-
Constructor Summary
Constructors Constructor Description SpEntityDescriptorBuilder()Constructor setting up the builder with no template.SpEntityDescriptorBuilder(InputStream resource)Constructor setting up the builder with a templateEntityDescriptorthat is read from a resource.SpEntityDescriptorBuilder(EntityDescriptor template)Constructor setting up the builder with a templateEntityDescriptor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SpEntityDescriptorBuilderassertionConsumerServices(List<AssertionConsumerService> assertionConsumerServices)Addsmd:AssertionConsumerServiceelements to theSPSSODescriptor.SpEntityDescriptorBuilderassertionConsumerServices(AssertionConsumerService... assertionConsumerServices)SpEntityDescriptorBuilderattributeConsumingServices(List<AttributeConsumingService> attributeConsumingServices)Addsmd:AttributeConsumingServiceelements to theSPSSODescriptor.SpEntityDescriptorBuilderattributeConsumingServices(AttributeConsumingService... attributeConsumingServices)SpEntityDescriptorBuilderauthnRequestsSigned(Boolean b)Assigns theAuthnRequestsSignedattribute of themd:SPSSODescriptorelement.static SpEntityDescriptorBuilderbuilder()Utility method that creates aSpEntityDescriptorBuilderinstance.static SpEntityDescriptorBuilderbuilder(InputStream resource)Utility method that creates aSpEntityDescriptorBuilderinstance from a supplied input stream.static SpEntityDescriptorBuilderbuilder(EntityDescriptor template)Utility method that creates aSpEntityDescriptorBuilderinstance from a supplied template.SpEntityDescriptorBuilderdiscoveryResponses(String... locations)SpEntityDescriptorBuilderdiscoveryResponses(List<String> locations)Adds discovery response locations in the given order (first string will be assigned index 1 and so on).protected SpEntityDescriptorBuildergetThis()In order for us to be able to make chaining calls we need to return the concrete type of the builder.protected booleanmatchingSSODescriptorType(EntityDescriptor descriptor)Checks that the SSO descriptor of the suppliedEntityDescriptoris of the correct type given the factory bean type.protected SSODescriptorssoDescriptor()Returns the SSO role descriptor of the template entity descriptor.SpEntityDescriptorBuilderwantAssertionsSigned(Boolean b)Assigns theWantAssertionsSignedattribute of themd:SPSSODescriptorelement.-
Methods inherited from class se.litsec.opensaml.saml2.metadata.build.AbstractEntityDescriptorBuilder
cacheDuration, contactPersons, contactPersons, digestMethods, digestMethods, entityAttributesExtension, entityAttributesExtension, entityCategories, entityCategories, entityID, getObjectType, id, keyDescriptors, keyDescriptors, nameIDFormats, nameIDFormats, organization, signingMethods, signingMethods, singleLogoutServices, singleLogoutServices, uiInfoExtension, updateExtensions, validUntil
-
Methods inherited from class se.litsec.opensaml.core.AbstractSAMLObjectBuilder
build, getDefaultElementName, object
-
-
-
-
Constructor Detail
-
SpEntityDescriptorBuilder
public SpEntityDescriptorBuilder()
Constructor setting up the builder with no template. This means that the entireEntityDescriptorobject is created from data assigned using the builder.
-
SpEntityDescriptorBuilder
public SpEntityDescriptorBuilder(InputStream resource) throws XMLParserException, UnmarshallingException, IOException
Constructor setting up the builder with a templateEntityDescriptorthat is read from a resource. Users of the bean may now change, add or delete, the elements and attributes of the template object using the assignment methods of the builder.- Parameters:
resource- the template resource- Throws:
IOException- if the resource can not be readUnmarshallingException- for unmarshalling errorsXMLParserException- for XML parsing errors
-
SpEntityDescriptorBuilder
public SpEntityDescriptorBuilder(EntityDescriptor template) throws UnmarshallingException, MarshallingException
Constructor setting up the builder with a templateEntityDescriptor. Users of the bean may now change, add or delete, the elements and attributes of the template object using the assignment methods of the builder.- Parameters:
template- the template- Throws:
UnmarshallingException- for unmarshalling errorsMarshallingException- for marshalling errors
-
-
Method Detail
-
builder
public static SpEntityDescriptorBuilder builder()
Utility method that creates aSpEntityDescriptorBuilderinstance.- Returns:
- a
SpEntityDescriptorBuilderinstance
-
builder
public static SpEntityDescriptorBuilder builder(InputStream resource) throws XMLParserException, UnmarshallingException, IOException
Utility method that creates aSpEntityDescriptorBuilderinstance from a supplied input stream.- Parameters:
resource- the template resource- Returns:
- a
SpEntityDescriptorBuilderinstance - Throws:
IOException- if the resource can not be readUnmarshallingException- for unmarshalling errorsXMLParserException- for XML parsing errors
-
builder
public static SpEntityDescriptorBuilder builder(EntityDescriptor template) throws UnmarshallingException, MarshallingException
Utility method that creates aSpEntityDescriptorBuilderinstance from a supplied template.- Parameters:
template- the template- Returns:
- a
SpEntityDescriptorBuilderinstance - Throws:
UnmarshallingException- for unmarshalling errorsMarshallingException- for marshalling errors
-
getThis
protected SpEntityDescriptorBuilder getThis()
In order for us to be able to make chaining calls we need to return the concrete type of the builder.- Specified by:
getThisin classAbstractEntityDescriptorBuilder<SpEntityDescriptorBuilder>- Returns:
- the concrete type of the builder
-
authnRequestsSigned
public SpEntityDescriptorBuilder authnRequestsSigned(Boolean b)
Assigns theAuthnRequestsSignedattribute of themd:SPSSODescriptorelement.- Parameters:
b- boolean (ifnull, the attribute is not set)- Returns:
- the builder
-
wantAssertionsSigned
public SpEntityDescriptorBuilder wantAssertionsSigned(Boolean b)
Assigns theWantAssertionsSignedattribute of themd:SPSSODescriptorelement.- Parameters:
b- whether assertions should be signed- Returns:
- the builder
-
discoveryResponses
public SpEntityDescriptorBuilder discoveryResponses(List<String> locations)
Adds discovery response locations in the given order (first string will be assigned index 1 and so on).- Parameters:
locations- URLs for discovery responses- Returns:
- the builder
-
discoveryResponses
public SpEntityDescriptorBuilder discoveryResponses(String... locations)
- Parameters:
locations- URLs for discovery responses- Returns:
- the builder
- See Also:
discoveryResponses(List)
-
assertionConsumerServices
public SpEntityDescriptorBuilder assertionConsumerServices(List<AssertionConsumerService> assertionConsumerServices)
Addsmd:AssertionConsumerServiceelements to theSPSSODescriptor.- Parameters:
assertionConsumerServices- assertion consumer service objects (cloned before assignment)- Returns:
- the builder
-
assertionConsumerServices
public SpEntityDescriptorBuilder assertionConsumerServices(AssertionConsumerService... assertionConsumerServices)
- Parameters:
assertionConsumerServices- assertion consumer service objects (cloned before assignment)- Returns:
- the builder
- See Also:
assertionConsumerServices(List)
-
attributeConsumingServices
public SpEntityDescriptorBuilder attributeConsumingServices(List<AttributeConsumingService> attributeConsumingServices)
Addsmd:AttributeConsumingServiceelements to theSPSSODescriptor.- Parameters:
attributeConsumingServices- attribute consumer service objects (cloned before assignment)- Returns:
- the builder
-
attributeConsumingServices
public SpEntityDescriptorBuilder attributeConsumingServices(AttributeConsumingService... attributeConsumingServices)
- Parameters:
attributeConsumingServices- attribute consumer service objects (cloned before assignment)- Returns:
- the builder
- See Also:
assertionConsumerServices(List)
-
ssoDescriptor
protected SSODescriptor ssoDescriptor()
Returns the SSO role descriptor of the template entity descriptor. If no role descriptor is present, the method creates such an object.- Specified by:
ssoDescriptorin classAbstractEntityDescriptorBuilder<SpEntityDescriptorBuilder>- Returns:
- the role descriptor
-
matchingSSODescriptorType
protected boolean matchingSSODescriptorType(EntityDescriptor descriptor)
Checks that the SSO descriptor of the suppliedEntityDescriptoris of the correct type given the factory bean type.An entity descriptor that does not yet have an SSODescriptor element will also be regarded as a matching type.
- Specified by:
matchingSSODescriptorTypein classAbstractEntityDescriptorBuilder<SpEntityDescriptorBuilder>- Parameters:
descriptor- the descriptor to check- Returns:
trueif the type is OK, andfalseotherwise
-
-