Package tigase.io
Class CertificateContainer
java.lang.Object
tigase.io.CertificateContainer
- All Implemented Interfaces:
RepositoryChangeListenerIfc<CertificateItem>,CertificateContainerIfc,Initializable,RegistrarBean,UnregisterAware
@Bean(name="certificate-container",
parent=Kernel.class,
active=true,
exportable=true)
public class CertificateContainer
extends Object
implements CertificateContainerIfc, Initializable, UnregisterAware, RegistrarBean, RepositoryChangeListenerIfc<CertificateItem>
Class used to keep SSL certificates loaded in memory. To get instance use getter from TLSUtil class.
Created by andrzej on 29.02.2016.
Created by andrzej on 29.02.2016.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEvent indicating certificate change that will be distributed in the cluster.classNested classes/interfaces inherited from interface tigase.io.CertificateContainerIfc
CertificateContainerIfc.CertificateEntity -
Field Summary
FieldsFields inherited from interface tigase.io.CertificateContainerIfc
CERTIFICATE_CONTAINER_CLASS_KEY, CERTIFICATE_CONTAINER_CLASS_VAL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCertificates(Map<String, String> params) MethodaddCertificatesallows to add more certificates at run time after the container has bee already initialized.voidaddCertificates(CertificateContainerIfc.CertificateEntity certificateEntity) voidMethod called before bean unregister.voidcreateCertificate(String alias) MethodcreateCertificateallows to generate self-signed certificate for passed domain name.sgetCertificateEntry(String hostname) Method to retrieve default alias of certificate to use when domain isnullgetKeyManagers(String hostname) Method returns array ofKeyManagerwith certificate for domain ornullif there is no certificate for domainvoidMethod used to pass parameters to initialize instance of classvoidMethod will be called, when bean will be created, configured and ready to use.voiditemAdded(CertificateItem item) voiditemRemoved(CertificateItem item) voiditemUpdated(CertificateItem item) voidMethod called when bean is being registered allowing developer to programatically register other beans.voidsetRepository(CertificateRepository repository) voidunregister(Kernel kernel) Method called while bean is being unregistered.
-
Field Details
-
PER_DOMAIN_CERTIFICATE_KEY
- See Also:
-
SNI_DISABLE_KEY
- See Also:
-
-
Constructor Details
-
CertificateContainer
public CertificateContainer()
-
-
Method Details
-
setRepository
-
addCertificates
Description copied from interface:CertificateContainerIfcMethodaddCertificatesallows to add more certificates at run time after the container has bee already initialized. This is to avoid server restart if there are certificates updates or new certificates for new virtual domain. The method should add new certificates or replace existing one if there is already a certificate for a domain.- Specified by:
addCertificatesin interfaceCertificateContainerIfc- Parameters:
params- aMapvalue with configuration parameters.- Throws:
CertificateParsingException
-
addCertificates
public void addCertificates(CertificateContainerIfc.CertificateEntity certificateEntity) throws CertificateParsingException - Specified by:
addCertificatesin interfaceCertificateContainerIfc- Throws:
CertificateParsingException
-
createCertificate
public KeyManager[] createCertificate(String alias) throws NoSuchAlgorithmException, CertificateException, SignatureException, NoSuchProviderException, InvalidKeyException, IOException, UnrecoverableKeyException, KeyStoreException Description copied from interface:CertificateContainerIfcMethodcreateCertificateallows to generate self-signed certificate for passed domain name.s- Specified by:
createCertificatein interfaceCertificateContainerIfc- Parameters:
alias- domain for which certificate should be generated- Returns:
- an array of
KeyManagercontaining generated certificate - Throws:
NoSuchAlgorithmExceptionCertificateExceptionSignatureExceptionNoSuchProviderExceptionInvalidKeyExceptionIOExceptionUnrecoverableKeyExceptionKeyStoreException
-
getDefCertAlias
Description copied from interface:CertificateContainerIfcMethod to retrieve default alias of certificate to use when domain isnull- Specified by:
getDefCertAliasin interfaceCertificateContainerIfc- Returns:
- default alias
-
getCertificateEntry
- Specified by:
getCertificateEntryin interfaceCertificateContainerIfc
-
getKeyManagers
Description copied from interface:CertificateContainerIfcMethod returns array ofKeyManagerwith certificate for domain ornullif there is no certificate for domain- Specified by:
getKeyManagersin interfaceCertificateContainerIfc
-
getTrustManagers
- Specified by:
getTrustManagersin interfaceCertificateContainerIfc
-
getTrustStore
- Specified by:
getTrustStorein interfaceCertificateContainerIfc
-
init
Description copied from interface:CertificateContainerIfcMethod used to pass parameters to initialize instance of class- Specified by:
initin interfaceCertificateContainerIfc
-
itemAdded
- Specified by:
itemAddedin interfaceRepositoryChangeListenerIfc<CertificateItem>
-
itemUpdated
- Specified by:
itemUpdatedin interfaceRepositoryChangeListenerIfc<CertificateItem>
-
itemRemoved
- Specified by:
itemRemovedin interfaceRepositoryChangeListenerIfc<CertificateItem>
-
initialize
public void initialize()Description copied from interface:InitializableMethod will be called, when bean will be created, configured and ready to use.- Specified by:
initializein interfaceInitializable
-
beforeUnregister
public void beforeUnregister()Description copied from interface:UnregisterAwareMethod called before bean unregister.- Specified by:
beforeUnregisterin interfaceUnregisterAware
-
certificateChange
-
register
Description copied from interface:RegistrarBeanMethod called when bean is being registered allowing developer to programatically register other beans.- Specified by:
registerin interfaceRegistrarBean- Parameters:
kernel- - instance from local scope
-
unregister
Description copied from interface:RegistrarBeanMethod called while bean is being unregistered.- Specified by:
unregisterin interfaceRegistrarBean- Parameters:
kernel- - instance from local scope
-