The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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();
$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');

METHODS

Retrieval functions

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

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

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

GetResource() - returns a string with the resource 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
        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
                            <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.

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.

AUTHOR

By Ryan Eatmon in May 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.