Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binary attributes are converted to string when queried by #320

Closed
goto1134 opened this issue Apr 9, 2022 · 3 comments
Closed

Binary attributes are converted to string when queried by #320

goto1134 opened this issue Apr 9, 2022 · 3 comments

Comments

@goto1134
Copy link

goto1134 commented Apr 9, 2022

I have the following Entity

@Entry(objectClasses = ["top", "person", "user"], base = "ou=users")
class LdapUser {

    @Id
    lateinit var id: Name

    @Attribute(name = "objectGUID", type = Attribute.Type.BINARY, readonly = true)
    lateinit var guid: ByteArray
}

interface LdapUserRepository : Repository<LdapUser, Name> {
    fun findByGuid(guid: ByteArray): AlternativeLdapUser
}

When I search by guid with value 90d1c68e-01be-4485-aafd-b3ffb9ddb026 converted to a 32 element byte array, the library generates the following request:

base=ou=users, finalFilter=(&(&(objectclass=top)(objectclass=person)(objectclass=user))(objectGUID=[B@7363e35b))

And the result is always empty. The correct filter would be:

base=ou=users, finalFilter=(&(&(objectclass=top)(objectclass=person)(objectclass=user))(objectGUID=\90\d1\c6\8e\01\be\44\85\aa\fd\b3\ff\b9\dd\b0\26))

Please, support binary attribute query parameters.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 9, 2022
@goto1134 goto1134 changed the title Binary attributes are converted to string during Binary attributes are converted to string when queried by Apr 9, 2022
@goto1134
Copy link
Author

goto1134 commented Apr 9, 2022

This issue may somehow be related to spring-projects/spring-ldap#634

@mp911de mp911de added the status: blocked An issue that's blocked on an external project change label Apr 19, 2022
@mp911de
Copy link
Member

mp911de commented Apr 19, 2022

ConditionCriteria supports only String arguments. We can proceed here once Spring LDAP accepts other value types.

@mp911de
Copy link
Member

mp911de commented Nov 18, 2024

We've introduced @LdapEncode annotations to control the representation. You can now implement an LDAP encoder to represent your UUID as base64-encoded string. Since LDAP queries are strings anyways, all arguments are converted into their toString representation.

@mp911de mp911de closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2024
@mp911de mp911de removed status: blocked An issue that's blocked on an external project change status: waiting-for-triage An issue we've not yet triaged labels Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants