Erlang/OTP Forums

Author Message

<  Yaws mailing list  ~  WWW authentication question

Guest
Posted: Thu Nov 19, 2009 9:26 pm Reply with quote
Guest
I would like to use Yaws (1.84) in embedded mode with www
authentication. So, I put something like

authdirs = [ #auth{ dir = ["/"],
realm = "xxx",
users = [{"yyy","zzz"}]
}],

into th #sconf record. Strangely it seems working with links, but with
firefox or opera it just display a "401 authentication needed" page, but
does not pop-up a username/passwd prompt.

Could anyone tell me where did I the mistake?

Regards,
Alpar



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post received from mailinglist
Guest
Posted: Fri Nov 20, 2009 12:01 am Reply with quote
Guest
Hi,

If memory serves my right, it has to do with the fact that the auth
headers is not added by default in embedded mode unless the auth config
is read from auth files. I can't verify the below right now, but please try:

Realm = "xxx",
Headers = yaws:make_www_authenticate_header({realm, Realm}),
authdirs = [ #auth{ dir = ["/"],
realm = Realm,
users = [{"yyy","zzz"}],
headers = Headers
}],


In 1.85 it should be possible to add something like this to your appmod:

%% Used if auth/2 returns {false, X} | false
%% or for unauthorized requests
out401(_Arg, _Auth, Realm) ->
[{status, 401},
{header, yaws:make_www_authenticate_header({realm, Realm})}].


Brgds,
/Anders


Alp
Guest
Posted: Fri Nov 20, 2009 12:09 am Reply with quote
Guest
Hi,

Thanks. This was the trick.

Alpar

On Tue, 2009-11-17 at 11:58 +0100, Anders Dahlin wrote:
> Hi,
>
> If memory serves my right, it has to do with the fact that the auth
> headers is not added by default in embedded mode unless the auth config
> is read from auth files. I can't verify the below right now, but please try:
>
> Realm = "xxx",
> Headers = yaws:make_www_authenticate_header({realm, Realm}),
> authdirs = [ #auth{ dir = ["/"],
> realm = Realm,
> users = [{"yyy","zzz"}],
> headers = Headers
> }],
>
>
> In 1.85 it should be possible to add something like this to your appmod:
>
> %% Used if auth/2 returns {false, X} | false
> %% or for unauthorized requests
> out401(_Arg, _Auth, Realm) ->
> [{status, 401},
> {header, yaws:make_www_authenticate_header({realm, Realm})}].
>
>
> Brgds,
> /Anders
>
>
> Alpár Jüttner wrote:
> > I would like to use Yaws (1.84) in embedded mode with www
> > authentication. So, I put something like
> >
> > authdirs = [ #auth{ dir = ["/"],
> > realm = "xxx",
> > users = [{"yyy","zzz"}]
> > }],
> >
> > into th #sconf record. Strangely it seems working with links, but with
> > firefox or opera it just display a "401 authentication needed" page, but
> > does not pop-up a username/passwd prompt.
> >
> > Could anyone tell me where did I the mistake?
> >
> > Regards,
> > Alpar
> >
> >
> >
> > ------------------------------------------------------------------------------
> > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> > trial. Simplify your report design, integration and deployment - and focus on
> > what you do best, core application coding. Discover what's new with
> > Crystal Reports now. http://p.sf.net/sfu/bobj-july
> > _______________________________________________
> > Erlyaws-list mailing list
> > Erlyaws-list@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/erlyaws-list



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list

Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum