Package org.opensaml.xmlsec.keyinfo.impl
Class BasicKeyInfoGeneratorFactory.BasicKeyInfoGenerator
- java.lang.Object
-
- org.opensaml.xmlsec.keyinfo.impl.BasicKeyInfoGeneratorFactory.BasicKeyInfoGenerator
-
- All Implemented Interfaces:
KeyInfoGenerator
- Direct Known Subclasses:
KeyAgreementKeyInfoGeneratorFactory.KeyAgreementKeyInfoGenerator,X509KeyInfoGeneratorFactory.X509KeyInfoGenerator
- Enclosing class:
- BasicKeyInfoGeneratorFactory
public class BasicKeyInfoGeneratorFactory.BasicKeyInfoGenerator extends Object implements KeyInfoGenerator
An implementation ofKeyInfoGeneratorcapable of handling the information contained within aCredential.
-
-
Field Summary
Fields Modifier and Type Field Description private XMLObjectBuilderFactorybuilderFactoryBuilder factory for KeyInfo objects.private Class<? extends KeyInfo>keyInfoTypeThe specific type of KeyInfo to generate.private BasicKeyInfoGeneratorFactory.BasicOptionsoptionsThe set of options to be used by the generator.
-
Constructor Summary
Constructors Modifier Constructor Description protectedBasicKeyInfoGenerator(BasicKeyInfoGeneratorFactory.BasicOptions newOptions, Class<? extends KeyInfo> type)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected KeyInfobuildKeyInfo()Build a new KeyInfo instance.protected QNameclassToElementName(Class<? extends KeyInfo> type)Map the specified KeyInfo type to an elementQName.KeyInfogenerate(Credential credential)protected voidprocessEntityID(KeyInfo keyInfo, Credential credential)Process the value ofCredential.getEntityId().protected voidprocessKeyNames(KeyInfo keyInfo, Credential credential)Process the values ofCredential.getKeyNames().protected voidprocessPublicKey(KeyInfo keyInfo, Credential credential)Process the value ofCredential.getPublicKey().
-
-
-
Field Detail
-
options
@Nonnull private final BasicKeyInfoGeneratorFactory.BasicOptions options
The set of options to be used by the generator.
-
keyInfoType
@Nonnull private final Class<? extends KeyInfo> keyInfoType
The specific type of KeyInfo to generate.
-
builderFactory
@Nonnull private final XMLObjectBuilderFactory builderFactory
Builder factory for KeyInfo objects.
-
-
Constructor Detail
-
BasicKeyInfoGenerator
protected BasicKeyInfoGenerator(@Nonnull BasicKeyInfoGeneratorFactory.BasicOptions newOptions, @Nullable Class<? extends KeyInfo> type)Constructor.- Parameters:
newOptions- the options to be used by the generatortype- the type of element to produce
-
-
Method Detail
-
generate
@Nullable public KeyInfo generate(@Nullable Credential credential) throws SecurityException
- Specified by:
generatein interfaceKeyInfoGenerator- Throws:
SecurityException
-
buildKeyInfo
protected KeyInfo buildKeyInfo() throws SecurityException
Build a new KeyInfo instance.The exact element type is determined by
keyInfoTypewhich was supplied at factory construction.- Returns:
- a new KeyInfo instance
- Throws:
SecurityException- if class type can not be mapped to an elementQName
-
classToElementName
@Nullable protected QName classToElementName(@Nonnull Class<? extends KeyInfo> type)
Map the specified KeyInfo type to an elementQName.Subclasses may override to implement new types or custom mappings.
- Parameters:
type- the KeyInfo element type- Returns:
- the mapped element name
-
processKeyNames
protected void processKeyNames(@Nonnull KeyInfo keyInfo, @Nonnull Credential credential)Process the values ofCredential.getKeyNames().- Parameters:
keyInfo- the KeyInfo that is being builtcredential- the Credential that is geing processed
-
processEntityID
protected void processEntityID(@Nonnull KeyInfo keyInfo, @Nonnull Credential credential)Process the value ofCredential.getEntityId().- Parameters:
keyInfo- the KeyInfo that is being builtcredential- the Credential that is geing processed
-
processPublicKey
protected void processPublicKey(@Nonnull KeyInfo keyInfo, @Nonnull Credential credential) throws SecurityExceptionProcess the value ofCredential.getPublicKey().- Parameters:
keyInfo- the KeyInfo that is being builtcredential- the Credential that is being processed- Throws:
SecurityException- if the public key can't be encoded properly
-
-