Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor inband registration (and cancelation) #559

Merged
merged 57 commits into from
Dec 1, 2015

Commits on Nov 30, 2015

  1. Test that Mongoose handles a bad cancelation request correctly

    Send a registration cancelation request, where the `remove' element is
    NOT the only child of the `query' element, then wait to receive a
    failure response. See table 1, section 3.2, XEP 0077.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    2baaf8e View commit details
    Browse the repository at this point in the history
  2. Test failure response upon cancelation when no inband registration

    Presumably, if inband registration is not enabled, then cancelatio is
    not possible. Make sure Mongoose sends an error stanza. Note: does not
    test for a particular error case.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    183f6fa View commit details
    Browse the repository at this point in the history
  3. Test stanzas more comprehensively

    Test that error stanzas for user registration and cancelation contain
    the correct child elements. Move user creation and deletion into the
    test case callbacks.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    2d0e6c1 View commit details
    Browse the repository at this point in the history
  4. Improve test cases for user cancelation

    Test that Mongoose responds with the failure stanzas given XEP 0077
    upon a bad cancelation request. Changing the configuration in the
    "not-allowed" test should correspond better with the XEP: ALL users
    are denied cancelation, rather than just stopping the the module.
    
    The tests don't fail in quite the right way, so this is [WIP].
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    7af73f9 View commit details
    Browse the repository at this point in the history
  5. Finalise two tests for user cancelation errors

    Change and restore the `mod_register' configuration as needed, resolve
    test initialisation and termination issues, and change to include just
    two helpful "printf" calls (really `ct:pal/2').
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    d841fd9 View commit details
    Browse the repository at this point in the history
  6. Test that users remain in Mongoose upon bad cancelation requests

    This addition tightly couples these tests with Mongoose.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    a6e442b View commit details
    Browse the repository at this point in the history
  7. Make tests for bad cancelation requests more comprehensive

    Test for the `type' and namespace attributes in the error stanzas for
    bad cancelation requests.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    349253b View commit details
    Browse the repository at this point in the history
  8. Remove old --less comprehensive-- assertions

    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    045ee1b View commit details
    Browse the repository at this point in the history
  9. Fix match on LHS when stopping module

    Change LHS `ok' to `{atomic, ok}' when changing configuration using
    dynamic_modules:stop/2.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    e5e6bce View commit details
    Browse the repository at this point in the history
  10. Comment to clarify how Mongoose cancels a registration

    As this was not immediately clear.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    c44a43b View commit details
    Browse the repository at this point in the history
  11. Rename test group to be more correct

    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    fd993f0 View commit details
    Browse the repository at this point in the history
  12. Refactor IQ stanza handler

    Change `case' clauses for `set' and `get' IQs into procedure
    clauses. One procedure to do it all meant deeply nested clauses.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    2d438b5 View commit details
    Browse the repository at this point in the history
  13. Verify the contents of stanzas coming into the IQ handlers

    Make sure the `query' element is the only one in the IQ stanza.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    10511c5 View commit details
    Browse the repository at this point in the history
  14. Begin to refactor IQ `set's

    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    bcea2e4 View commit details
    Browse the repository at this point in the history
  15. Reorder `case' patterns and space clauses out nicely

    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    83594b7 View commit details
    Browse the repository at this point in the history
  16. Begin refactoring cancelation and data submission for XEP 0077

    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    d84a6a3 View commit details
    Browse the repository at this point in the history
  17. Indent with spaces only

    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    5731997 View commit details
    Browse the repository at this point in the history
  18. Clean up after user

    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    76060a6 View commit details
    Browse the repository at this point in the history
  19. Introduce account cancelation changes

    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    d60ae94 View commit details
    Browse the repository at this point in the history
  20. Move all IQ SET handling out of process_iq_set' into handle_set'

    This commit retains logging for debug purposes.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    b9cc7c7 View commit details
    Browse the repository at this point in the history
  21. Make it easy to tell if settings have been altered by test

    This is for debugging.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    39c6492 View commit details
    Browse the repository at this point in the history
  22. Refactor smaller parts, remove "data form" processing

    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    9d1817f View commit details
    Browse the repository at this point in the history
  23. Format `case' clauses in line with style rules

    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    8576161 View commit details
    Browse the repository at this point in the history
  24. Build error responses with a procedure

    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    fce64ad View commit details
    Browse the repository at this point in the history
  25. Rename test group

    Use a better name.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    21c8530 View commit details
    Browse the repository at this point in the history
  26. Test failure upon registration with an empty password field

    Add a test case to make sure that registration with an empty password
    fails as specified in XEP 0077.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    80767d8 View commit details
    Browse the repository at this point in the history
  27. Generalise restarting `mod_register' with a different option

    This procedure is more general in two ways: (1) change any option by
    name, and (2) insert an option instead of just changing one that's
    already there (`lists:keystore/4' combines an `append' and a
    `replace'). Then, the `restore_mod_register_options/1' procedure does
    cleanup, removing the module's option list from the test suite's
    configuration list, so that we can change the configuration again and
    again in a clean way.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    931ccb7 View commit details
    Browse the repository at this point in the history
  28. Configure Mongoose with a non-zero password strength for registration

    A registration request with an empty password field will trigger the
    correct error response when the password strength is non-zero.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    21e897d View commit details
    Browse the repository at this point in the history
  29. Make sure user really doesn't exist

    Mongoose may well send the correct error response, but let's make sure
    it doesn't do the wrong thing, too.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    008755e View commit details
    Browse the repository at this point in the history
  30. Build response stanza without building empty JID

    Don't build completely blank JIDs, as they need a "host" part at the
    very least, just to remove them before sending the response.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    26722be View commit details
    Browse the repository at this point in the history
  31. Register only if access rules allow it

    Check that registration (and cancelation) are allowed before
    proceeding, otherwise send an error response.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    b8ea4fc View commit details
    Browse the repository at this point in the history
  32. Bring arguments and variables into scope for `attpemt_cancelation'

    Move necessary agruments out of the "extras".
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    1a2d6d1 View commit details
    Browse the repository at this point in the history
  33. Improve scoping for `register_or_change_password'

    Move necessary agruments out of the "extras".
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    0f6222b View commit details
    Browse the repository at this point in the history
  34. Improve scoping for `handle_set'

    Move necessary agruments out of the "extras".
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    6569a46 View commit details
    Browse the repository at this point in the history
  35. Change parameter names to established convention

    That is: `Sender'/`Receiver' ---> `From'/`To', and `Stanza' ---> `IQ'.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    fbc654f View commit details
    Browse the repository at this point in the history
  36. Correct predicate for presence of username and password children

    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    d37b31c View commit details
    Browse the repository at this point in the history
  37. Ensure "remove" elements are not present

    Also rename the procedure that helps to switch on the children of the
    "query" element and use more informative names for the atoms which are
    returned.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    4d07e64 View commit details
    Browse the repository at this point in the history
  38. Handle bad requests in a consistent way

    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    49ea9c4 View commit details
    Browse the repository at this point in the history
  39. Remove debugging aids

    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    cc0ddeb View commit details
    Browse the repository at this point in the history
  40. Remove debugging aid from inside module

    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    c7575f0 View commit details
    Browse the repository at this point in the history
  41. Test Mongoose resoponds with a `registered' element when appropriate

    When someone has authenticated, i.e. they are already registered,
    Mongoose should respond with a `registered' IQ query element.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    3b0a325 View commit details
    Browse the repository at this point in the history
  42. Modify test `null_password' to use one of the templated accounts

    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    676edf8 View commit details
    Browse the repository at this point in the history
  43. Test inband password change for accounts

    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    cbfa2ed View commit details
    Browse the repository at this point in the history
  44. Match username & server on well-formatted JID when changing password

    Matches will succeed when changing password: we were comparing the
    sender of a stanza to a JID that hadn't been formatted according to
    XMPP guidelines.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    bd3b2ca View commit details
    Browse the repository at this point in the history
  45. Test that passwords can not be made empty inband

    NOTE: This test fails until a fix to Mongoose is made.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    b648695 View commit details
    Browse the repository at this point in the history
  46. Test for `bad-request' error response on changing to an empty password

    Since the password change is an IQ request, even though XEP 0077 does
    not describe this, we test for an error response.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    3e26461 View commit details
    Browse the repository at this point in the history
  47. Fix authentication so that it does not set an empty password

    The procedure in question had an empty string (i.e. "") as a pattern
    in its head, but it's meant to be a binary (i.e. <<"">>), so add this
    clause.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    686f269 View commit details
    Browse the repository at this point in the history
  48. Remove scaffolding for testing registration with null password

    The calls made inside `*_per_testcase(null_password, _)' simply
    shouldn't be necessary to test for an error response when a client
    tries to register with an null password.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    d9979c1 View commit details
    Browse the repository at this point in the history
  49. Handle registration attempts with a null password correctly

    We were matching only on an empty string when we really need to match
    on an empty binary.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    42b6713 View commit details
    Browse the repository at this point in the history
  50. Assert error response type upon quick successive registration requests

    Test for a <resource-constraint/> error-response after making inband
    registration requests in quick succession NOT just that we receive an
    error-response. The second paragraph of section 3.1.1 of XEP 0077 may
    suggest using a <not-acceptable/>, see comment in test for more
    detail.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    9428712 View commit details
    Browse the repository at this point in the history
  51. Test the constraining of resources upon failed inband registration

    Mongoose should restrict the number of registrations, regardles of a
    client's recent success or failure, within a time period.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    42163ed View commit details
    Browse the repository at this point in the history
  52. Move timers from scaffolding into test cases

    This makes it more clear that the timers are prerequisites for both
    tests.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    8edebc0 View commit details
    Browse the repository at this point in the history
  53. Assert for the correct kind of failure responses

    An "error" stanza will in fact produce a "failed_to_register", not a
    "bad_response".
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    8cfafa0 View commit details
    Browse the repository at this point in the history
  54. Refactor how changes to Mongoose's configuration is done

    This concerns changes to the `{access, register, global}' variable,
    used for inband registration.
    Joseph Yiasemides committed Nov 30, 2015
    Configuration menu
    Copy the full SHA
    eb7b38e View commit details
    Browse the repository at this point in the history

Commits on Dec 1, 2015

  1. Prioritise resource constraint upon registration requests

    Assert timeouts have expired before much of the registration process
    begins: this'll make sure that registration requests are constrained
    within a given time period, regardless of a client's recent
    registration success or failure. It discriminates clients using their
    IP address.
    Joseph Yiasemides committed Dec 1, 2015
    Configuration menu
    Copy the full SHA
    b015000 View commit details
    Browse the repository at this point in the history
  2. Remove redundant clauses for empty password

    We use the Erlang binary internally.
    Joseph Yiasemides committed Dec 1, 2015
    Configuration menu
    Copy the full SHA
    fd6226f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d754769 View commit details
    Browse the repository at this point in the history