Class ScmConfiguration

java.lang.Object
sonia.scm.config.ScmConfiguration
All Implemented Interfaces:
com.github.sdorra.ssp.PermissionObject, Configuration

@Singleton public class ScmConfiguration extends Object implements Configuration
The main configuration object for SCM-Manager.
  • Field Details

    • DEFAULT_DATEFORMAT

      public static final String DEFAULT_DATEFORMAT
      Default JavaScript date format
      See Also:
    • DEFAULT_PLUGIN_URL

      public static final String DEFAULT_PLUGIN_URL
      See Also:
    • DEFAULT_PLUGIN_AUTH_URL

      public static final String DEFAULT_PLUGIN_AUTH_URL
      Default url for plugin center authentication.
      Since:
      2.28.0
      See Also:
    • DEFAULT_ALERTS_URL

      public static final String DEFAULT_ALERTS_URL
      SCM Manager alerts url.
      Since:
      2.30.0
      See Also:
    • DEFAULT_RELEASE_FEED_URL

      public static final String DEFAULT_RELEASE_FEED_URL
      See Also:
    • DEFAULT_LOGIN_INFO_URL

      public static final String DEFAULT_LOGIN_INFO_URL
      Default url for login information (plugin and feature tips on the login page).
      See Also:
    • DEFAULT_MAIL_DOMAIN_NAME

      public static final String DEFAULT_MAIL_DOMAIN_NAME
      Default e-mail domain name that will be used whenever we have to generate an e-mail address for a user that has no mail address configured.
      Since:
      2.8.0
      See Also:
    • OLD_PLUGINURL

      public static final String OLD_PLUGINURL
      Default plugin url from version 1.0
      See Also:
    • PATH

      public static final String PATH
      Path to the configuration file
    • PERMISSION

      public static final String PERMISSION
      See Also:
  • Constructor Details

    • ScmConfiguration

      public ScmConfiguration()
  • Method Details

    • fireChangeEvent

      public void fireChangeEvent()
    • load

      public void load(ScmConfiguration other)
      Load all properties from another ScmConfiguration object.
      Parameters:
      other - ScmConfiguration to load from
    • getBaseUrl

      public String getBaseUrl()
      Returns the complete base url of the scm-manager including the context path. For example http://localhost:8080/scm
      Returns:
      complete base url of the scm-manager
      Since:
      1.5
    • getServerContextPath

      public String getServerContextPath()
      Returns the context path from the base url (see getBaseUrl()) without starting or ending slashes.
      Since:
      2.42.0
    • getDateFormat

      public String getDateFormat()
      Returns the date format for the user interface. This format is a JavaScript date format, from the library moment.js.
      Returns:
      moment.js date format
      See Also:
    • getLoginAttemptLimit

      public int getLoginAttemptLimit()
    • getLoginAttemptLimitTimeout

      public long getLoginAttemptLimitTimeout()
      Returns the timeout in seconds for users which are temporary disabled, because of too many failed login attempts.
      Returns:
      login attempt timeout in seconds
      Since:
      1.34
    • getPluginUrl

      public String getPluginUrl()
      Returns the url of the plugin repository. This url can contain placeholders. Explanation of the {placeholders}:
      • version = SCM-Manager Version
      • os = Operation System
      • arch = Architecture
      For example `http://plugins.scm-manager.org/scm-plugin-backend/api/{version}/plugins?os={os}&arch={arch}&snapshot=false`
      Returns:
      the complete plugin url.
    • getPluginAuthUrl

      public String getPluginAuthUrl()
      Returns the url which is used for plugin center authentication.
      Returns:
      authentication url
      Since:
      2.28.0
    • isDefaultPluginAuthUrl

      public boolean isDefaultPluginAuthUrl()
      Returns true if the default plugin auth url is used.
      Returns:
      true if the default plugin auth url is used
      Since:
      2.28.0
    • getAlertsUrl

      public String getAlertsUrl()
      Returns the url of the alerts api.
      Returns:
      the alerts url.
      Since:
      2.30.0
    • getReleaseFeedUrl

      public String getReleaseFeedUrl()
      Returns the url of the rss release feed.
      Returns:
      the rss release feed url.
    • getMailDomainName

      public String getMailDomainName()
      Returns the mail domain, that will be used to create e-mail addresses for users without one whenever one is required.
      Returns:
      default mail domain
      Since:
      2.8.0
    • getProxyExcludes

      public Set<String> getProxyExcludes()
      Returns a set of glob patterns for urls which should excluded from proxy settings.
      Returns:
      set of glob patterns
      Since:
      1.23
    • getProxyPassword

      public String getProxyPassword()
    • getProxyPort

      public int getProxyPort()
    • getProxyServer

      public String getProxyServer()
      Returns the servername or ip of the proxyserver.
      Returns:
      servername or ip of the proxyserver
    • getProxyUser

      public String getProxyUser()
    • getRealmDescription

      public String getRealmDescription()
    • getAnonymousMode

      public AnonymousMode getAnonymousMode()
      Returns the currently enabled type of anonymous mode.
      Returns:
      anonymous mode
      Since:
      2.4.0
    • isAnonymousAccessEnabled

      @Deprecated public boolean isAnonymousAccessEnabled()
      Deprecated.
      since 2.4.0 use getAnonymousMode() instead
      Returns true if anonymous mode is enabled.
      Returns:
      true if anonymous mode is enabled
    • isDisableGroupingGrid

      public boolean isDisableGroupingGrid()
    • isEnabledXsrfProtection

      public boolean isEnabledXsrfProtection()
      Returns true if the cookie xsrf protection is enabled.
      Returns:
      true if the cookie xsrf protection is enabled
      Since:
      1.47
      See Also:
    • isEnabledUserConverter

      public boolean isEnabledUserConverter()
      Returns true if the user converter is enabled.
      Returns:
      true if the user converter is enabled The user converter automatically converts an internal user to external on their first login using an external system like ldap
      Since:
      2.9.0
    • isEnabledApiKeys

      public boolean isEnabledApiKeys()
      Returns true if the api keys are enabled.
      Returns:
      true if the api keys is enabled
      Since:
      2.16.0
    • isEnableProxy

      public boolean isEnableProxy()
    • isEnabledFileSearch

      public boolean isEnabledFileSearch()
      Returns true if the repository file search is enabled.
      Returns:
      true if the api keys is enabled
      Since:
      2.45.0
    • isForceBaseUrl

      public boolean isForceBaseUrl()
    • isLoginAttemptLimitEnabled

      public boolean isLoginAttemptLimitEnabled()
    • getNamespaceStrategy

      public String getNamespaceStrategy()
    • getLoginInfoUrl

      public String getLoginInfoUrl()
    • isSkipFailedAuthenticators

      public boolean isSkipFailedAuthenticators()
      Returns true if failed authenticators are skipped.
      Returns:
      true if failed authenticators are skipped
      Since:
      1.36
    • getEmergencyContacts

      public Set<String> getEmergencyContacts()
    • setAnonymousAccessEnabled

      @Deprecated public void setAnonymousAccessEnabled(boolean anonymousAccessEnabled)
      Deprecated.
      since 2.4.0 use setAnonymousMode(AnonymousMode) instead
      Enables the anonymous access at protocol level.
      Parameters:
      anonymousAccessEnabled - enable or disables the anonymous access
    • setAnonymousMode

      public void setAnonymousMode(AnonymousMode mode)
      Configures the anonymous mode.
      Parameters:
      mode - type of anonymous mode
      Since:
      2.4.0
    • setBaseUrl

      public void setBaseUrl(String baseUrl)
    • setDateFormat

      public void setDateFormat(String dateFormat)
    • setDisableGroupingGrid

      public void setDisableGroupingGrid(boolean disableGroupingGrid)
    • setEnableProxy

      public void setEnableProxy(boolean enableProxy)
    • setForceBaseUrl

      public void setForceBaseUrl(boolean forceBaseUrl)
    • setLoginAttemptLimit

      public void setLoginAttemptLimit(int loginAttemptLimit)
      Set maximum allowed login attempts.
      Parameters:
      loginAttemptLimit - login attempt limit
      Since:
      1.34
    • setLoginAttemptLimitTimeout

      public void setLoginAttemptLimitTimeout(long loginAttemptLimitTimeout)
      Sets the timeout in seconds for users which are temporary disabled, because of too many failed login attempts.
      Parameters:
      loginAttemptLimitTimeout - login attempt timeout in seconds
      Since:
      1.34
    • setPluginUrl

      public void setPluginUrl(String pluginUrl)
    • setPluginAuthUrl

      public void setPluginAuthUrl(String pluginAuthUrl)
      Set the url for plugin center authentication.
      Parameters:
      pluginAuthUrl - authentication url
      Since:
      2.28.0
    • setAlertsUrl

      public void setAlertsUrl(String alertsUrl)
      Set the url for the alerts api.
      Parameters:
      alertsUrl - alerts url
      Since:
      2.30.0
    • setReleaseFeedUrl

      public void setReleaseFeedUrl(String releaseFeedUrl)
    • setMailDomainName

      public void setMailDomainName(String mailDomainName)
      Sets the mail host, that will be used to create e-mail addresses for users without one whenever one is required.
      Parameters:
      mailDomainName - The default mail domain to use
      Since:
      2.8.0
    • setProxyExcludes

      public void setProxyExcludes(Set<String> proxyExcludes)
      Set glob patterns for urls which are should be excluded from proxy settings.
      Parameters:
      proxyExcludes - glob patterns
      Since:
      1.23
    • setProxyPassword

      public void setProxyPassword(String proxyPassword)
    • setProxyPort

      public void setProxyPort(int proxyPort)
    • setProxyServer

      public void setProxyServer(String proxyServer)
    • setProxyUser

      public void setProxyUser(String proxyUser)
    • setRealmDescription

      public void setRealmDescription(String realmDescription)
    • setSkipFailedAuthenticators

      public void setSkipFailedAuthenticators(boolean skipFailedAuthenticators)
      If set to true the authentication chain is not stopped, if an authenticator finds the user but fails to authenticate the user.
      Parameters:
      skipFailedAuthenticators - true to skip failed authenticators
      Since:
      1.36
    • setEnabledXsrfProtection

      public void setEnabledXsrfProtection(boolean enabledXsrfProtection)
      Set true to enable xsrf cookie protection.
      Parameters:
      enabledXsrfProtection - true to enable xsrf protection
      Since:
      1.47
      See Also:
    • setEnabledUserConverter

      public void setEnabledUserConverter(boolean enabledUserConverter)
      Set true to enable user converter.
      Parameters:
      enabledUserConverter - true to enable user converter
      Since:
      2.9.0
    • setEnabledApiKeys

      public void setEnabledApiKeys(boolean enabledApiKeys)
      Set true to enable api keys.
      Parameters:
      enabledApiKeys - true to enable api keys
      Since:
      2.16.0
    • setEnabledFileSearch

      public void setEnabledFileSearch(boolean enabledFileSearch)
      Set true to enable file search for repositories.
      Parameters:
      enabledFileSearch - true to enable file search for repositories
      Since:
      2.45.0
    • setNamespaceStrategy

      public void setNamespaceStrategy(String namespaceStrategy)
    • setLoginInfoUrl

      public void setLoginInfoUrl(String loginInfoUrl)
    • setEmergencyContacts

      public void setEmergencyContacts(Set<String> emergencyContacts)
    • getId

      public String getId()
      Specified by:
      getId in interface com.github.sdorra.ssp.PermissionObject