8000 JSON serialization of RegisteredService into LDAP by mmoayyed · Pull Request #741 · apereo/cas · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 15 commits into from
Dec 1, 2014
Merged

JSON serialization of RegisteredService into LDAP #741

merged 15 commits into from
Dec 1, 2014

Conversation

mmoayyed
Copy link
Member
@mmoayyed mmoayyed commented Nov 6, 2014

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.

@@ -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() {
Copy link
Contributor

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?

Copy link
Member Author

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.

@mmoayyed
Copy link
Member Author

Updated.

@leleuj
Copy link
Contributor
leleuj commented Nov 13, 2014

+1

@mmoayyed
Copy link
Member Author

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"));
8000 Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

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

Copy link
Member Author

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
mmoayyed pushed a commit that referenced this pull request Dec 1, 2014
JSON serialization of RegisteredService into LDAP
@mmoayyed mmoayyed merged commit cf6b525 into apereo:master Dec 1, 2014
@mmoayyed mmoayyed deleted the json-serialization-ldapmapper branch December 1, 2014 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0