Class PropertyManagerGeneric
java.lang.Object
com.atlassian.crowd.manager.property.PropertyManagerGeneric
- All Implemented Interfaces:
InternalPropertyManager
,PropertyManager
@Transactional
public class PropertyManagerGeneric
extends Object
implements InternalPropertyManager
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final String
static final String
static final int
static final Set<LookAndFeelConstants.ImageType>
-
Constructor Summary
ConstructorDescriptionPropertyManagerGeneric
(PropertyDAO propertyDAO, com.atlassian.event.api.EventPublisher eventPublisher) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Generates and stores a DES key for DES encoded passwords.Retrieves the audit log configurationboolean
getBoolean
(String property, boolean defaultValue) Gets a boolean property.This method returns the current build number for Crowd from the datastore.int
Will return the Domain property from the datastore or null if the domain has not been set.int
Gets an integer property.int
getIntOrThrowIllegalArgumentException
(String property, int defaultValue) getOptionalProperty
(String name) Retrieves an arbitrary property by name.getProperty
(String name) Retrieves an arbitrary property by name.protected Property
getPropertyObject
(String name) Retrieves remember me configurationlong
Deprecated.Gets a string property.Retrieves a String that contains a list of proxy servers we trust to correctly set the X-Forwarded-For flag.boolean
boolean
boolean
Should the client IP address be included as a validation factor?boolean
boolean
Should public services be used for user avatars?boolean
Will return true if the Crowd instance is using database token storage for authenticationToken
's otherwise assume we are using in-memoryvoid
Removes Look and Feel configurationvoid
removeProperty
(String name) Will attempt to remove a property from the datastorevoid
Saves backup configurationvoid
setAuditLogConfiguration
(AuditLogConfiguration newConfiguration) Persists the audit log configurationvoid
setBaseUrl
(URI url) Sets the base URL for this Crowd application instancevoid
setBuildNumber
(Integer buildNumber) Will set the buildNumber for the current release of Crowd.void
setCacheEnabled
(boolean enabled) void
setCookieConfiguration
(CookieConfiguration cookieConfiguration) Updates the configuration of Crowd's cookie-based SSOvoid
setCurrentLicenseResourceTotal
(int total) void
setDeploymentTitle
(String title) void
void
setGzipEnabled
(boolean gzip) void
setIncludeIpAddressInValidationFactors
(boolean includeIpAddressInValidationFactors) void
setLookAndFeelConfiguration
(LookAndFeelConfiguration lookAndFeelConfiguration, ImageInfo updatedLogoInfo) Sets Look and Feel configurationvoid
setNotificationEmail
(String notificationEmail) void
setNotificationEmails
(List<String> serverAlertAddresses) Sets notification emails.void
setPrivateKeyCertificateToSign
(long privateKeyCertificatePairId) Sets ID of private key/certificate pair used to sign assertions in SAMLvoid
setProperty
(String name, String value) Sets an arbitrary property.void
setRememberMeConfiguration
(CrowdSpecificRememberMeSettings configuration) Sets remember me configurationvoid
setSecureCookie
(boolean secure) void
setSessionTime
(long time) void
setSMTPServer
(SMTPServer server) void
setSMTPTemplate
(String template) Deprecated.void
setTrustedProxyServers
(String proxyServers) Persists a String containing a list of proxy servers we trust to correctly set the X-Forwarded-For flag.void
setUseWebAvatars
(boolean useWebAvatars) void
setUsingDatabaseTokenStorage
(boolean isUsingDatabaseTokenStorage) Will set a property to state that this crowd instance is using database token storage, otherwise assume we are using in-memory
-
Field Details
-
DEFAULT_SCHEDULED_BACKUP_HOUR
public static final int DEFAULT_SCHEDULED_BACKUP_HOUR- See Also:
-
DEFAULT_SCHEDULED_BACKUP_MINUTE
public static final int DEFAULT_SCHEDULED_BACKUP_MINUTE- See Also:
-
SUPPORTED_LOGO_TYPES
-
MAX_LOGO_SIZE_IN_BYTES
public static final int MAX_LOGO_SIZE_IN_BYTES- See Also:
-
LOGO_IMAGE_KEY
- See Also:
-
IMAGE_TOO_LARGE_ERROR_MESSAGE
- See Also:
-
-
Constructor Details
-
PropertyManagerGeneric
public PropertyManagerGeneric(PropertyDAO propertyDAO, com.atlassian.event.api.EventPublisher eventPublisher)
-
-
Method Details
-
getDeploymentTitle
- Specified by:
getDeploymentTitle
in interfacePropertyManager
- Returns:
- deployment title.
- Throws:
PropertyManagerException
- property does not exist.
-
setDeploymentTitle
- Specified by:
setDeploymentTitle
in interfacePropertyManager
- Parameters:
title
- deployment title.
-
getDomain
Description copied from interface:PropertyManager
Will return the Domain property from the datastore or null if the domain has not been set.- Specified by:
getDomain
in interfacePropertyManager
- Returns:
- domain or null
-
setDomain
- Specified by:
setDomain
in interfacePropertyManager
- Parameters:
domain
- SSO cookie domain.
-
isSecureCookie
public boolean isSecureCookie()- Specified by:
isSecureCookie
in interfacePropertyManager
- Returns:
true
if the "secure" flag should be set on the SSO cookie.
-
setSecureCookie
public void setSecureCookie(boolean secure) - Specified by:
setSecureCookie
in interfacePropertyManager
- Parameters:
secure
-true
if the "secure" flag should be set on the SSO cookie.
-
setCacheEnabled
public void setCacheEnabled(boolean enabled) - Specified by:
setCacheEnabled
in interfacePropertyManager
- Parameters:
enabled
-true
if application authorisation caching should be used on the server-side.
-
isCacheEnabled
public boolean isCacheEnabled()- Specified by:
isCacheEnabled
in interfacePropertyManager
- Returns:
true
if application authorisation caching is used on the server-side.
-
getSessionTime
public long getSessionTime()- Specified by:
getSessionTime
in interfacePropertyManager
- Returns:
- number of minutes the session is valid.
-
setSessionTime
public void setSessionTime(long time) - Specified by:
setSessionTime
in interfacePropertyManager
- Parameters:
time
- number of minutes the session is valid.
-
getSMTPServer
- Specified by:
getSMTPServer
in interfacePropertyManager
- Returns:
- SMTP server config.
- Throws:
PropertyManagerException
- property does not exist.
-
setSMTPServer
- Specified by:
setSMTPServer
in interfacePropertyManager
- Parameters:
server
- SMTP server config.
-
getDesEncryptionKey
- Specified by:
getDesEncryptionKey
in interfacePropertyManager
- Returns:
- DES key for DES encoded passwords.
- Throws:
PropertyManagerException
- property does not exist.
-
generateDesEncryptionKey
Description copied from interface:PropertyManager
Generates and stores a DES key for DES encoded passwords.- Specified by:
generateDesEncryptionKey
in interfacePropertyManager
- Throws:
PropertyManagerException
- DES algorithm does not exist.
-
setSMTPTemplate
Deprecated.- Specified by:
setSMTPTemplate
in interfacePropertyManager
- Parameters:
template
- mail template.
-
getSMTPTemplate
Deprecated.- Specified by:
getSMTPTemplate
in interfacePropertyManager
- Returns:
- mail template.
- Throws:
PropertyManagerException
- property does not exist.
-
setCurrentLicenseResourceTotal
public void setCurrentLicenseResourceTotal(int total) - Specified by:
setCurrentLicenseResourceTotal
in interfacePropertyManager
- Parameters:
total
- license resource total.
-
getCurrentLicenseResourceTotal
public int getCurrentLicenseResourceTotal()- Specified by:
getCurrentLicenseResourceTotal
in interfacePropertyManager
- Returns:
- license resource total.
-
setNotificationEmail
- Specified by:
setNotificationEmail
in interfacePropertyManager
- Parameters:
notificationEmail
- notification email.
-
setNotificationEmails
Description copied from interface:InternalPropertyManager
Sets notification emails.- Specified by:
setNotificationEmails
in interfaceInternalPropertyManager
- Parameters:
serverAlertAddresses
- list of notification emails.
-
getNotificationEmail
- Specified by:
getNotificationEmail
in interfacePropertyManager
- Returns:
- notification email.
- Throws:
PropertyManagerException
- property does not exist
-
getNotificationEmails
- Specified by:
getNotificationEmails
in interfaceInternalPropertyManager
- Returns:
- List of notification emails.
- Throws:
PropertyManagerException
- property does not exist
-
isGzipEnabled
- Specified by:
isGzipEnabled
in interfacePropertyManager
- Returns:
true
if GZip compression should be used.- Throws:
PropertyManagerException
- property does not exist.
-
setGzipEnabled
public void setGzipEnabled(boolean gzip) - Specified by:
setGzipEnabled
in interfacePropertyManager
- Parameters:
gzip
-true
if GZip compression should be used.
-
getBuildNumber
Description copied from interface:PropertyManager
This method returns the current build number for Crowd from the datastore. This BuildNumber may not be the same as the build number inBuildUtils.BUILD_NUMBER
since this number is for the current release of Crowd, while the number in the database may still be set to a previous version if the UpgradeManager has not been run.- Specified by:
getBuildNumber
in interfacePropertyManager
- Returns:
- an Integer representing the current build number in the database.
- Throws:
PropertyManagerException
- if we fail to find the buildNumber
-
setBuildNumber
Description copied from interface:PropertyManager
Will set the buildNumber for the current release of Crowd.- Specified by:
setBuildNumber
in interfacePropertyManager
- Parameters:
buildNumber
- the buildNumber to set in the database
-
getTrustedProxyServers
Retrieves a String that contains a list of proxy servers we trust to correctly set the X-Forwarded-For flag. Internal format of this string is the responsibility ofTrustedProxyManager
.- Specified by:
getTrustedProxyServers
in interfacePropertyManager
- Returns:
- list of proxy servers we trust
- Throws:
PropertyManagerException
- If the list of proxy servers could not be found.
-
setTrustedProxyServers
Persists a String containing a list of proxy servers we trust to correctly set the X-Forwarded-For flag. Internal format of this string is the responsibility ofTrustedProxyManager
.- Specified by:
setTrustedProxyServers
in interfacePropertyManager
- Parameters:
proxyServers
- proxy servers.- Throws:
org.springframework.dao.DataAccessException
- If the list of proxy servers could not be saved.
-
setAuditLogConfiguration
Description copied from interface:PropertyManager
Persists the audit log configuration- Specified by:
setAuditLogConfiguration
in interfacePropertyManager
- Parameters:
newConfiguration
- new configuration
-
getAuditLogConfiguration
Description copied from interface:PropertyManager
Retrieves the audit log configuration- Specified by:
getAuditLogConfiguration
in interfacePropertyManager
- Returns:
- audit log configuration, default if not found
-
isUsingDatabaseTokenStorage
public boolean isUsingDatabaseTokenStorage()Description copied from interface:PropertyManager
Will return true if the Crowd instance is using database token storage for authenticationToken
's otherwise assume we are using in-memory- Specified by:
isUsingDatabaseTokenStorage
in interfacePropertyManager
- Returns:
- true if database token storage is being used.
-
setUsingDatabaseTokenStorage
public void setUsingDatabaseTokenStorage(boolean isUsingDatabaseTokenStorage) Description copied from interface:PropertyManager
Will set a property to state that this crowd instance is using database token storage, otherwise assume we are using in-memory- Specified by:
setUsingDatabaseTokenStorage
in interfacePropertyManager
- Parameters:
isUsingDatabaseTokenStorage
- true if you are switching to in-memory token storage
-
isIncludeIpAddressInValidationFactors
public boolean isIncludeIpAddressInValidationFactors()Description copied from interface:PropertyManager
Should the client IP address be included as a validation factor?- Specified by:
isIncludeIpAddressInValidationFactors
in interfacePropertyManager
-
isUseWebAvatars
public boolean isUseWebAvatars()Description copied from interface:PropertyManager
Should public services be used for user avatars?- Specified by:
isUseWebAvatars
in interfacePropertyManager
-
setUseWebAvatars
public void setUseWebAvatars(boolean useWebAvatars) - Specified by:
setUseWebAvatars
in interfacePropertyManager
-
getCookieConfiguration
- Specified by:
getCookieConfiguration
in interfacePropertyManager
- Returns:
- the current configuration of Crowd's cookie-based SSO
-
setCookieConfiguration
Description copied from interface:PropertyManager
Updates the configuration of Crowd's cookie-based SSO- Specified by:
setCookieConfiguration
in interfacePropertyManager
- Parameters:
cookieConfiguration
- the configuration to set, will replace the existing configuration
-
setIncludeIpAddressInValidationFactors
public void setIncludeIpAddressInValidationFactors(boolean includeIpAddressInValidationFactors) - Specified by:
setIncludeIpAddressInValidationFactors
in interfacePropertyManager
-
setRememberMeConfiguration
Description copied from interface:InternalPropertyManager
Sets remember me configuration- Specified by:
setRememberMeConfiguration
in interfaceInternalPropertyManager
- Parameters:
configuration
- new configuration
-
getRememberMeConfiguration
Description copied from interface:InternalPropertyManager
Retrieves remember me configuration- Specified by:
getRememberMeConfiguration
in interfaceInternalPropertyManager
- Returns:
- current configuration
-
removeProperty
Description copied from interface:PropertyManager
Will attempt to remove a property from the datastore- Specified by:
removeProperty
in interfacePropertyManager
- Parameters:
name
- the name of the property.
-
getPropertyObject
- Throws:
ObjectNotFoundException
-
getProperty
Description copied from interface:PropertyManager
Retrieves an arbitrary property by name.- Specified by:
getProperty
in interfacePropertyManager
- Parameters:
name
- name of property.- Returns:
- value.
- Throws:
ObjectNotFoundException
- property does not exist.
-
getOptionalProperty
Description copied from interface:PropertyManager
Retrieves an arbitrary property by name.- Specified by:
getOptionalProperty
in interfacePropertyManager
- Parameters:
name
- name of property.- Returns:
- value if found, none otherwise
-
setProperty
Description copied from interface:PropertyManager
Sets an arbitrary property.- Specified by:
setProperty
in interfacePropertyManager
- Parameters:
name
- name of property.value
- value.
-
getString
Description copied from interface:PropertyManager
Gets a string property. If the property is not defined, return the supplied default value.- Specified by:
getString
in interfacePropertyManager
- Parameters:
property
- a property namedefaultValue
- the default value to use if the property does not exist- Returns:
- the value of the property, or defaultValue if the property didn't exist
-
getBoolean
Description copied from interface:PropertyManager
Gets a boolean property. If the property is not defined, return the supplied default value.- Specified by:
getBoolean
in interfacePropertyManager
- Parameters:
property
- a property namedefaultValue
- the default value to use if the property does not exist- Returns:
- the value of the property, or defaultValue if the property didn't exist
-
getInt
Description copied from interface:PropertyManager
Gets an integer property. If the property is not defined, or does not contain a valid integer, return the supplied default value.- Specified by:
getInt
in interfacePropertyManager
- Parameters:
property
- a property namedefaultValue
- the default value to use if the property does not exist or is invalid- Returns:
- the value of the property, or defaultValue if the property didn't exist or was corrupted
-
getIntOrThrowIllegalArgumentException
-
setBaseUrl
Description copied from interface:PropertyManager
Sets the base URL for this Crowd application instance- Specified by:
setBaseUrl
in interfacePropertyManager
- Parameters:
url
- the base url to set, should be a proper absolute URL
-
getBaseUrl
- Specified by:
getBaseUrl
in interfacePropertyManager
- Returns:
- the current base url for this Crowd application instance
- Throws:
PropertyManagerException
- if the property is not configured correctly- See Also:
-
ApplicationProperties.getBaseUrl(com.atlassian.sal.api.UrlMode)
-
getPrivateKeyCertificatePairToSign
- Specified by:
getPrivateKeyCertificatePairToSign
in interfacePropertyManager
- Returns:
- ID of private key/certificate used to sign assertions in SAML if found, none otherwise
-
setPrivateKeyCertificateToSign
public void setPrivateKeyCertificateToSign(long privateKeyCertificatePairId) Description copied from interface:PropertyManager
Sets ID of private key/certificate pair used to sign assertions in SAML- Specified by:
setPrivateKeyCertificateToSign
in interfacePropertyManager
- Parameters:
privateKeyCertificatePairId
- ID of private key/certificate pair to save
-
getBackupConfiguration
- Specified by:
getBackupConfiguration
in interfacePropertyManager
- Returns:
- Backup configuration
-
saveBackupConfiguration
Description copied from interface:PropertyManager
Saves backup configuration- Specified by:
saveBackupConfiguration
in interfacePropertyManager
- Parameters:
config
- configuration of backup to save
-
getLookAndFeelConfiguration
@Nonnull public Optional<LookAndFeelConfiguration> getLookAndFeelConfiguration() throws PropertyManagerException- Specified by:
getLookAndFeelConfiguration
in interfacePropertyManager
- Returns:
- Look and Feel configuration if configured, none otherwise
- Throws:
PropertyManagerException
- if there was an error while fetching configuration
-
setLookAndFeelConfiguration
public void setLookAndFeelConfiguration(LookAndFeelConfiguration lookAndFeelConfiguration, ImageInfo updatedLogoInfo) throws PropertyManagerException Description copied from interface:PropertyManager
Sets Look and Feel configuration- Specified by:
setLookAndFeelConfiguration
in interfacePropertyManager
- Parameters:
lookAndFeelConfiguration
- look and feel configurationupdatedLogoInfo
- information about custom logo. If custom logo was already set and new value is not null then old logo will be overridden by new one.- Throws:
PropertyManagerException
- if there was an error while saving configuration
-
removeLookAndFeelConfiguration
Description copied from interface:PropertyManager
Removes Look and Feel configuration- Specified by:
removeLookAndFeelConfiguration
in interfacePropertyManager
- Throws:
PropertyManagerException
- if there was an error while removing configuration
-
getLogoImage
- Specified by:
getLogoImage
in interfacePropertyManager
- Returns:
- logo image if configured, none otherwise
- Throws:
PropertyManagerException
- if there was an error while fetching a logo
-