Class KeyDescriptorBuilder
- java.lang.Object
-
- se.litsec.opensaml.core.AbstractSAMLObjectBuilder<KeyDescriptor>
-
- se.litsec.opensaml.saml2.metadata.build.KeyDescriptorBuilder
-
- All Implemented Interfaces:
SAMLObjectBuilder<KeyDescriptor>
public class KeyDescriptorBuilder extends AbstractSAMLObjectBuilder<KeyDescriptor>
A builder forKeyDescriptorelements.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.lindstrom@litsec.se)
-
-
Constructor Summary
Constructors Constructor Description KeyDescriptorBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static KeyDescriptorBuilderbuilder()Utility method that creates a builder.KeyDescriptorBuildercertificate(InputStream certificate)Assigns an input stream to a certificate resource that is to be used as a X.509 data element of theKeyInfoelement within the key descriptor.KeyDescriptorBuildercertificate(String base64Encoding)Assigns a certificate (in Base64-encoded format) to be used as a X.509 data element of theKeyInfoelement within the key descriptor.KeyDescriptorBuildercertificate(X509Certificate certificate)Assigns a certificate to be used as a X.509 data element of theKeyInfoelement within the key descriptor.KeyDescriptorBuildercertificate(X509Credential credential)Assigns a certificate in OpenSAML credential format to be used as a X.509 data element of theKeyInfoelement within the key descriptor.KeyDescriptorBuilderencryptionMethods(String... algorithms)KeyDescriptorBuilderencryptionMethods(List<String> algorithms)Assigns a list of encryption methods.KeyDescriptorBuilderencryptionMethods(EncryptionMethod... algorithms)KeyDescriptorBuilderencryptionMethodsExt(List<EncryptionMethod> algorithms)Assigns a list of encryption methods.protected Class<KeyDescriptor>getObjectType()Returns the object type.KeyDescriptorBuilderkeyName(String name)Assigns the key name of theKeyInfoelement within the key descriptor.KeyDescriptorBuilderuse(UsageType usageType)Assigns the usage type for the key descriptor.-
Methods inherited from class se.litsec.opensaml.core.AbstractSAMLObjectBuilder
build, getDefaultElementName, object
-
-
-
-
Method Detail
-
builder
public static KeyDescriptorBuilder builder()
Utility method that creates a builder.- Returns:
- a builder
-
getObjectType
protected Class<KeyDescriptor> getObjectType()
Returns the object type.- Specified by:
getObjectTypein classAbstractSAMLObjectBuilder<KeyDescriptor>- Returns:
- the object type
-
use
public KeyDescriptorBuilder use(UsageType usageType)
Assigns the usage type for the key descriptor.- Parameters:
usageType- the usage type- Returns:
- the builder
-
keyName
public KeyDescriptorBuilder keyName(String name)
Assigns the key name of theKeyInfoelement within the key descriptor.- Parameters:
name- the key name- Returns:
- the builder
-
certificate
public KeyDescriptorBuilder certificate(X509Certificate certificate)
Assigns a certificate to be used as a X.509 data element of theKeyInfoelement within the key descriptor.- Parameters:
certificate- the certificate- Returns:
- the builder
-
certificate
public KeyDescriptorBuilder certificate(InputStream certificate)
Assigns an input stream to a certificate resource that is to be used as a X.509 data element of theKeyInfoelement within the key descriptor.- Parameters:
certificate- the certificate resource- Returns:
- the builder
-
certificate
public KeyDescriptorBuilder certificate(String base64Encoding)
Assigns a certificate (in Base64-encoded format) to be used as a X.509 data element of theKeyInfoelement within the key descriptor.- Parameters:
base64Encoding- the base64 encoding (note: not PEM-format)- Returns:
- the builder
-
certificate
public KeyDescriptorBuilder certificate(X509Credential credential)
Assigns a certificate in OpenSAML credential format to be used as a X.509 data element of theKeyInfoelement within the key descriptor.- Parameters:
credential- the credential- Returns:
- the builder
-
encryptionMethods
public KeyDescriptorBuilder encryptionMethods(List<String> algorithms)
Assigns a list of encryption methods.Note: the method only accepts algorithm URI:s. If you need to assign other parts of an
EncryptionMethodobject you must useencryptionMethodsExt(List).- Parameters:
algorithms- list of algorithms- Returns:
- the builder
-
encryptionMethods
public KeyDescriptorBuilder encryptionMethods(String... algorithms)
- Parameters:
algorithms- list of algorithms- Returns:
- the builder
-
encryptionMethodsExt
public KeyDescriptorBuilder encryptionMethodsExt(List<EncryptionMethod> algorithms)
Assigns a list of encryption methods.- Parameters:
algorithms- ordered list of encryption methods- Returns:
- the builder
-
encryptionMethods
public KeyDescriptorBuilder encryptionMethods(EncryptionMethod... algorithms)
- Parameters:
algorithms- ordered list of encryption methods- Returns:
- the builder
-
-