Class TheBrig

java.lang.Object
com.renomad.minum.security.TheBrig
All Implemented Interfaces:
ITheBrig

public final class TheBrig extends Object implements ITheBrig
  • Constructor Summary

    Constructors
    Constructor
    Description
    TheBrig(int sleepTime, Context context)
     
    TheBrig(Context context)
    In this class we create a thread that runs throughout the lifetime of the application, in an infinite loop removing keys from the list under consideration.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the current list of ip addresses that have been judged as having carried out attacks on the system.
     
    boolean
    isInJail(String clientIdentifier)
    Return true if a particular client ip address is found in the list.
    boolean
    sendToJail(String clientIdentifier, long sentenceDuration)
    Put a client in jail for some infraction, for a specified time.
    void
    Kills the infinite loop running inside this class.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TheBrig

      public TheBrig(int sleepTime, Context context)
    • TheBrig

      public TheBrig(Context context)
      In this class we create a thread that runs throughout the lifetime of the application, in an infinite loop removing keys from the list under consideration.
  • Method Details

    • initialize

      public ITheBrig initialize()
      Specified by:
      initialize in interface ITheBrig
    • stop

      public void stop()
      Description copied from interface: ITheBrig
      Kills the infinite loop running inside this class.
      Specified by:
      stop in interface ITheBrig
    • sendToJail

      public boolean sendToJail(String clientIdentifier, long sentenceDuration)
      Description copied from interface: ITheBrig
      Put a client in jail for some infraction, for a specified time.
      Specified by:
      sendToJail in interface ITheBrig
      Parameters:
      clientIdentifier - the client's address plus some feature identifier, like 1.2.3.4_too_freq_downloads
      sentenceDuration - length of stay, in milliseconds
      Returns:
      whether we put this client in jail
    • isInJail

      public boolean isInJail(String clientIdentifier)
      Description copied from interface: ITheBrig
      Return true if a particular client ip address is found in the list.
      Specified by:
      isInJail in interface ITheBrig
    • getInmates

      public List<Inmate> getInmates()
      Description copied from interface: ITheBrig
      Get the current list of ip addresses that have been judged as having carried out attacks on the system.
      Specified by:
      getInmates in interface ITheBrig