![]() |
| Securing a Directory |
|
ejones31
|
Hello All,
I've searched this forum several times looking for a solution to my problem, but I can't seem to figure it out. I'll try and make it simple and I have this issue on more than one site I have hosted with HMS. I the simplest terms, I have a directory on a website that is for "members only". While securing the pages is easy (a CF session login), securing the non-cf files doesn't appears to not be. Within this directory are images, .pdf files, and swf/flv files that I do not want available to non authenticated users. While I'm sure I could setup some type of CF/Htaccess combination, I do not want to make user's login twice nor do I want to keep up with multiple Htaccess based accounts. I have a user table already to check authentication against, that was easy. But is there away to then have CF execute some code to satisfy something like Htaccess' credentials? Does this make any sense? Alan |
||||||||||||
|
|
|||||||||||||
|
jamie
HostMySite Sales Rep
![]()
|
Just to clarify, is this site on a linux server? I ask because the answer will be different if you're on Windows (htaccess doesn't work on Windows).
|
||||||||||||
|
|
|||||||||||||
| Windows |
|
ejones31
|
I've already gotten somebody in support to set me up a NT protected directory. Now I've got to figure out the code. Any idea where I can find some code that I could copy?
|
||||||||||||
|
|
|||||||||||||
|
nathacof
Forum Admin
|
http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&file=00001178.htm
FTA:
|
|||||||||||||
|
|
||||||||||||||
| That really doesn't help |
|
ejones31
|
Let me try this: What would the URL look like to pass the username and password along for access to a .flv file?
If the file is located at: www.fred.com/bob/blah.flv If the username is lucy and the password is ricky, what would the URL look like? |
||||||||||||
|
|
|||||||||||||
|
nathacof
Forum Admin
|
To create a link which uses http authentication you would have a URL like so:
http://username:password@example.com/bob/blah.flv However you should not need to create links as such because the web server will pass the HTTP Authentication parameters to all subsequent page requests after your users have authenticated. Also it is not very secure to divulge password information to your users. |
||||||||||||
|
|
|||||||||||||
| Let me try this another way... |
|
ejones31
|
Perhaps I'm just not explaining this correctly:
I want a user to be able to go to a directory, enter a username a password, and gain access to both the ColdFusion based webpages files that are not ColdFusion files (.swf, .pdf, etc). An individual user's (and there will be several) credentials need to be maintained in a DB table for a variety of reasons. So, why/how, upon login to the CF pages, can a user also satisfy the credentials for the directory? This shouldn't be this complicated. Alan |
||||||||||||
|
|
|||||||||||||
|
nathacof
Forum Admin
|
Hey Alan,
I understand your frustration. Because the regular resources (.swf, .flv) are not served through the Coldfusion connector, the only way to prevent anonymous access is with HTTP Authentication. Since you already have HTTP Authentication on the directory in question, your ColdFusion application should be programmed to recognize when a user has authenticated using this method. Using CFLogin, you can determine if someone has authenticated using HTTP Authentication. The only alternative method I can think of would be to use a CF script to dynamically load the protected resources after disabling anonymous access to the files; in which case you can use your applications normal methods to authenticate users. Maybe some one with more ColdFusion experience can elaborate on this, as I'm more of a PHP guy. |
||||||||||||
|
|
|||||||||||||
| Maybe I'm still not explaining this right... |
|
ejones31
|
Here's the scenario I want to achieve.
There's a directory called "Members". It is a "secure" directory. By secure I mean you can't see, download or access anything in the directory. On the website's main navigation bar there is a link called "Member's Only". When users click that link, it takes them to a login page (not a Prompt dialog), where they enter their credentials. They are then directed to a page that is within a secure directory. Now they can download, view or whatever they need to any of the files within the directory. So, that login page they use must authenticate and authorize them at the same time. Alan |
||||||||||||
|
|
|||||||||||||
|
nathacof
Forum Admin
|
This article is a bit long winded, http://coldfusion.sys-con.com/node/230503 but describes in detail the problems you're having and solutions to said issues on the second page.
|
||||||||||||
|
|
|||||||||||||
|
jamie
HostMySite Sales Rep
![]()
|
I *am* a CF guy and I checked out the article Nate posted - it's good and should meet your needs. Post here if not.
|
||||||||||||
|
|
|||||||||||||
| Securing a Directory |
|
||
|



