congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
LockOutRealm
Code IndexAdd Tabnine to your IDE (free)

How to use
LockOutRealm
in
org.apache.catalina.realm

Best Java code snippets using org.apache.catalina.realm.LockOutRealm (Showing top 20 results out of 315)

origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

private Principal filterLockedAccounts(String username, Principal authenticatedUser) {
  // Register all failed authentications
  if (authenticatedUser == null && isAvailable()) {
    registerAuthFailure(username);
  }
  if (isLocked(username)) {
    // If the user is currently locked, authentication will always fail
    log.warn(sm.getString("lockOutRealm.authLockedUser", username));
    return null;
  }
  if (authenticatedUser != null) {
    registerAuthSuccess(username);
  }
  return authenticatedUser;
}
origin: org.apache.geronimo.ext.tomcat/catalina

/**
 * Return the Principal associated with the specified username and
 * credentials, if there is one; otherwise return <code>null</code>.
 *
 * @param username Username of the Principal to look up
 * @param credentials Password or other credentials to use in
 *  authenticating this username
 */
@Override
public Principal authenticate(String username, String credentials) {
  if (isLocked(username)) {
    // Trying to authenticate a locked user is an automatic failure
    registerAuthFailure(username);
    
    log.warn(sm.getString("lockOutRealm.authLockedUser", username));
    return null;
  }
  Principal authenticatedUser = super.authenticate(username, credentials);
  
  if (authenticatedUser == null) {
    registerAuthFailure(username);
  } else {
    registerAuthSuccess(username);
  }
  return authenticatedUser;
}
origin: com.ovea.tajin.servers/tajin-server-jetty9

/**
 * Unlock the specified username. This will remove all records of
 * authentication failures for this user.
 * 
 * @param username The user to unlock
 */
public void unlock(String username) {
  // Auth success clears the lock record so... 
  registerAuthSuccess(username);
}
 
origin: org.apache.tomcat/tomcat-catalina

/**
 * Return the Principal associated with the specified username and
 * credentials, if there is one; otherwise return <code>null</code>.
 *
 * @param username Username of the Principal to look up
 * @param credentials Password or other credentials to use in
 *  authenticating this username
 */
@Override
public Principal authenticate(String username, String credentials) {
  Principal authenticatedUser = super.authenticate(username, credentials);
  return filterLockedAccounts(username, authenticatedUser);
}
origin: org.apache.catalina/com.springsource.org.apache.catalina

/**
 * Return the Principal associated with the specified username and
 * credentials, if there is one; otherwise return <code>null</code>.
 *
 * @param username Username of the Principal to look up
 * @param credentials Password or other credentials to use in
 *  authenticating this username
 */
@Override
public Principal authenticate(String username, String credentials) {
  if (isLocked(username)) {
    // Trying to authenticate a locked user is an automatic failure
    registerAuthFailure(username);
    
    log.warn(sm.getString("lockOutRealm.authLockedUser", username));
    return null;
  }
  Principal authenticatedUser = super.authenticate(username, credentials);
  
  if (authenticatedUser == null) {
    registerAuthFailure(username);
  } else {
    registerAuthSuccess(username);
  }
  return authenticatedUser;
}
origin: com.ovea.tajin.server/tajin-server-tomcat7

/**
 * Unlock the specified username. This will remove all records of
 * authentication failures for this user.
 * 
 * @param username The user to unlock
 */
public void unlock(String username) {
  // Auth success clears the lock record so... 
  registerAuthSuccess(username);
}
 
origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Return the Principal associated with the specified username and
 * credentials, if there is one; otherwise return <code>null</code>.
 *
 * @param username Username of the Principal to look up
 * @param credentials Password or other credentials to use in
 *  authenticating this username
 */
@Override
public Principal authenticate(String username, String credentials) {
  Principal authenticatedUser = super.authenticate(username, credentials);
  return filterLockedAccounts(username, authenticatedUser);
}
origin: codefollower/Tomcat-Research

/**
 * Return the Principal associated with the specified username and
 * credentials, if there is one; otherwise return <code>null</code>.
 *
 * @param username Username of the Principal to look up
 * @param credentials Password or other credentials to use in
 *  authenticating this username
 */
