Jetty
  1. Jetty
  2. JETTY-402

Keep HashUserRealm in sync with input file

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 6.1.5
    • Fix Version/s: None
    • Component/s: Security and SSL
    • Labels:
      None
    • Patch Submitted:
      Yes
    • Number of attachments :
      1

      Description

      HashUserRealm instance does not update data in case the initial input file changes. Unfortunatly the server has to be restartet to register new passwords, realms etc. A "file-change-listener" would help to reload and update HashUserRealm data.

      I have attached a patch file of a quick solution which works for me.

      1. HashUserRealm.patch
        5 kB
        Thanassis Papathanasiou

        Activity

        Hide
        Greg Wilkins added a comment -

        perhaps use the scanner?

        Show
        Greg Wilkins added a comment - perhaps use the scanner?
        Hide
        Jan Bartel added a comment -

        I've modified the HashUserRealm to use the general purpose file Scanner. If you set a refreshInterval (value in seconds) on the HashUserRealm, it will check periodically to see if the file has changed, and if so, reload the realm.

        Thanks for the patch, but as we already had the Scanner we thought we'd get our code-reuse money's worth and reuse it.

        cheers
        Jan

        Show
        Jan Bartel added a comment - I've modified the HashUserRealm to use the general purpose file Scanner. If you set a refreshInterval (value in seconds) on the HashUserRealm, it will check periodically to see if the file has changed, and if so, reload the realm. Thanks for the patch, but as we already had the Scanner we thought we'd get our code-reuse money's worth and reuse it. cheers Jan
        Hide
        Thanassis Papathanasiou added a comment -

        Jan,

        thank you for implementing/supporting this feature. There is still a small issue with your solution:

        The refreshInterval parameter has to be set first (before config parameter), otherwise following exception is thrown:

        java.lang.IllegalStateException: Task already scheduled or cancelled

        This is due to a bug in Scanner.setScanInterval(), where the task is canceled and afterwards reused.

        Thank you very much,
        Thanassis

        Show
        Thanassis Papathanasiou added a comment - Jan, thank you for implementing/supporting this feature. There is still a small issue with your solution: The refreshInterval parameter has to be set first (before config parameter), otherwise following exception is thrown: java.lang.IllegalStateException: Task already scheduled or cancelled This is due to a bug in Scanner.setScanInterval(), where the task is canceled and afterwards reused. Thank you very much, Thanassis
        Hide
        Jan Bartel added a comment -

        Fix checked in to svn head see rev 2058.

        Show
        Jan Bartel added a comment - Fix checked in to svn head see rev 2058.

          People

          • Assignee:
            Jan Bartel
            Reporter:
            Thanassis Papathanasiou
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: