-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
JSON serialization of RegisteredService into LDAP #741
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
Conversation
Conflicts: cas-server-core/src/main/java/org/jasig/cas/util/JsonSerializer.java
@@ -77,6 +77,10 @@ public void setSalt(final String salt) { | |||
LOGGER.warn("setSalt() is deprecated and will be removed. Use the constructor instead."); | |||
} | |||
|
|||
public byte[] getSalt() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure to understand how this is related to the current PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A serializable component like the one above requires a getter.
Updated. |
+1 |
Further updated based on Daniel's suggestion on the attribute retrieval. |
String v = null; | ||
if (attr.isBinary()) { | ||
final byte[] b = attr.getBinaryValue(); | ||
v = new String(b, Charset.forName("UTF-8")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It finally occurred to me why this is happening. You're serializing JSON with line feeds. The UnboundID provider sets the attribute as binary because the line feed requires base64 encoding per the LDIF spec. I'll raise an issue to investigate further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks. My previous JSON snippet does not show it correctly, but there are \n\r
elements in the final outcome which per your explanation causes the attribute to be marked as binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed this issue:
vt-middleware/ldaptive#14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
Conflicts: cas-server-core/src/main/java/org/jasig/cas/services/AbstractRegisteredService.java cas-server-support-ldap/src/main/java/org/jasig/cas/adaptors/ldap/services/DefaultLdapServiceMapper.java cas-server-support-ldap/src/main/java/org/jasig/cas/adaptors/ldap/services/LdapRegisteredServiceMapper.java
Conflicts: cas-server-core/src/test/java/org/jasig/cas/services/JsonServiceRegistryDaoTests.java
JSON serialization of RegisteredService into LDAP
Handles https://github.com/Jasig/cas/issues/681
I striped down the
DefaultLdapMapper
so the entire service definition is persisted into a single attribute as JSON. There are setters that allow extending the serializer, and I also modified the tests to adjust the objectclass required. Some classes had to include getters for serialization to properly work.