LDAP Authentication with Active Directory and SunOne - active-directory

I know how to authenticate username and password using LDAP after reviewing this site and others. But my question is our client does not give permission to any username or password to bind itself to active directory. I mean there is admin kind of uname and password which is used to bind first and then you have to provide your actual username and password. Could anyone please let me know how could I accomplish this?

Typically you find some manner of binding, that allows you to search for the full DN of your target user, based on whatever information you got out of them. For example, you might ask for a username and password to log in with, and that username might be their sAMAccountName is AD. Or perhaps their email address in AD.
Then you would query either mail or sAMAccountname via a bind as an Admin user or as an anonymous bind, or something else they allow to find the full DN of that user.
Finally you would perhaps do a password compare to test the DN's password against the value they entered on the login page.

Related

Is it possible to check if a user belongs to an AD group without user password?

Is it just me who's finding AD group is very complex? ;-(
I have a web service that only allows a certain number of role groups to have access. Say we allow people within role group 'rGroupA' to have access.
At some point, a user logs on to our web server, and we have the user name. However, we would not like to ask the user to type in the password.
Is it possible for us to know if this user belongs to 'rGroupA' somehow?
Currently, I could logon our LDAP server with my username and password and see the list of groups I am in. However, I could not search for the groups for my colleagues.
I have searched google for a while but haven't found the answer. It could be that I don't understand LDAP mechanism very well.
Many thanks!

How do you log into an account in Active Directory that doesn't have a password set?

I'm doing some InfoSec testing and I've discovered some accounts that don't have a password set.
I'm wondering if there is a way to can log into these accounts. I know that for these accounts, their password will be required to be reset upon login, but I'm not sure how to log in. Any ideas?
It might help if you tell us how you determined that they don't have a password set. But if that truly is the case, then there are only two possibilities:
The accounts are disabled. This might happen if the accounts are created via automation. Creating accounts has to be done in two steps: create the account (which is created disabled), then set the password and enable it. You can't enable it without setting a password.
The accounts have the ADS_UF_PASSWD_NOTREQD flag set in the userAccountControl attribute. This means the account can be enabled with no password and you can login with such an account by just not putting anything as the password. You can read more about this here if you'd like.

What are the steps to implement single sign on against Active Directory using LDAP?

I need to authenticate users against Active Directory in my C++ application. I know I need to bind to something and authenticate using the user's distinguished name and password. This distinguished name is often long with commas and contains the username.
Say the user enters something in my application's username and password box. How do I find the distinguished name to bind to? Do I have to write a search query for it?
You need to:
Search the AD for the user's DN based on what he entered into your form, typically an email address or a user ID or something else that is unique. Unless the AD supports anonymous searching you will need to bind to it using an adminstrative account/password that has permission to do this search. THis is done via an LDAP filter expression, a topic which you need to look up.
When/if you've found it, rebind to AD using the DN of that entry and the password from the form.
If either step fails, the login fails, and don't tell the user which step it was, i.e. don't tell him 'no such user' or 'wrong password', just tell him 'bad credentials' or similar in both cases. Otherwise you are leaking information to the attacker.

What's attribute of password in ActiveDirectory(cn=nameuser)

If attribute of username is sAMAccountname, for password is ...
I don't found one look like that.
I want to authenticate on login page(browser).
ps.I'm a newbie explain to me please.
There is no attribute containing the password.
AD authentication for a web site is possible, but it depends on the language you are using.

LDAP bind as a user without password?

We have a forgot password system that allows a user to create a new password. It is going against Active Directory over LDAPS. Right now once a user goes to create a new password, we have to bind as an admin, change the password to a random string, then bind to the user account with that random string, then change the password to the one they provided. We do this because we have a password history policy of the last 5 used passwords.
This works fine now but the password history has the random strings as one of the previous passwords. Is there any way to bind with a user but without a password? The user would be authenticated before this by a security question.
I do it a different way. I create a dynamic object under the user's entry, expiring in a few days, with a generated uid attribute; send them a link containing that uid; that leads to the change password page, but logged in via a different LoginModule that sees the UID parameter, checks it, and if present and correct logs them in. In other words a kind of 'ticket' login.
The code that did the lookup bound/reconnected itself as the application itself, but that didn't actually matter because the connection for logging in is closed immediately, like all other LDAP connections in the application actually. When anything is done to the user's own entry, e.g. change password, update profile, a reconnect is done as that user using the password which I have saved in the session. When the user does anything else to LDAP it is really the application doing it so an application bind/reconnect is done as above. IOW the application itself is a user (or even several different users with different levels of permission).
Because a UID is much longer than a password, and because the entry containing it expires after a day or two, all this is rather more secure than generating a temporary password and shipping it around. The change password page could also have a security question on it if reached via the ticket login.
There are two password change operations in AD - reset and change. Reset is an administrative operation (which is what you are doing here). When you do a reset, you don't need to supply the current password. Change password is an end user operation whereby the user has to supply their current password in addition to the new password.
If you change your code to do a password reset and run in the context of a user with permissions to reset passwords, you should be good to go. If you need to honor password policy during the reset, there's a way to do this as well with a special LDAP control.

Resources