[cas-user] CAS 6.1 RC5 Release Announcement

2019-09-02 Thread Misagh Moayyed
CAS 6.1 RC5 is released:
https://github.com/apereo/cas/releases/tag/v6.1.0-RC5

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cas-user+unsubscr...@apereo.org.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/8C9190B0-5351-4CDF-ACD3-677BD962A525%40gmail.com.


[cas-user] Re: CAS Custom Authentication Handler Principal JSON Problem

2019-09-02 Thread Cemal Önder
Because after calling mergeAttributes of DefaultAuthenticationResultBuilder 
class, everything in the Principal is returned as List.

2 Eylül 2019 Pazartesi 12:12:51 UTC+3 tarihinde Cemal Önder yazdı:
>
> Hi everyone,
>
> I have a JSON problem while returning custom attributes in my custom 
> authentication handler:
>
>
> return createHandlerResult( credential,
>  this.getPrincipalFactory( ).createPrincipal( credential.getId( ), 
> attributes) );
>
>
> which createPrincipal method accepts Map
>
>
> Principal createPrincipal(String id, Map attributes);
>
> When I put Map here, it returns *toString *representation of 
> the List instead of its JSON representation. Or when I add Map, it returns 
> {"left": "key", "right": "value"}.
>
> I have been debugging for 1 week, I see how CAS uses json-smart-2.3 library. 
> I see that when I send Map in the Object of Map for the 
> attributes, json-smart library uses its writers, for the map it uses
>
> BeansWriter which gets fields of the class and uses as keys. So it makes 
> sense for the HashMap, it adds left and right fields to the JSON body which I 
> don't want.
>
>
>
> In short I want my CAS server return Map of attributes in correct JSON way 
> like how org.json.JSONMapper does. How can I achieve this? 
>
> (
>
> Also I tried directly return JSON representation in the Object section of 
> attributes:
>
>
> Map attributes = new HashMap<>();
>
> String roles = "{"TestModule":["Name1"]}"; (didn't add escape quotes for 
> simplicity)
>
> attributes.put("roles", roles);
>
>
> But CAS somehow returns my String as LinkedList to the json-smart library. So 
> library uses its Writer for LinkedLists, which adds [] to the response which 
> I don't want like:
>
>
> I don't want this:
>
> {"rolesPerModule":["{\"TestModuleForBouncer_LIVE\":[\"ADMIN\"]}"]}
>
>
> I want like:
> {"rolesPerModule":{"{\"TestModuleForBouncer_LIVE\":[\"ADMIN\"]}"}}
>
>
> )
>
>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cas-user+unsubscr...@apereo.org.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/102ff478-6dcc-48b2-92cf-4db7559ffdbc%40apereo.org.


[cas-user] Re: CAS Custom Authentication Handler Principal JSON Problem

2019-09-02 Thread Cemal Önder
And when I look for the CAS for how it handles Principal, it merges 
everything as LinkedList. So for that reason whatever I add in the Object 
of Map section, it returns as array in the JSON 
representation like []. Which means when I add attributes.put("name", 
"ExampleName"), it returns as "{"name"}:["ExampleName"].

2 Eylül 2019 Pazartesi 12:12:51 UTC+3 tarihinde Cemal Önder yazdı:
>
> Hi everyone,
>
> I have a JSON problem while returning custom attributes in my custom 
> authentication handler:
>
>
> return createHandlerResult( credential,
>  this.getPrincipalFactory( ).createPrincipal( credential.getId( ), 
> attributes) );
>
>
> which createPrincipal method accepts Map
>
>
> Principal createPrincipal(String id, Map attributes);
>
> When I put Map here, it returns *toString *representation of 
> the List instead of its JSON representation. Or when I add Map, it returns 
> {"left": "key", "right": "value"}.
>
> I have been debugging for 1 week, I see how CAS uses json-smart-2.3 library. 
> I see that when I send Map in the Object of Map for the 
> attributes, json-smart library uses its writers, for the map it uses
>
> BeansWriter which gets fields of the class and uses as keys. So it makes 
> sense for the HashMap, it adds left and right fields to the JSON body which I 
> don't want.
>
>
>
> In short I want my CAS server return Map of attributes in correct JSON way 
> like how org.json.JSONMapper does. How can I achieve this? 
>
> (
>
> Also I tried directly return JSON representation in the Object section of 
> attributes:
>
>
> Map attributes = new HashMap<>();
>
> String roles = "{"TestModule":["Name1"]}"; (didn't add escape quotes for 
> simplicity)
>
> attributes.put("roles", roles);
>
>
> But CAS somehow returns my String as LinkedList to the json-smart library. So 
> library uses its Writer for LinkedLists, which adds [] to the response which 
> I don't want like:
>
>
> I don't want this:
>
> {"rolesPerModule":["{\"TestModuleForBouncer_LIVE\":[\"ADMIN\"]}"]}
>
>
> I want like:
> {"rolesPerModule":{"{\"TestModuleForBouncer_LIVE\":[\"ADMIN\"]}"}}
>
>
> )
>
>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cas-user+unsubscr...@apereo.org.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/1bb267ee-c186-4769-891f-ce76b112a843%40apereo.org.


[cas-user] CAS Custom Authentication Handler Principal JSON Problem

2019-09-02 Thread Cemal Önder
Hi everyone,

I have a JSON problem while returning custom attributes in my custom 
authentication handler:


return createHandlerResult( credential,
 this.getPrincipalFactory( ).createPrincipal( credential.getId( ), attributes) 
);


which createPrincipal method accepts Map


Principal createPrincipal(String id, Map attributes);

When I put Map here, it returns *toString *representation of the 
List instead of its JSON representation. Or when I add Map, it returns {"left": 
"key", "right": "value"}.

I have been debugging for 1 week, I see how CAS uses json-smart-2.3 library. I 
see that when I send Map in the Object of Map for the 
attributes, json-smart library uses its writers, for the map it uses

BeansWriter which gets fields of the class and uses as keys. So it makes sense 
for the HashMap, it adds left and right fields to the JSON body which I don't 
want.



In short I want my CAS server return Map of attributes in correct JSON way like 
how org.json.JSONMapper does. How can I achieve this? 

(

Also I tried directly return JSON representation in the Object section of 
attributes:


Map attributes = new HashMap<>();

String roles = "{"TestModule":["Name1"]}"; (didn't add escape quotes for 
simplicity)

attributes.put("roles", roles);


But CAS somehow returns my String as LinkedList to the json-smart library. So 
library uses its Writer for LinkedLists, which adds [] to the response which I 
don't want like:


I don't want this:

{"rolesPerModule":["{\"TestModuleForBouncer_LIVE\":[\"ADMIN\"]}"]}


I want like:
{"rolesPerModule":{"{\"TestModuleForBouncer_LIVE\":[\"ADMIN\"]}"}}


)

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cas-user+unsubscr...@apereo.org.
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/d846c777-a54c-4b2c-a18f-36e399925d25%40apereo.org.