Class KeyDescriptorBuilder
java.lang.Object
se.swedenconnect.opensaml.common.builder.AbstractSAMLObjectBuilder<org.opensaml.saml.saml2.metadata.KeyDescriptor>
se.swedenconnect.opensaml.saml2.metadata.build.KeyDescriptorBuilder
- All Implemented Interfaces:
SAMLObjectBuilder<org.opensaml.saml.saml2.metadata.KeyDescriptor>
public class KeyDescriptorBuilder
extends AbstractSAMLObjectBuilder<org.opensaml.saml.saml2.metadata.KeyDescriptor>
A builder for
KeyDescriptor
elements.
This builder only supports a subset of the possible elements of a key descriptor, but should be sufficient for most cases.
- Author:
- Martin Lindström (martin@idsec.se)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic KeyDescriptorBuilder
builder()
Utility method that creates a builder.certificate
(InputStream certificate) Assigns an input stream to a certificate resource that is to be used as an X.509 data element of theKeyInfo
element within the key descriptor.certificate
(String base64Encoding) Assigns a certificate (in Base64-encoded format) to be used as an X.509 data element of theKeyInfo
element within the key descriptor.certificate
(X509Certificate certificate) Assigns a certificate to be used as an X.509 data element of theKeyInfo
element within the key descriptor.certificate
(org.opensaml.security.x509.X509Credential credential) Assigns a certificate in OpenSAML credential format to be used as an X.509 data element of theKeyInfo
element within the key descriptor.encryptionMethods
(String... algorithms) encryptionMethods
(List<String> algorithms) Assigns a list of encryption methods.encryptionMethods
(org.opensaml.saml.saml2.metadata.EncryptionMethod... algorithms) encryptionMethodsExt
(List<org.opensaml.saml.saml2.metadata.EncryptionMethod> algorithms) Assigns a list of encryption methods.protected Class
<org.opensaml.saml.saml2.metadata.KeyDescriptor> Returns the object type.Assigns the key name of theKeyInfo
element within the key descriptor.use
(org.opensaml.security.credential.UsageType usageType) Assigns the usage type for the key descriptor.Methods inherited from class se.swedenconnect.opensaml.common.builder.AbstractSAMLObjectBuilder
build, getDefaultElementName, object
-
Constructor Details
-
KeyDescriptorBuilder
public KeyDescriptorBuilder()
-
-
Method Details
-
builder
Utility method that creates a builder.- Returns:
- a builder
-
getObjectType
Returns the object type.- Specified by:
getObjectType
in classAbstractSAMLObjectBuilder<org.opensaml.saml.saml2.metadata.KeyDescriptor>
- Returns:
- the object type
-
use
Assigns the usage type for the key descriptor.- Parameters:
usageType
- the usage type- Returns:
- the builder
-
keyName
Assigns the key name of theKeyInfo
element within the key descriptor.- Parameters:
name
- the key name- Returns:
- the builder
-
certificate
Assigns a certificate to be used as an X.509 data element of theKeyInfo
element within the key descriptor.- Parameters:
certificate
- the certificate- Returns:
- the builder
-
certificate
Assigns an input stream to a certificate resource that is to be used as an X.509 data element of theKeyInfo
element within the key descriptor.- Parameters:
certificate
- the certificate resource- Returns:
- the builder
-
certificate
Assigns a certificate (in Base64-encoded format) to be used as an X.509 data element of theKeyInfo
element within the key descriptor.- Parameters:
base64Encoding
- the base64 encoding (note: not PEM-format)- Returns:
- the builder
-
certificate
Assigns a certificate in OpenSAML credential format to be used as an X.509 data element of theKeyInfo
element within the key descriptor.- Parameters:
credential
- the credential- Returns:
- the builder
-
encryptionMethods
Assigns a list of encryption methods.Note: the method only accepts algorithm URI:s. If you need to assign other parts of an
EncryptionMethod
object you must useencryptionMethodsExt(List)
.- Parameters:
algorithms
- list of algorithms- Returns:
- the builder
-
encryptionMethods
- Parameters:
algorithms
- list of algorithms- Returns:
- the builder
-
encryptionMethodsExt
public KeyDescriptorBuilder encryptionMethodsExt(List<org.opensaml.saml.saml2.metadata.EncryptionMethod> algorithms) Assigns a list of encryption methods.- Parameters:
algorithms
- ordered list of encryption methods- Returns:
- the builder
-
encryptionMethods
public KeyDescriptorBuilder encryptionMethods(org.opensaml.saml.saml2.metadata.EncryptionMethod... algorithms) - Parameters:
algorithms
- ordered list of encryption methods- Returns:
- the builder
-