mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 07:55:47 +01:00
added configuration options for login attempt limits
This commit is contained in:
@@ -52,6 +52,7 @@ import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
@@ -152,7 +153,6 @@ public class ScmConfiguration
|
||||
*/
|
||||
public void load(ScmConfiguration other)
|
||||
{
|
||||
this.servername = other.servername;
|
||||
this.dateFormat = other.dateFormat;
|
||||
this.pluginUrl = other.pluginUrl;
|
||||
this.anonymousAccessEnabled = other.anonymousAccessEnabled;
|
||||
@@ -168,8 +168,11 @@ public class ScmConfiguration
|
||||
this.baseUrl = other.baseUrl;
|
||||
this.disableGroupingGrid = other.disableGroupingGrid;
|
||||
this.enableRepositoryArchive = other.enableRepositoryArchive;
|
||||
this.loginAttemptLimit = other.loginAttemptLimit;
|
||||
this.loginAttemptLimitTimeout = other.loginAttemptLimitTimeout;
|
||||
|
||||
// deprecated fields
|
||||
this.servername = other.servername;
|
||||
this.sslPort = other.sslPort;
|
||||
this.enableSSL = other.enableSSL;
|
||||
this.enablePortForward = other.enablePortForward;
|
||||
@@ -227,7 +230,7 @@ public class ScmConfiguration
|
||||
/**
|
||||
* Returns the date format for the user interface. This format is a
|
||||
* JavaScript date format, from the library moment.js.
|
||||
*
|
||||
*
|
||||
* @see <a href="http://momentjs.com/docs/#/parsing/" target="_blank">http://momentjs.com/docs/#/parsing/</a>
|
||||
* @return moment.js date format
|
||||
*/
|
||||
@@ -249,6 +252,31 @@ public class ScmConfiguration
|
||||
return forwardPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns maximum allowed login attempts.
|
||||
*
|
||||
* @return maximum allowed login attempts
|
||||
*
|
||||
* @since 1.34
|
||||
*/
|
||||
public int getLoginAttemptLimit()
|
||||
{
|
||||
return loginAttemptLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the timeout in seconds for users which are temporary disabled,
|
||||
* because of too many failed login attempts.
|
||||
*
|
||||
* @return login attempt timeout in seconds
|
||||
*
|
||||
* @since 1.34
|
||||
*/
|
||||
public long getLoginAttemptLimitTimeout()
|
||||
{
|
||||
return loginAttemptLimitTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the url of the plugin repository. This url can contain placeholders.
|
||||
* Explanation of the {placeholders}:
|
||||
@@ -581,6 +609,32 @@ public class ScmConfiguration
|
||||
this.forwardPort = forwardPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set maximum allowed login attempts.
|
||||
*
|
||||
*
|
||||
* @param loginAttemptLimit login attempt limit
|
||||
*
|
||||
* @since 1.34
|
||||
*/
|
||||
public void setLoginAttemptLimit(int loginAttemptLimit)
|
||||
{
|
||||
this.loginAttemptLimit = loginAttemptLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the timeout in seconds for users which are temporary disabled,
|
||||
* because of too many failed login attempts.
|
||||
*
|
||||
* @param loginAttemptLimitTimeout login attempt timeout in seconds
|
||||
*
|
||||
* @since 1.34
|
||||
*/
|
||||
public void setLoginAttemptLimitTimeout(long loginAttemptLimitTimeout)
|
||||
{
|
||||
this.loginAttemptLimitTimeout = loginAttemptLimitTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -692,9 +746,6 @@ public class ScmConfiguration
|
||||
@XmlElement(name = "base-url")
|
||||
private String baseUrl;
|
||||
|
||||
/** Field description */
|
||||
private boolean enableProxy = false;
|
||||
|
||||
/** Field description */
|
||||
@XmlElement(name = "force-base-url")
|
||||
private boolean forceBaseUrl;
|
||||
@@ -703,6 +754,24 @@ public class ScmConfiguration
|
||||
@Deprecated
|
||||
private int forwardPort = 80;
|
||||
|
||||
/**
|
||||
* Maximum allowed login attempts.
|
||||
*
|
||||
* @since 1.34
|
||||
*/
|
||||
@XmlElement(name = "login-attempt-limit")
|
||||
private int loginAttemptLimit = -1;
|
||||
|
||||
/**
|
||||
* Login attempt timeout.
|
||||
*
|
||||
* @since 1.34
|
||||
*/
|
||||
private long loginAttemptLimitTimeout = TimeUnit.MINUTES.toSeconds(5l);
|
||||
|
||||
/** Field description */
|
||||
private boolean enableProxy = false;
|
||||
|
||||
/** Field description */
|
||||
@XmlElement(name = "plugin-url")
|
||||
private String pluginUrl = DEFAULT_PLUGINURL;
|
||||
|
||||
Reference in New Issue
Block a user