Thanks for the detailed response Mike. I'm somewhere between a beginner and a novice when it comes to MarkLogic and XQuery in general so much of what you said will take some time for me to absorb but I appreciate the well thought out and experienced response and will be sure to take what you have said into consideration.
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Michael Blakeley Sent: Thursday, January 31, 2013 4:56 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Setting a page as default on an application server That step is a bit oversimplified, I think. You *could* have default.xqy call xdmp:redirect-respose to login.xqy but that isn't very robust. Deep bookmarks will break if the user is logged out, for example. I suppose you could augment that by writing a custom error page that redirect some errors to the login page, but I don't have any experience with that pattern. What I have done is modify every page for which login is required with some code to protect it. That code has to redirect to login as needed, and also has to ensure that the rest of the page won't run when redirecting. That's necessary because any code *after* the redirect will still run. If that later code tries to does something that the default login can't do, the browser will see an error instead of the redirect. The way I've done this is to write a common function that checks for some exec privilege, sends the redirect, and then returns true or false. declare function m:login-check() as xs:boolean { if (xdmp:has-privilege('my-app-privilege-uri', 'execute')) then false() else (xdmp:redirect-response('/login.xqy'), true()) }; Any page you want to protect will import the library that defines that function, and call it in a way that short-circuits the rest of the page. if (m:login-check()) then () else (: rest of page :) <html... When using a framework like https://github.com/marklogic/roxy that includes its own page router, you might be able to leverage that to handle page protection for you. I've done this myself, but in doing so I extended roxy's page router with code that I haven't yet cleaned up for a patch. -- Mike On 31 Jan 2013, at 13:11 , "Dunlap, Zachariah" <[email protected]> wrote: > I'm attempting to create a custom login page as described here: > > http://docs.marklogic.com/guide/security/recipes#id_22120 > > Step 5 says: Make login.xqy the default page displayed by the application > server. > > However I can't seem to find any information on how to do this. I've > attempted to put my Xquery document in both the document database and modules > database connected to the HTTP server in various locations including the root > and such to no avail. > > Any guidance on how to set my Xquery as the default page of an HTTP server > would be greatly appreciated. > > Thank you, > > Zach > > The information contained in this communication is intended for the > use of the designated recipients named above. If the reader of this > communication is not the intended recipient, you are hereby notified > that you have received this communication in error, and that any > review, dissemination, distribution or copying of this communication > is strictly prohibited. If you have received this communication in > error, please notify The Associated Press immediately by telephone at > +1-212-621-1898 and delete this email. Thank you. > [IP_US_DISC] > > > msk dccc60c6d2c3a6438f0cf467d9a4938 > > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
