spring-projects / spring-projects/spring-ldap

Spring Data LDAP fails to map Active Directory objectSid to byte[] despite Attribute.Type.BINARY

Open
#1,620 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
375
Forks
501
Avg merge
6h 4m
Merged PRs (30d)
63

Description

Querying the objectSid attribute as a byte[] results in a conversion exception, even though the attribute is explicitly configured as binary:
"org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [byte] for value [********]" in https://github.com/spring-projects/spring-ldap/blob/f50cc82054e3a7246aa13c28c091c3bb7b6501d8/core/src/main/java/org/springframework/ldap/odm/core/impl/DefaultObjectDirectoryMapper.java#L454

@Entry(objectClasses = "person")
public final class User {

    @Id
    @JsonIgnore
    private Name dn;

    @Attribute(name = "objectSid", type = Attribute.Type.BINARY, readonly = true)
    private byte[] sid;

}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at core/src/main/java/org/springframework/ldap/odm/core/impl/DefaultObjectDirectoryMapper.java around line 454 and trace how the binary objectSid attribute is converted. Reproduce the reported mapping with the provided User example; done means objectSid maps to byte[] without the String-to-byte conversion exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.