Frequently Asked Questions

Feb 20, 2024 - 11:10pm

 [F] Frequently Asked Questions  / Common Problems and Solutions  / Common Customization Problems & Questions  /

I Can't Seem to Get authenticateFilter Macro to login a User

Rate This FAQ
Rating: **** (based on 1 votes)

Created On: 2 Dec 1999 10:45 am
Last Edited: 1 Apr 2002 9:27 am

Question Printer Friendly

I'm trying to write an authenticateFilter macro for communicating with my central authentication server. But I just can't seem to get it to login an authorized user.

Answer

Web Crossing treats authenticateFilter slightly differently than other macros. What's not clear until you read one of the 2 example macros, is that, in order to "login" a user to web crossing, your authenticateFilter macro must return the unique ID# of the user to login as if it was "printing it" to screen. However you get that info is up to you and is based on your external authentication scheme (that's where the "exec" in one example runs out and gets the OK).

For example, if you place the following in your webx.tpl and refresh the cache, every visitor to web crossing is automatically logged in as user "7" (which is usually the sysop):

%% macro authenticateFilter %%
7
%% endmacro %%

Also beware of whitespace! Any whitespace output from the macro will be seen first and NOT your unique ID# or your HTTP or HTML, so your user will not be logged in, redirected or shown a page. It's always a good idea to issue a %% clearOutput %% immediately BEFORE you output your ID, redirect, etc and to NOT tab-out or space-out the commands for formatting purposes.

Be sure to read your documentation! This filter, like many others, has to follow specific rules in order to work properly!