[OTDev] A&A Online documentation formating

Nina Jeliazkova jeliazkova.nina at gmail.com
Tue Feb 8 15:03:25 CET 2011


Hi Surajit,

On 8 February 2011 15:49, surajit ray <mr.surajit.ray at gmail.com> wrote:

> Hi Nina,All,
>
> Was trying to read through the A&A documentation and had a few questions :
>
> 1) Can you link some examples of how a restlet based resource would
> look like with A&A ?
> (Although Nina did send a link on the gotomeeting chat .. it would be
> good to link it from the documentation)
>



>
> 2) Both the links at the top of the page
> http://opentox.org/dev/documentation/Guidance%20on%20Using%20AA seem
> to be broken. Is that a future (yet to be written) document ?
> http://opentox.org/dev/apis/api-1.2/AA/
>
> http://opentox.org/data/documents/partner/wp/3/deliverables/Draft%20Report%20WP3-D3.3
>
> 3) The classes at the link mentioned by Nina in SWDT -
>
> https://ambit.svn.sourceforge.net/svnroot/ambit/trunk/opentox-opensso/src/main/java/org/opentox/aa/
> seem to be for creating and deleting OpenSSO policies.


For log in, log out, listing, creating, and deleting  policies.


> However I could
> not find some sample code for wrapping a restlets resource (in Java)
> with a Guard which checks a provided token (by a client) against the
> OpenSSO server and allows a tasks to be created ...
>

For Filters (used instead of Guards in Restlet > 2.0 ) you could have a look
at

https://ambit.svn.sourceforge.net/svnroot/ambit/trunk/ambit2-all/ambit2-www/src/main/java/ambit2/rest/aa/opensso

and how to use them in the application  :
        Filter datasetAuthn = new OpenSSOAuthenticator(getContext(),false,"
opentox.org",new OpenSSOVerifierSetUser(false));
        Filter datasetAuthz = new OpenSSOAuthorizer();
        datasetAuthn.setNext(datasetAuthz);
        datasetAuthz.setNext(datasetRouter);


router.attach(String.format("%s/{%s}",DatasetResource.dataset,DatasetResource.datasetKey),
datasetAuthn);


In resources one can have a common method, extracting token from the header
on incoming request and passing it to the subsequent requests.

    protected String getUserToken(String tag) {
        try {
            Form headers = (Form)
getRequest().getAttributes().get("org.restlet.http.headers");
            if (headers==null) return null;
            return headers.getFirstValue(tag);
        } catch (Exception x) {
            return null;
        }
    }

Hope this helps,
Nina


> Thanks
> Surajit
> _______________________________________________
> Development mailing list
> Development at opentox.org
> http://www.opentox.org/mailman/listinfo/development
>



More information about the Development mailing list