Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Authentication and Authorization for SOAP

by talexb (Chancellor)
on Jul 14, 2006 at 16:21 UTC ( #561254=perlquestion: print w/replies, xml ) Need Help??

talexb has asked for the wisdom of the Perl Monks concerning the following question:

I'm interested in building some web services that can be used both by external web browsers, but also by internal SOAP clients. The architecture I see is a web server talking to an independent database/file system entity, with local developers able to also write scripts that will interact with the entity. Essentially the function is an advanced ftp site.

With regard to security, I'm wondering how SOAP takes care of authentication and authorization. I read the local articles SOAP::Transport::TCP connection problems, troubles writing mod_soap clients and SOAP::Lite, then went further afield and found this article about authentication under SOAP UDDI. Google also found this article on SOAP extensions which looks promising if only it weren't almost five years old. This code sample also looked useful, even if it is in Java.

I like the idea of using SOAP -- does anyone here have other technology suggestions?

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

  • Comment on Authentication and Authorization for SOAP

Replies are listed 'Best First'.
Re: Authentication and Authorization for SOAP
by Ieronim (Friar) on Jul 14, 2006 at 17:17 UTC
    You can pass the username and password as parameters in your request, like
    my $result = SOAP::Lite -> uri('') -> proxy('') -> fetchdata($name, $pass, @request) -> result;
    And define the fetchdata method at server-side as smth like this (i didn't add SOAP-specific code, but it can be taken directly from SOAP::Lite docs):
    package Protected; sub fetchdata { my $pkg = shift; my $name = shift; my $pass = shift; #check the $name and $pass and process @request # or send an response indicating authentication error }

    I have no experience in Java, but as i can see, the code sample you showed seems to do the same thing, but sends only name and password.

      A common practice is to pass authentication information in the SOAP headers. With SOAP::Lite, you can do this by creating SOAP::Header objects (just like SOAP::Data, but they'll be placed in the header):
      my $headers = SOAP::Header ->name( 'LoginCredentials' ) ->value( [ SOAP::Header ->name('Username') ->value( $username ) , SOAP::Header ->name('Password') ->value( $password ) , ] ) ) ;
      The login credentials can then be passed along with any other arguments into whatever SOAP method is being called, and dealt with seperately.
Re: Authentication and Authorization for SOAP
by gellyfish (Monsignor) on Jul 14, 2006 at 21:00 UTC

    WS-Security provides a framework for security management in the Web Services environment. As yet there is no Perl implementation (as far as I can determine, but would love to be proved wrong.) OASIS have a number of other documents and specifications on security.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://561254]
Approved by socketdave
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2022-06-25 11:05 GMT
Find Nodes?
    Voting Booth?
    My most frequent journeys are powered by:

    Results (81 votes). Check out past polls.