[Yanel-dev] Loading of users and groups as XML

Michael Wechner michael.wechner at wyona.com
Tue Feb 16 16:11:49 CET 2010


Michael Wechner wrote:
> Guillaume Déflache wrote:
>> Hi!
>>
>> Michael Wechner schrieb:
>>> Hi
>>>
>>> The PolicyManager resource
>>>
>>> src/contributions/resources/policymanager/src/java/org/wyona/yanel/impl/resources/policymanager/PolicyManagerResource.java 
>>>
>>>
>>> is loading users and groups via the following query string
>>>
>>> /foo/bar?yanel.policy=update&get=identities
>>>
>>> which then is handled by the YanelServlet#doAccessPolicyRequest()
>>>
>>> first, but then forwarded again to the PolicyManager resource
>>>
>>> if (getXML != null && getXML.equals("identities")) {
>>> sb.append(getIdentitiesAndRightsAsXML(getRealm().getIdentityManager(), 
>>> getRealm().getPolicyManager(), get
>>> RequestedLanguage()));
>>>
>>> Now I would like to re-use this for editing users and groups, but it 
>>> seems to me that the main purpose of the policy manager
>>> resource is to manage policies and not users and groups and hence I 
>>> think we should re-factor this by introducing a 
>>> IdentityManagerResource.
>>>
>>> WDYT?
>>
>> I fully agree!
>>
>> I think we should put that under e.g. <yanel-prefix>/admin/groups and 
>> <yanel-prefix>/admin/users
>
> I thought a bit more about this and I think we should do either
>
>
> (1) A "mapping" like
>
> (1.1) <yanel-prefix>/api/usermanager?yanel.usecase=getusers
>
>        to
>
>       org.wyona.security.core.api.UserManager#getUsers()
>
> (1.2) <yanel-prefix>/api/usermanager?yanel.usecase=getuser&id=joe
>
>        to
>
>       org.wyona.security.core.api.UserManager#getUser(String id)

I have now implemented (not fully finished) a resource type:

https://svn.wyona.com/repos/public/yanel/trunk/src/contributions/resources/security-api

whereas you can call it by setting a resource config (e.g. 
res-configs/security-api.xml), e.g.

<?xml version="1.0"?>

<yanel:resource-config xmlns:yanel="http://www.wyona.org/yanel/rti/1.0">
  <yanel:rti name="security-api" 
namespace="http://www.wyona.org/yanel/resource/1.0"/>

  <yanel:property name="mime-type" value="application/xml"/>
</yanel:resource-config>

and then requesting

http://127.0.0.1:8080/yanel/MY_REALM/security-api.xml?yanel.usecase=getgroups


As a next step I will move it as a global resource type into the 
YanelServlet.

Cheers

Michi
>
> OR
>
> (2) We introduce a SOAP interface for this
>
>       (as a second phase)
>
>>
>>
>> Also why not using /foo/bar/yanel.usecase=read-policy (resp. 
>> update-policy) instead of /foo/bar?yanel.policy=read (resp. update)?
>
> I will try to add this to
>
> src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java
>
> and set the existing one to deprecated
>> It goes in the way of allowing to fully split policy reading code 
>> from the PolicyManager, which would be also helpful IMHO, because you 
>> may want to reimplement both parts separately.
>
> Can you explain this in more detail, because I am not sure I 
> understand what you mean.
>
> Thanks
>
> Michi
>>
>> Cheers,
>>    Guillaume
>



More information about the Yanel-development mailing list