Provide an HTTP anthentification over XMPP (XEP-0070).
Go to file
Chteufleur 4a4bcb418b Add in README where to find a config file example 2016-07-18 18:22:08 +02:00
http Add HTTPS support 2016-07-14 10:53:28 +02:00
xmpp Auto generation for transaction ID if not provided in HTTP request 2016-07-16 09:44:54 +02:00
.gitignore initial commit 2016-05-18 10:16:14 +02:00
LICENSE Modification License file 2016-06-20 22:12:35 +02:00
README.md Add in README where to find a config file example 2016-07-18 18:22:08 +02:00
cert.pem Add HTTPS support 2016-07-14 10:53:28 +02:00
httpAuth.cfg Add HTTPS support 2016-07-14 10:53:28 +02:00
key.pem Add HTTPS support 2016-07-14 10:53:28 +02:00
main.go Auto generation for transaction ID if not provided in HTTP request 2016-07-16 09:44:54 +02:00

README.md

HTTPAuthentificationOverXMPP

Provide an HTTP anthentification over XMPP. Implementation of XEP-0070.

Compilation

Dependencies

  • go-xmpp for the XMPP part.
  • cfg for the configuration file.

You must first install go environment on your system. Then, go into your $GOPATH directory and go get the source code.

go get git.kingpenguin.tk/chteufleur/HTTPAuthentificationOverXMPP.git

Configure

Configure the gateway by editing the httpAuth.cfg file in order to give all XMPP component and HTTP server informations. An example of the config file can be found in the repos.

XMPP

  • xmpp_server_address : Component server address connection (default: 127.0.0.1)
  • xmpp_server_port : Component server port connection (default: 5347)
  • xmpp_hostname : Component hostname
  • xmpp_secret : Component password
  • xmpp_debug : Enable debug log at true (default: false)

HTTP

  • http_port : HTTP port to bind (default: 9090, desactive: -1)
  • https_port : HTTPS port to bind (default: 9093, desactive: -1)
  • https_cert_path : Path to the certificate file (default: ./cert.pem)
  • https_key_path : Path to the key file (default: ./key.pem)
  • http_timeoute_sec : Define a timeout if user did not give an answer to the request (default: 60)

Utilization

To ask authorization, just send an HTTP request to the path /auth with parameters:

  • jid : JID of the user (user@host/resource or user@host)
  • domain : Domain you want to access
  • method : Method you access the domain
  • transaction_id : Transaction identifier (auto generated if not provide)
  • timeout : Timeout of the request in second (default : 60, max : 300)

Example:

GET /auth?jid=user%40host%2fresource&domain=example.org&method=POST&transaction_id=WhatEverYouWant&timeout=120 HTTP/1.1

This will send a request to the given JID. If the user accept, the server will return HTTP code 200, otherwise it will return HTTP code 401.

A demo version can be found at auth.xmpp.kingpenguin.tk for test purpose only.

Help

To get any help, please visit the XMPP conference room at httpauth@muc.kingpenguin.tk with your prefered client, or with your browser.