The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::Jabber::Query::Auth - Jabber IQ Authentication Module

SYNOPSIS

  Net::Jabber::Query::Auth is a companion to the Net::Jabber::Query module.
  It provides the user a simple interface to set and retrieve all parts
  of a Jabber Authentication query.

DESCRIPTION

  To initialize the Query with a Jabber <iq/> and then access the auth
  query you must pass it the XML::Parser Tree array from the 
  Net::Jabber::Client module.  In the callback function for the iq:

    use Net::Jabber;

    sub iqCB {
      my $iq = new Net::Jabber::IQ(@_);
      my $auth = $iq->GetQuery();
      .
      .
      .
    }

  You now have access to all of the retrieval functions available.

  To create a new Query auth to send to the server:

    use Net::Jabber;

    $client = new Net::Jabber::Client();
    ...

    $iq = new Net::Jabber::IQ();
    $auth = $iq->NewQuery("jabber:iq:auth");
    ...

    $client->Send($iq);

  Using $auth you can call the creation functions below to populate the 
  tag before sending it.

  For more information about the array format being passed to the CallBack
  please read the Net::Jabber::Client documentation.

Retrieval functions

    $username = $auth->GetUsername();
    $password = $auth->GetPassword();
    $resource = $auth->GetResource();
    $digest   = $auth->GetDigest();
    $hash     = $auth->GetHash();
    $token    = $auth->GetToken();
    $sequence = $auth->GetSequence();

Creation functions

    $auth->SetAuth(resource=>'Anonymous');
    $auth->SetAuth(username=>'test',
                   password=>'user',
                   resource=>'Test Account');

    $auth->SetUsername('bob');
    $auth->SetPassword('bobrulez');
    $auth->SetResource('Bob the Great');
    $auth->SetDigest('');

    $auth->SetToken('some token');
    $auth->SetSequence(456);

    $auth->SetHash('some hash');

Test functions

    $test = $auth->DefinedUsername();
    $test = $auth->DefinedPassword();
    $test = $auth->DefinedResource();
    $test = $auth->DefinedDigest();
    $test = $auth->DefinedHash();
    $test = $auth->DefinedToken();
    $test = $auth->DefinedSequence();

METHODS

Retrieval functions

  GetUsername() - returns a string with the username in the <query/>.

  GetPassword() - returns a string with the password in the <query/>.

  GetResource() - returns a string with the resource in the <query/>.

  GetDigest() - returns a string with the SHA-1 digest in the <query/>.

  GetHash() - returns a string with the hash in the <query/>.

  GetToken() - returns a string with the token in the <query/>.

  GetSequence() - returns a string with the sequence number in the <query/>.

Creation functions

  SetAuth(username=>string, - set multiple fields in the <iq/> at one
          password=>string,   time.  This is a cumulative and over
          resource=>string,   writing action.  If you set the "username" 
          digest=>string,     twice, the second setting is what is
          hash=>string,       used.  If you set the password, and then
          token=>string,      set the resource then both will be in the
          sequence=>string)   <query/> tag.  For valid settings read 
                              the specific Set functions below.

  SetUsername(string) - sets the username for the account you are
                        trying to connect with.  Leave blank for
                        an anonymous account.

  SetPassword(string) - sets the password for the account you are
                        trying to connect with.  Leave blank for
                        an anonymous account.

  SetResource(string) - sets the resource for the account you are
                        trying to connect with.  Leave blank for
                        an anonymous account.

  SetDigest(string) - sets the SHA-1 digest for the account you are
                      trying to connect with.  Leave blank for
                      an anonymous account.

  SetHash(string) - sets the SHA-1 digest for the account you are
                    trying to connect to using 0k.

  SetToken(string) - sets the value for the token that is to be used
                     for 0k connections.

  SetSequence(string) - sets the sequence number the other side is
                        supposed to use to connect with 0k.

Test functions

  DefinedUsername() - returns 1 if <username/> exists in the <iq/>,
                      0 otherwise.

  DefinedPassword() - returns 1 if <password/> exists in the <iq/>,
                      0 otherwise.

  DefinedResource() - returns 1 if <resource/> exists in the <iq/>,
                      0 otherwise.

  DefinedDigest() - returns 1 if <digest/> exists in the <iq/>,
                    0 otherwise.

  DefinedHash() - returns 1 if <hash/> exists in the <iq/>,
                  0 otherwise.

  DefinedToken() - returns 1 if <token/> exists in the <iq/>,
                   0 otherwise.

  DefinedSequence() - returns 1 if <sequence/> exists in the <iq/>,
                      0 otherwise.

AUTHOR

By Ryan Eatmon in July of 2000 for http://jabber.org..

COPYRIGHT

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.