@Override
public Principal authenticate(String username, String credentials) {
  if (isLocked(username)) {
    // Trying to authenticate a locked user is an automatic failure
    registerAuthFailure(username);
    log.warn(sm.getString("lockOutRealm.authLockedUser", username));
    return null;
  }
  Principal authenticatedUser = super.authenticate(username, credentials);
  if (authenticatedUser == null) {
    registerAuthFailure(username);
  } else {
    registerAuthSuccess(username);
  }
  return authenticatedUser;
}
origin: org.apache.tomcat/tomcat-catalina

private Principal filterLockedAccounts(String username, Principal authenticatedUser) {
  // Register all failed authentications
  if (authenticatedUser == null && isAvailable()) {
    registerAuthFailure(username);
  }
  if (isLocked(username)) {
    // If the user is currently locked, authentication will always fail
    log.warn(sm.getString("lockOutRealm.authLockedUser", username));
    return null;
  }
  if (authenticatedUser != null) {
    registerAuthSuccess(username);
  }
  return authenticatedUser;
}
origin: codefollower/Tomcat-Research

/**
 * Unlock the specified username. This will remove all records of
 * authentication failures for this user.
 *
 * @param username The user to unlock
 */
public void unlock(String username) {
  // Auth success clears the lock record so...
  registerAuthSuccess(username);
}
origin: org.apache.tomcat/tomcat-catalina

/**
 * Return the Principal associated with the specified chain of X509
 * client certificates.  If there is none, return <code>null</code>.
 *
 * @param certs Array of client certificates, with the first one in
 *  the array being the certificate of the client itself.
 */
@Override
public Principal authenticate(X509Certificate[] certs) {
  String username = null;
  if (certs != null && certs.length >0) {
    username = certs[0].getSubjectDN().getName();
  }
  Principal authenticatedUser = super.authenticate(certs);
  return filterLockedAccounts(username, authenticatedUser);
}
origin: com.ovea.tajin.server/tajin-server-jetty9

/**
 * Return the Principal associated with the specified username and
 * credentials, if there is one; otherwise return <code>null</code>.
 *
 * @param username Username of the Principal to look up
 * @param credentials Password or other credentials to use in
 *  authenticating this username
 */
@Override
public Principal authenticate(String username, String credentials) {
  if (isLocked(username)) {
    // Trying to authenticate a locked user is an automatic failure
    registerAuthFailure(username);
    
    log.warn(sm.getString("lockOutRealm.authLockedUser", username));
    return null;
  }
  Principal authenticatedUser = super.authenticate(username, credentials);
  
  if (authenticatedUser == null) {
    registerAuthFailure(username);
  } else {
    registerAuthSuccess(username);
  }
  return authenticatedUser;
}
origin: org.apache.catalina/com.springsource.org.apache.catalina

/**
 * Unlock the specified username. This will remove all records of
 * authentication failures for this user.
 * 
 * @param username The user to unlock
 */
public void unlock(String username) {
  // Auth success clears the lock record so... 
  registerAuthSuccess(username);
}
 
origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Return the Principal associated with the specified chain of X509
 * client certificates.  If there is none, return <code>null</code>.
 *
 * @param certs Array of client certificates, with the first one in
 *  the array being the certificate of the client itself.
 */
@Override
public Principal authenticate(X509Certificate[] certs) {
  String username = null;
  if (certs != null && certs.length >0) {
    username = certs[0].getSubjectDN().getName();
  }
  Principal authenticatedUser = super.authenticate(certs);
  return filterLockedAccounts(username, authenticatedUser);
}
origin: com.ovea.tajin.servers/tajin-server-jetty9

/**
 * Return the Principal associated with the specified username and
 * credentials, if there is one; otherwise return <code>null</code>.
 *
 * @param username Username of the Principal to look up
 * @param credentials Password or other credentials to use in
 *  authenticating this username
 */
