Module exmpp_client_legacy_auth

The module exmpp_client_legacy_auth implements the initiating entity side of legacy authentication found in Jabber, before XMPP 1.0.

Authors: Jean-Sébastien Pédron (js.pedron@meetic-corp.com).

References

Description

The module exmpp_client_legacy_auth implements the initiating entity side of legacy authentication found in Jabber, before XMPP 1.0.

A common use case is presented in table 1.

Table 1: successful legacy authentication
Client-side Server-side

Once a stream is opened, the client call exmpp_client_legacy_auth:

Request = exmpp_client_legacy_auth:request("jabber.example.com").

After serialization, this produces this XML message:

<iq type="get" to="jabber.example.com" id="auth-1905181425">
    <query xmlns="jabber:iq:auth"/>
</iq>

The server answer with the available fields:

Fields = exmpp_server_legacy_auth:fields(Request).

After serialization, this produces this XML message:

<iq xmlns="jabber:client" type="result" id="auth-1905181425">
        <query xmlns="jabber:iq:auth">
                <username/>
                <password/>
                <digest/>
                <resource/>
        </query>
</iq>

The client can send its credentials:

Password = exmpp_client_legacy_auth:password(
    Fields,
    "johndoe",
    "foobar!",
    "home"
).

The best method is chosen automatically (here, <digest/>).

After serialization, this produces this XML message:

<q xmlns="jabber:client" type="set" id="auth-3105434037">
        <query xmlns="jabber:iq:auth">
                <username>johndoe</username>
                <digest>
                        93fdad2a795c59c73a6acf68a4dbdd3ddb366239
                </digest>
                <resource>home</resource>
        </query>
</iq>

If the password is correct, the server notify the client:

Success = exmpp_server_legacy_auth:success(Password).

After serialization, this produces this XML message:

<iq xmlns="jabber:client" type="result" id="auth-3105434037"/>

Function Index

digest/2Produce a password digest for legacy auth, according to XEP-0078.
get_fields/1Return the list of fields supported by the server.
get_prefered_auth/1Return the prefered authentication method.
hex/1Encode list to a hexadecimal string.
is_success/1Tell if the authentication succeeded.
password/4Make an <iq/> to send authentication informations.
password/5Make an <iq/> to send authentication informations.
password_digest/3Make an <iq> to send authentication informations.
password_digest/4Make an <iq> to send authentication informations.
password_plain/3Make an <iq> to send authentication informations.
password_plain/4Make an <iq> to send authentication informations.
request/1Make an <iq> for requesting legacy authentication.
request/2Make an <iq> for requesting legacy authentication.
request_with_user/2Make an <iq> for requesting legacy authentication.
request_with_user/3Make an <iq> for requesting legacy authentication.

Function Details

digest/2

digest(ID, Passwd) -> Digest

Produce a password digest for legacy auth, according to XEP-0078.

get_fields/1

get_fields(Fields_IQ) -> Fields

throws {legacy_auth, get_fields, invalid_iq, Fields_IQ} | {legacy_auth, get_fields, invalid_field, Field}

Return the list of fields supported by the server.

get_prefered_auth/1

get_prefered_auth(IQ::Fields_IQ) -> Auth

Return the prefered authentication method.

hex/1

hex(Plain) -> Hex

Encode list to a hexadecimal string.

is_success/1

is_success(IQ) -> bool()

Tell if the authentication succeeded.

password/4

password(Fields_IQ, Username, Password, Resource) -> Password_IQ

Make an <iq/> to send authentication informations.

The stanza ID is generated automatically.

password/5

password(Fields_IQ, Username, Password, Resource, ID) -> Password_IQ

Make an <iq/> to send authentication informations.

password_digest/3

password_digest(Username, Password, Resource) -> Password_IQ

Make an <iq> to send authentication informations.

The stanza ID is generated automatically.

password_digest/4

password_digest(Username, Password, Resource, ID) -> Password_IQ

Make an <iq> to send authentication informations.

Password is encoded as specified in XEP-0078.

password_plain/3

password_plain(Username, Password, Resource) -> Password_IQ

Make an <iq> to send authentication informations.

The stanza ID is generated automatically.

password_plain/4

password_plain(Username, Password, Resource, ID) -> Password_IQ

Make an <iq> to send authentication informations.

Password is in clear plain text in the stanza.

For an anonymous authentication, Password may be the empty string.

request/1

request(To) -> Request_IQ

Make an <iq> for requesting legacy authentication.

The stanza ID is generated automatically.

request/2

request(To, ID) -> Request_IQ

Make an <iq> for requesting legacy authentication.

request_with_user/2

request_with_user(To, Username) -> Request_IQ

Make an <iq> for requesting legacy authentication.

The stanza ID is generated automatically.

request_with_user/3

request_with_user(To, Username, ID) -> Request_IQ

Make an <iq> for requesting legacy authentication.


Generated by EDoc, Jan 21 2011, 01:43:54.