NAME

WebService::Cmis::Agent::TokenAuth - token-based authentication handler

DESCRIPTION

This user agent adds tocken-based authentication for subsequent calls to the CMIS backend while the first one is still performed using HTTP basic auth. Alfresco is one server that implements token-based authentication.

my $client = WebService::Cmis::getClient(
  url => "http://cmis.alfresco.com/service/cmis",
  useragent => new WebService::Cmis::Agent::TokenAuth(
    loginUrl => "http://cmis.alfresco.com/service/api/login?u={username}&pw={password}",
    logoutUrl => "http://cmis.alfresco.com/service/api/login/ticket/{ticket}"
  )
);

$client->login(
  user => "user",
  password => "password",
);

my $repo = $client->getRepository;

Parent class: WebService::Cmis::Agent

METHODS

new(%params)

Create a new WebService::Cmis::Agent::TokenAuth. It remembers the session state using a token that is used instead of the normal user credentials to authenticate.

Parameters:

  • user

  • password

  • loginUrl - url used for ticket-based authentication; example:

    "http://cmis.alfresco.com/service/api/login?u={username}&pw={password}"
  • logoutUrl - url used for ticket-based authentication; example:

    "http://cmis.alfresco.com/service/api/login/ticket/{ticket}"

See LWP::UserAgent for more options.

login(%params) -> $ticket

logs in to the web service

Parameters:

  • user

  • password

  • ticket

Login using basic auth. A ticket will be aquired to be used for later logins for the same user.

my $ticket = $client->login({
  user => "user", 
  password => "pasword"
});

$client->login({
  user => "user", 
  ticket => "ticket"
});
logout()

logs out of the web service deleting a ticket previously aquired

get_basic_credentials()

overrides the method in LWP::UserAgent to implement the given authentication mechanism.

COPYRIGHT AND LICENSE

Copyright 2012-2013 Michael Daum

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/artistic.html.