@Override
public Principal authenticate(String username, String credentials) {
  if (isLocked(username)) {
    // Trying to authenticate a locked user is an automatic failure
    registerAuthFailure(username);
    
    log.warn(sm.getString("lockOutRealm.authLockedUser", username));
    return null;
  }
  Principal authenticatedUser = super.authenticate(username, credentials);
  
  if (authenticatedUser == null) {
    registerAuthFailure(username);
  } else {
    registerAuthSuccess(username);
  }
  return authenticatedUser;
}
origin: org.apache.tomcat/tomcat-catalina

/**
 * Unlock the specified username. This will remove all records of
 * authentication failures for this user.
 *
 * @param username The user to unlock
 */
public void unlock(String username) {
  // Auth success clears the lock record so...
  registerAuthSuccess(username);
}
origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Return the Principal associated with the specified username, which
 * matches the digest calculated using the given parameters using the
 * method described in RFC 2069; otherwise return <code>null</code>.
 *
 * @param username Username of the Principal to look up
 * @param clientDigest Digest which has been submitted by the client
 * @param nonce Unique (or supposedly unique) token which has been used
 * for this request
 * @param realmName Realm name
 * @param md5a2 Second MD5 digest used to calculate the digest :
 * MD5(Method + ":" + uri)
 */
@Override
public Principal authenticate(String username, String clientDigest,
    String nonce, String nc, String cnonce, String qop,
    String realmName, String md5a2) {
  Principal authenticatedUser = super.authenticate(username, clientDigest, nonce, nc, cnonce,
      qop, realmName, md5a2);
  return filterLockedAccounts(username, authenticatedUser);
}
origin: com.ovea.tajin.server/tajin-server-tomcat7

/**
 * Return the Principal associated with the specified username and
 * credentials, if there is one; otherwise return <code>null</code>.
 *
 * @param username Username of the Principal to look up
 * @param credentials Password or other credentials to use in
 *  authenticating this username
 */
@Override
public Principal authenticate(String username, String credentials) {
  if (isLocked(username)) {
    // Trying to authenticate a locked user is an automatic failure
    registerAuthFailure(username);
    
    log.warn(sm.getString("lockOutRealm.authLockedUser", username));
    return null;
  }
  Principal authenticatedUser = super.authenticate(username, credentials);
  
  if (authenticatedUser == null) {
    registerAuthFailure(username);
  } else {
    registerAuthSuccess(username);
  }
  return authenticatedUser;
}
origin: org.apache.geronimo.ext.tomcat/catalina

/**
 * Unlock the specified username. This will remove all records of
 * authentication failures for this user.
 * 
 * @param username The user to unlock
 */
public void unlock(String username) {
  // Auth success clears the lock record so... 
  registerAuthSuccess(username);
}

origin: org.apache.tomcat/tomcat-catalina

/**
 * Return the Principal associated with the specified username, which
 * matches the digest calculated using the given parameters using the
 * method described in RFC 2069; otherwise return <code>null</code>.
 *
 * @param username Username of the Principal to look up
 * @param clientDigest Digest which has been submitted by the client
 * @param nonce Unique (or supposedly unique) token which has been used
 * for this request
 * @param realmName Realm name
 * @param md5a2 Second MD5 digest used to calculate the digest :
 * MD5(Method + ":" + uri)
 */
@Override
public Principal authenticate(String username, String clientDigest,
    String nonce, String nc, String cnonce, String qop,
    String realmName, String md5a2) {
  Principal authenticatedUser = super.authenticate(username, clientDigest, nonce, nc, cnonce,
      qop, realmName, md5a2);
  return filterLockedAccounts(username, authenticatedUser);
}
org.apache.catalina.realmLockOutRealm

Javadoc

This class extends the CombinedRealm (hence it can wrap other Realms) to provide a user lock out mechanism if there are too many failed authentication attempts in a given period of time. To ensure correct operation, there is a reasonable degree of synchronisation in this Realm. This Realm does not require modification to the underlying Realms or the associated user storage mechanisms. It achieves this by recording all failed logins, including those for users that do not exist. To prevent a DOS by deliberating making requests with invalid users (and hence causing this cache to grow) the size of the list of users that have failed authentication is limited.

Most used methods

  • isLocked
  • registerAuthFailure
  • registerAuthSuccess
  • filterLockedAccounts
  • isAvailable

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSystemService (Context)
  • setScale (BigDecimal)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now