>
> Sorry, the message was cutted for some reason...
>
> I want to protect some parts of my website-project with HTTP Basic
> Authentication. With most components this works fine. But I want also to
> protect my multi-image-components:
>
> MapUrl /images/((.*).jpg) [EMAIL PROTECTED] $1
>
> What's the best way to do this?
>
>
Hi Marco,

sorry for the late answer. I was busy in other things.

I don't quite understand your problem. How do you protect your pages and why 
you don't do it the same way?

Normally you can just call 'reply.notAuthorized("my realm")' in your 
application. What may be helpful is to create a authorization only component, 
which is called first. This can be done even in the url mappings. A component 
may return DECLINED in case he is not interested to handle the request. You can 
do that like this:

<%cpp>
  if (!verifyPassword(request.getUsername(), request.getPassword())
  {
    // Actually "tnt::HttpReply::notAuthorized" throws an exception, so the 
return code is never returned. It just looks better to use "return" here.
    return reply.notAuthorized("this is my protected webapplication");
  }
  // the user is authorized here, so we pass the request to the next mapping
  return DECLINED;
</%cpp>

And in your tntnet.conf:

MapUrl /.*  [EMAIL PROTECTED]
MapUrl /images/((.*).jpg) [EMAIL PROTECTED] $1

Tntnet then calls checkauth first. Either it throws an NotAuthorized-Exception, 
in which case the user gets a login box or it returns DECLINED, in which case 
your mymultiimagecomponent is called.

Tommi
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to