* @throws org.apache.directory.api.ldap.model.exception.LdapException
*/
public static KdcServer createKdcServer( DirectoryServiceBean directoryServiceBean,
DirectoryService directoryService ) throws LdapException
{
KdcServerBean kdcServerBean = directoryServiceBean.getKdcServerBean();
// Fist, do nothing if the KdcServer is disabled
if ( ( kdcServerBean == null ) || kdcServerBean.isDisabled() )
{
return null;
}
KerberosConfig kdcConfig = new KerberosConfig();
// AllowableClockSkew
kdcConfig.setAllowableClockSkew( kdcServerBean.getKrbAllowableClockSkew() );
// BodyChecksumVerified
kdcConfig.setBodyChecksumVerified( kdcServerBean.isKrbBodyChecksumVerified() );
// EmptyAddressesAllowed
kdcConfig.setEmptyAddressesAllowed( kdcServerBean.isKrbEmptyAddressesAllowed() );
// EncryptionType
EncryptionType[] encryptionTypes = createEncryptionTypes( kdcServerBean.getKrbEncryptionTypes() );
kdcConfig.setEncryptionTypes( encryptionTypes );
// ForwardableAllowed
kdcConfig.setForwardableAllowed( kdcServerBean.isKrbForwardableAllowed() );
// KdcPrincipal
kdcConfig.setServicePrincipal( "krbtgt/" + kdcServerBean.getKrbPrimaryRealm() + "@"
+ kdcServerBean.getKrbPrimaryRealm() );
// MaximumRenewableLifetime
kdcConfig.setMaximumRenewableLifetime( kdcServerBean.getKrbMaximumRenewableLifetime() );
// MaximumTicketLifetime
kdcConfig.setMaximumTicketLifetime( kdcServerBean.getKrbMaximumTicketLifetime() );
// PaEncTimestampRequired
kdcConfig.setPaEncTimestampRequired( kdcServerBean.isKrbPaEncTimestampRequired() );
// PostdatedAllowed
kdcConfig.setPostdatedAllowed( kdcServerBean.isKrbPostdatedAllowed() );
// PrimaryRealm
kdcConfig.setPrimaryRealm( kdcServerBean.getKrbPrimaryRealm() );
// ProxiableAllowed
kdcConfig.setProxiableAllowed( kdcServerBean.isKrbProxiableAllowed() );
// RenewableAllowed
kdcConfig.setRenewableAllowed( kdcServerBean.isKrbRenewableAllowed() );
// searchBaseDn
kdcConfig.setSearchBaseDn( kdcServerBean.getSearchBaseDn().getName() );
KdcServer kdcServer = new KdcServer( kdcConfig );
kdcServer.setDirectoryService( directoryService );
kdcServer.setEnabled( true );
// The ID
kdcServer.setServiceId( kdcServerBean.getServerId() );
// The transports
Transport[] transports = createTransports( kdcServerBean.getTransports() );
kdcServer.setTransports( transports );
ChangePasswordServerBean changePasswordServerBean = directoryServiceBean.getChangePasswordServerBean();
// Fist, do nothing if the ChangePasswordServer is disabled