Class Policy


  • public class Policy
    extends java.lang.Object
    Provides an interface for security policies and implements the default policy.
    Version:
    $Id$
    Author:
    Christian Schlichtherle
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Policy()
      Only subclasses can instantiate this class.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void checkPwd​(java.lang.String pwd)
      Checks the given password for compliance to the current password policy.
      static Policy getCurrent()
      Returns the current policy.
      static void setCurrent​(Policy current)
      Sets the current policy.
      • Methods inherited from class java.lang.Object

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

      • Policy

        protected Policy()
        Only subclasses can instantiate this class.
    • Method Detail

      • setCurrent

        public static void setCurrent​(Policy current)
        Sets the current policy.
        Parameters:
        current - The new current policy. May be null to cause the default policy implemented by this class to be installed and returned by getCurrent().
      • getCurrent

        public static Policy getCurrent()
        Returns the current policy. If no current policy has been set, the default policy implemented by this class is installed as the current policy and returned.
      • checkPwd

        public void checkPwd​(java.lang.String pwd)
        Checks the given password for compliance to the current password policy.

        The default policy implemented by this class ensures that the password is at least six characters long and consists of letters and digits.

        Throws:
        IllegalPasswordException - If the given password does not comply to the current policy.