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

NAME

Net::Jabber::Data::Auth - Jabber XDB Authentication Module

SYNOPSIS

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

DESCRIPTION

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

    use Net::Jabber;

    sub xdbCB {
      my $xdb = new Net::Jabber::XDB(@_);
      my $auth = $xdb->GetData();
      .
      .
      .
    }

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

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

    use Net::Jabber;

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

    $xdb = new Net::Jabber::XDB();
    $auth = $xdb->NewData("jabber:xdb:auth");
    ...

    $client->Send($xdb);

  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();
    $digest   = $auth->GetDigest();
    $resource = $auth->GetResource();

Creation functions

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

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

Test functions

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

METHODS

Retrieval functions

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

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

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

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

Creation functions

  SetAuth(username=>string, - set multiple fields in the <xdb/> at one
          password=>string,   time.  This is a cumulative and over
          digest=>string,     writing action.  If you set the "username" 
          resource=>string)   twice, the second setting is what is
                              used.  If you set the password, and then
                              set the resource then both will be in the
                              <data/> 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.

  SetDigest(string) - sets the SHA-1 digest 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.

Test functions

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

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

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

  DefinedResource() - returns 1 if <resource/> exists in the <xdb/>,
                      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.