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

NAME

WebService::AngelXML::Auth - Generates XML Authentication Document for Angel Web service

SYNOPSIS

  use WebService::AngelXML::Auth;
  my $ws = WebService::AngelXML::Auth->new();
  $ws->allow(1) if "test";
  print $ws->header, $ws->response;

DESCRIPTION

WebService::AngelXML::Auth is a Perl object oriented interface that allows for the creation of the XML response required for AngleXML Authentication.

USAGE

  use WebService::AngelXML::Auth;
  my $ws=WebService::AngelXML::Auth->new();
  if ("Some test here") {
    $ws->allow(1);
  } else {
    $ws->deny(1); #default
  }
  print $ws->header, $ws->response;

CONSTRUCTOR

new

  my $ws=WebService::AngelXML::Auth->new(
           cgi      => $query,     #pass this if already constructed else will construct
           allow    => 0,          #allow and deny are both stored in $ws->{'deny'};
           deny     => 1,          #default is deny=1 only set deny=0 if you are permissive
           mimetype => "text/xml", #default is application/vnd.angle-xml.xml+xml
           page     => "/1000",    #default next page is "/1000"
                             );

METHODS

allow

Set or returns the current allow state. Allow and deny methods are inversly related.

You may set the allow and deny methods with any value that Perl evaluates to true or false. However, they will always return "-1" for true and "0" for false.

  if ($ws->allow) { "Do something!" }
  print $ws->allow;  #will always return "-1" for true and "0" for false
  $ws->allow(0);     #will set the allow to "0" and the deny to "-1"
  $ws->allow(1);     #will set the allow to "-1" and the deny to "0"

deny

Set or returns the current deny state. Allow and deny methods are inversly related.

You may set the allow and deny methods with any value that Perl evaluates to true or false. However, they will always return -1 for true and 0 for false.

  if ($ws->deny) { "Do something!" }
  print $ws->deny;  #will always return -1 for true and 0 for false
  $ws->deny(0);     #will set the deny to "0" and the allow to "-1"
  $ws->deny(1);     #will set the deny to "-1" and the allow to "0"

response

Returns an XML document with an XML declaration and a root name of "ANGELXML"

  print $ws->response;

Example (Deny):

  <ANGELXML>
    <MESSAGE>
      <PLAY>
        <PROMPT type="text">.</PROMPT>
      </PLAY>
      <GOTO destination="/1000" />
    </MESSAGE>
    <VARIABLES>
      <VAR name="status_code" value="-1" />
    </VARIABLES>
  </ANGELXML>
  print $document->header;  

Example:

  Content-Type: application/vnd.angle-xml.xml+xml

mimetype

Sets or returns mime type the default is application/vnd.angle-xml.xml+xml

  $ws->mimetype('text/xml'); #This works better when testing with MSIE
  my $mt=$ws->mimetype;

cgi

Sets or returns the cgi object which must be CGI from cpan. Default is to construct a new CGI object. If you already have a CGI object, you MUST pass it on construction.

  $cgi=CGI->new("id=9999;pin=0000;page=/1000");
  $ws=WebService::AngelXML::Auth->new(cgi=>$cgi);

DO NOT do this as we would have already created two CGI objects.

  $cgi=CGI->new("id=9999;pin=0000;page=/1000"); #a new CGI object is created
  $ws=WebService::AngelXML::Auth->new(); #a new CGI object is created on initialization
  $ws->cgi($cgi); #this CGI object may not be iniatialized correctly

CGI object is fully functional

  print $ws->cgi->p("Hello World!");  #All CGI methods are available

id

Returns the user id which is passed from the CGI parameter. The default CGI parameter is "id" but can be overriden by the param_id method.

  print $ws->id;
  $ws->id("0000");  #if you want to set it for testing.

param_id

The value of the CGI parameter holding the value of the user id.

  $ws->param_id("id");  #default

pin

Returns the user pin which is passed from the CGI parameter. The default CGI parameter is "pin" but can be overriden by the param_pin method.

  print $ws->pin;
  $ws->pin("0000");  #if you want to set it for testing.

param_pin

The value of the CGI parameter holding the value of the user pin.

  $ws->param_pin("pin"); #default

page

Returns the authentication next page which can be passed from the POST parameter. See param_page method.

Three ways to set next page.

  $ws=WebService::AngelXML::Auth->new(page=>"/1000");      #during construction
  $ws->page("/1000");                                      #after constructing
  script.cgi?page=/1000                                    #as cgi parameter

param_page

The value of the CGI parameter holding the value of the next page.

  $ws->param_page("page"); #default

prompt

Sets or returns the prompt text.

  print $ws->prompt;
  $ws->prompt("."); #default

BUGS

SUPPORT

Try Angel first then the author of this package who is not an Angel employee

AUTHOR

    Michael R. Davis (mrdvt92)
    CPAN ID: MRDVT

COPYRIGHT

Copyright 2008 - STOP, LLC Copyright 2008 - Michael R. Davis (mrdvt92)

This program is free software licensed under the...

        The BSD License

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO

XML::Writer is used by this package to generate XML.

CGI is used by this package to handle HTTP POST/GET parameters.