Ldap Domain Name validator - ldap

I want to create a validator for dn of an ldap, I mean that if I get as input a string from user, my regex, program, library (whatever works) can tell me if string inserted is a ldap dn or not, can You help me??

Maybe I asked in the wrong place, however (for those who will make a similar search) I post the answer I found from another part: https://serverfault.com/questions/549961/ldap-distinguished-name-validator

LDAP C API has a function for DN parsing that is called ldap_explode_dn. There are also many bindings for different languages (PHP, python, etc.). I suggest you consider using this API as a DN validation tool.

Related

LDAP Login with two OUs (or sub OU) for Oracle APEX

I am trying to use LDAP for my oracle apex application, I already have setup a current LDAP which refers to the base OU in the LDAP, but we also have another OU or a sub-ou, for a second set of users, I need them to login to my application as well - I know the host and port and such, and I know I have to set the Use Exact Distinguished String to no and provide a search filter (Please let me know if this is wrong), but I don't know how I can reference both the sub OU and the normal OU. Can anyone please give an example of a search string with a regular OU and a second OU or a sub-OU for LDAP for Oracle Apex?
In this situation, it's ok to Use Exact Distinguished Name : No, and set a search base instead.
You can specify only one search base, this setting is used so that the backend actually searches down the DIT under that base. But it's probably not an issue unless having a huge directory, you just need to set the common "container" for your users, and not necessarily an organizational unit, any entry located "above" in the tree.
For example, if you have these 2 OUs : ou=accounts,dc=example,dc=com and ou=users,dc=example,dc=com, you would set dc=example,dc=com as the base.
Looking at DN's, you would only take the longest common part, starting from the right (it's pretty much like in the DNS hierarchy).

Kohana 3 auth username as number

I want to use numbers as username in Kohana Auth. For example, username 100001?
While adding new user Kohana returns me error: ORM_Validation_Exception [ 0 ]: Failed to validate array
Is is possible to user numbers as username in Kohana?
EDIT: This answer looks simpler and better than mine, but try to understand it at all.
You need to extend User Model, I'll help you using auth with the ORM driver.
Steps to extend User Model:
If you didn't yet, configure Auth module to use orm and create a database table with the fields you want. Here is a good example of how to doing it (It's an old tutorial using ko3.1 but you can still learn from it). PS.: you can have any columns at the 'users' table and you don't need to have the 'username' column if you do not want.
Open and read carefully this file: MODULES/orm/classes/model/auth/user.php (It's self documented and I hope you understand it. If not, stop reading this answer here and read the kohana docs. Some shortcuts: Auth - Kohana User Guide, Auth (orm) methods, addons:auth
Copy the file (don't edit the original) to APPPATH/classes/model/auth/user.php and edit it how you want. Some functions that you may like to edit are: rules, filters and unique_key (<- useful). Be creative, you also can add custom functions.
Test and change whatever else needed.
You can change the login method to works as you like. You can set login by e-mail, make a custom validation method or parse values before saving in the database (see public function filters()). This is helpful for whatever you try to do with auth module using ORM... But... if you really don't want to use ORM, you can build your own driver, learn how.
I made this some time ago in kohana 3.2 but I think you won't get problems with 3.3. If you still have questions, this question on kohana forum may help.

can I validate input on MTurk?

I've written a HIT on mturk asking people for domain suggestions. Is there any way to ensure that the domain has valid syntax at the time of entry or submission?
So it turns out you can embed an iframe within the HIT. This allowed me to embed a form which I could then validate in any way I pleased. It requires the worker to copy the result of the form into the HIT form.
I think to do this the 'proper way' (i.e. no need to copy-paste) you'd need to use an ExternalQuestion. This can be done via either the API (various languages) or the command-line client.

Commentable plug-in with Spring Security LDAP

I'm trying to get the commentable plug-in running with the spring security framework ldap plugin from Burt Beckwith.
I found a similar problem here.
The only difference seems to be that I'm using LDAP and the LDAP user details don't have an id, or I'm not seeing it.
I've tried setting the grails.commentable.poster.evaluator to
{com.companyname.sec.User.get(org.springframework.security.core.context.SecurityContextHolder.context.authentication.principal.id)}
and also to
{com.companyname.sec.User.get(principal.id)}
Both of these were suggested in the other issue I referenced above. What I get is the error below:
groovy.lang.MissingPropertyException: No such property: id for class: org.springframework.security.ldap.userdetails.LdapUserDetailsImpl
Possible solutions: dn
This seems to suggest using the dn field, but since that's a string, and the id is a Long, I don't think that's the right option. So, is there a way to configure the grails.commentable.poster.evaluator to get these two plug-ins to work together, or do I need to modify one of them to get a compatible type (i.e. change the commentable plug-in to use a String, and then grab the username from the LDAP user details.)?
Not using the commentable but the spring-security-ldap plugin.
For me this really simple copy&paste solution worked:
Solution on Grails Jira by Burt
Use
{com.companyname.sec.User.findByUsername(principal.username)}
or
{com.companyname.sec.User.findByUsername(org.springframework.security.core.context.SecurityContextHolder.context.authentication.principal.username)}
That gives me the following error:
org.grails.comments.CommentException: No [grails.commentable.poster.evaluator] setting defined or the evaluator doesn't evaluate to an entity. Please define the evaluator correctly in grails-app/conf/Config.groovy or ensure commenting is secured via your security rules
I read that to mean there is no findByUsername method. So, were you suggesting I create that method in order to get at an id value? And I assume correspondingly, that means I need to insert the ldap users into the database in order to generate an id.

VB .NET: Logged in user information

I'm writing software in VB .NET (2005) which uses the Windows user information as login credentials - just the username. I've found Environment.UserName which works for the username (as you would expect).
However, I need more information - I need the full name of the user (as shown on the Start Menu). It seems this information is stored... somewhere, as Windows is able to use it for things like permissions on file shares.
I've heard there's calls in user32.dll that can do this, but I'd like a .NET method if it's at all possible. I also have a SID for the user, if that helps at all.
Does anyone know the best way to get this additional information?
It seems the System.DirectoryServices namespace is exactly what I'm looking for.
Always seems that you find the answer right after you ask :)
For future reference:
Dim ent As New DirectoryServices.DirectoryEntry("WinNT://<Domain>/<Username>")
Dim props As DirectoryServices.PropertyCollection = ent.Properties
Debug.Print(props.Item("FullName").Value)