Ask a Question related to Coldfusion Security, Design and Development.
-
jasonslipp #1
LDAP and Login
Hello Everyone, I really do not know what I am doing. I am trying to use
LDAP authentication so people can login into my application yet keep their
username and password. Below is the code for the application.cfm page as well
as a login page. Again, I really do not know what I am doing and I am having a
hard time finding any help so sorry if what i have already done makes no sense.
The code below was adopted from on of the Forta books. Thanks much in advance
for any help. Have a good day... Jason Application.cfm page <cfapplication
name='Grants' sessionmanagement='yes' loginstorage='session'> <cflogin> <cfif
isDefined ('cflogin')> <cfset LDAP_root = 'my.ldap.root.edu'> <cfset
LDAP_server = 'my.ldap.server.edu'> <cfset LDAP_port = '###'> <cfset
userfilter = '(&(objectclass=*) (uid=#cflogin.name#))'> <cfset
LDAP_username = 'username'> <cfset LDAP_password = 'userpassword'>
<cftry> <cfldap action='query' name='usersearch' attributes='dn'
start='#LDAP_root#' scope='subtree' server='#LDAP_server#'
port='#LDAP_port#' filter='#userfilter#' username='#LDAP_username#'
password='#LDAP_password#'> <cfcatch type='Any'> <cfset
UserSearchFailed = true> </cfcatch> </cftry> <cfif NOT
userSearch.recordcount OR isDefined ('UserSearchFailed')> <cfoutput> <script>
alert ('UID for #cflogin.name# not found'); </script> </cfoutput> <cfabort>
</cfif> <cftry> <cfldap action='query' name='auth' attributes='cn'
start='dc=ad,dc=lehigh,dc=edu' server='#LDAP_server#' port='#LDAP_port#'
filter='(&(objectClass=groupOfUniqueNames)
(uniquemember=#userSearch.dn#))' username='#LDAP_username#'
password='#LDAP_password#'> <cfcatch type='any'> <cfif FindNoCase('Invalid
credentials', cfcatch.Detail)> <cfoutput> <script>alert('User ID or Password
invalid #cflogin.name#')</script> </cfoutput> <cfabort> <cfelse>
<cfoutput> <script> alert('Unknown error for
user:#cfcatch.Detail#')</script> </cfoutput> <cfabort> </cfif> </cfcatch>
</cftry> <cfif auth.recordcount> <cfloginuser name='#cflogin.name#'
password='#cflogin.password#' roles='#valueList(auth.cn)#'> </cfif> </cfif>
</cflogin> Login.cfm Page <body
onLoad='document.LoginForm.UserLogin.focus();'> <cfform
action='Application.cfm' name='LoginForm' method='post'> <input type='hidden'
name='Userlogin_required'> <input type='hidden' name='UserPassword_required'>
<table width='367' border='1' align='center' bordercolor='#FFFFFF'> <tr>
<td bgcolor='ffce5a'><img src='GrantsBannerSmall.gif' width='482'
height='47'></td> </tr> <tr> <td width='482' bgcolor='ffce5a'><div
align='center' class='style3'><strong>Please Sign In </strong></div></td>
</tr> <tr> <td bgcolor='ffce5a'> <div align='left'><span
class='style3'> <!---Text field for User Name---> User
Name: <cfinput type='text' name='username' size='20'
value='' maxlength='100' required='yes' message='Please type your
username first'> </span></div></td> </tr><tr> <td
bgcolor='ffce5a'><p class='style3'>Password: <cfinput type='password'
name='userpassword' size='12' value='' maxlength='100' required='yes'
message='Please type you password first.'> <input type='submit'
value='Enter'> </tr> </table> </cfform> </body> </html>
jasonslipp Guest
-
Strange problem with Forms authentication: After successfull login, login page is still displayed
Hi there I have a quite strange problem with my ASP.NET-Application. The application has being deployed one year ago and worked fine till last... -
user and admin login on same login page
Hello, I have a user login page which also doubles as my administrator login. Currently, my method of logging in doesnt seem to be working... -
Login to LDAP using current credentials
Hello, Here is my situation. I have developed several apps that require authentication to access. For authentication, I have the users enter... -
session problem - login screen continually reloads after pressing the login button
I am trying to get sessions to work on a log in screen to give certain users access to certain pages/directories. The problem is that when the... -
LOGIN: ERROR- Failed to initialize policy manager. (IFOR_PM_FATAL) Login sessions denied.
Verify that you haven't set the system date by mistake to a far away future. All the licenses then become expired! Restoring the system to the... -
jasonslipp #2
LDAP and Login
Hello Everyone, I really do not know what I am doing. I am trying to use LDAP
authentication so people can login into my application yet keep their username
and password. Below is the code for the application.cfm page as well as a login
page. Again, I really do not know what I am doing and I am having a hard time
finding any help so sorry if what i have already done makes no sense. The code
below was adopted from on of the Forta books. Thanks much in advance for any
help. Have a good day... Jason Application.cfm page <cfapplication
name='Grants' sessionmanagement='yes' loginstorage='session'> <cflogin> <cfif
isDefined ('cflogin')> <cfset LDAP_root = 'my.ldap.root.edu'> <cfset
LDAP_server = 'my.ldap.server.edu'> <cfset LDAP_port = '###'> <cfset userfilter
= '(&(objectclass=*) (uid=#cflogin.name#))'> <cfset LDAP_username =
'username'> <cfset LDAP_password = 'userpassword'> <cftry> <cfldap
action='query' name='usersearch' attributes='dn' start='#LDAP_root#'
scope='subtree' server='#LDAP_server#' port='#LDAP_port#' filter='#userfilter#'
username='#LDAP_username#' password='#LDAP_password#'> <cfcatch type='Any'>
<cfset UserSearchFailed = true> </cfcatch> </cftry> <cfif NOT
userSearch.recordcount OR isDefined ('UserSearchFailed')> <cfoutput> <script>
alert ('UID for #cflogin.name# not found'); </script> </cfoutput> <cfabort>
</cfif> <cftry> <cfldap action='query' name='auth' attributes='cn'
start='dc=ad,dc=lehigh,dc=edu' server='#LDAP_server#' port='#LDAP_port#'
filter='(&(objectClass=groupOfUniqueNames) (uniquemember=#userSearch.dn#))'
username='#LDAP_username#' password='#LDAP_password#'> <cfcatch type='any'>
<cfif FindNoCase('Invalid credentials', cfcatch.Detail)> <cfoutput>
<script>alert('User ID or Password invalid #cflogin.name#')</script>
</cfoutput> <cfabort> <cfelse> <cfoutput> <script> alert('Unknown error for
user:#cfcatch.Detail#')</script> </cfoutput> <cfabort> </cfif> </cfcatch>
</cftry> <cfif auth.recordcount> <cfloginuser name='#cflogin.name#'
password='#cflogin.password#' roles='#valueList(auth.cn)#'> </cfif> </cfif>
</cflogin> Login.cfm Page <body
onLoad='document.LoginForm.UserLogin.focus();'> <cfform
action='Application.cfm' name='LoginForm' method='post'> <input type='hidden'
name='Userlogin_required'> <input type='hidden' name='UserPassword_required'>
<table width='367' border='1' align='center' bordercolor='#FFFFFF'> <tr> <td
bgcolor='ffce5a'><img src='GrantsBannerSmall.gif' width='482' height='47'></td>
</tr> <tr> <td width='482' bgcolor='ffce5a'><div align='center'
class='style3'>Please Sign In </div></td> </tr> <tr> <td bgcolor='ffce5a'> <div
align='left'><span class='style3'> <!---Text field for User Name---> User Name:
<cfinput type='text' name='username' size='20' value='' maxlength='100'
required='yes' message='Please type your username first'> </span></div></td>
</tr><tr> <td bgcolor='ffce5a'><p class='style3'>Password: <cfinput
type='password' name='userpassword' size='12' value='' maxlength='100'
required='yes' message='Please type you password first.'> <input type='submit'
value='Enter'> </tr> </table> </cfform> </body> </html>
jasonslipp Guest



Reply With Quote

