Ask a Question related to Coldfusion Security, Design and Development.

  1. #1

    Default 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 = '(&amp;(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='(&amp;(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

  2. Similar Questions and Discussions

    1. 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...
    2. 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...
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default 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
    = '(&amp;(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='(&amp;(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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139