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

MUC http auth #894

Merged
merged 14 commits into from
Aug 18, 2016
Merged

MUC http auth #894

merged 14 commits into from
Aug 18, 2016

Commits on Aug 3, 2016

  1. Add mod_http_client: a manager of pools of outgoing HTTP connections

    Notes:
    - the module has to be started before any modules using the connections
    - ‘ejabberd_auth_http’ and ‘mod_http_notification’ modules will use
      this module in the future.
    
    To enable the module, add the corresponding config to ejabberd.cfg, eg.
    
    {mod_http_client, [{pools, [{pool1, [{host, “http://host.com”},
    	                        {pool_size, 100}]
                       }]
    }
    
    This should be added before any module using the pool.
    chrzaszcz committed Aug 3, 2016
    Configuration menu
    Copy the full SHA
    7682939 View commit details
    Browse the repository at this point in the history
  2. Support password-protected MUC rooms using external HTTP auth service.

    To enable, set the following options in ejabberd.cfg
    
    1. Enable ‘mod_http_client’, specifying a connection pool:
    
    {mod_http_client, [{pools, [{muc_http_auth, [{host, "http://localhost:8080"},
                                                 {path_prefix, "/muc/auth/"},
                                                 {pool_size, 20}]}
    
    The above config has to occur before the MUC config to provide the pool
    when the MUC module starts.
    For details, see the ‘mod_http_client’ module.
    
    2. Use the pool in MUC config:
    
    {mod_muc, [{host, "muc.@host@"},
               {access, muc},
               {access_create, muc_create},
               {http_auth_pool, muc_http_auth}]}
    
    As a result, all rooms will:
    - become password-protected by default
    - call the external HTTP service instead of checking the configured
      password, whenever a new user enters the room
    
    The external HTTP service has to respond with:
    - code 200 and body ‘true’ when the password is accepted;
    - code 200 and other body when the password is rejected - the body will
      be sent back to the entity in the XMPP error response in the <text>
      element
    - other code when an error occurs, this will result in a
    ‘service-unavailable’ XMPP error
    chrzaszcz committed Aug 3, 2016
    Configuration menu
    Copy the full SHA
    d086540 View commit details
    Browse the repository at this point in the history
  3. Expect JSON in response for MUC authentication

    Also make overflow configurable and add tests for mod_http_client
    chrzaszcz committed Aug 3, 2016
    Configuration menu
    Copy the full SHA
    6605007 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8422d8a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    f938ddb View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    487de0f View commit details
    Browse the repository at this point in the history
  7. Use Cowboy instead of a homespun HTTP server

    Motivation:
    * Tests using the same server configuration can be run in parallel,
    * Adding basic features like parsing GET/POST requests
        was like reinventing the wheel.
    chrzaszcz committed Aug 3, 2016
    Configuration menu
    Copy the full SHA
    88b0cca View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    8d409da View commit details
    Browse the repository at this point in the history
  9. Update http_client tests

    chrzaszcz committed Aug 3, 2016
    Configuration menu
    Copy the full SHA
    934ed82 View commit details
    Browse the repository at this point in the history

Commits on Aug 4, 2016

  1. Spawn a new process for http auth only if room is non-empty.

    This prevents race condition when another user would step in
      while the owner is still authenticating.
    chrzaszcz committed Aug 4, 2016
    Configuration menu
    Copy the full SHA
    e41b3ab View commit details
    Browse the repository at this point in the history

Commits on Aug 5, 2016

  1. Make http_client an integral part of MongooseIM (not a pluggable mod.)

    Motivation:
    * In case of multiple hosts one pool per host is not efficient
    * The module would need to be started first, complicating module deps
    * Riak connectivity layer was not a module
    * ejabberd.cfg is easier to understand without the extra module
    chrzaszcz committed Aug 5, 2016
    Configuration menu
    Copy the full SHA
    448fed1 View commit details
    Browse the repository at this point in the history

Commits on Aug 8, 2016

  1. Configuration menu
    Copy the full SHA
    441c06d View commit details
    Browse the repository at this point in the history
  2. Add http helper to big tests

    (copy from small tests, maybe improve it later)
    chrzaszcz committed Aug 8, 2016
    Configuration menu
    Copy the full SHA
    6110a5d View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2016

  1. Configuration menu
    Copy the full SHA
    bfc0e0b View commit details
    Browse the repository at this point in the history