[Building Sakai] EB client example code?

Stephen Marquard stephen.marquard at uct.ac.za
Tue Jul 17 06:58:24 PDT 2012


For reference (and Google), 

kernel-util/src/main/java/org/sakaiproject/util/BasicAuth.java

/**
 * This is implemented in a filter, since most httpclients (i.e. non
browser
 * clients) don't know what to do with a redirect.
 *
 * There are 2 mechanisms for selecting basic authentication. 1. The
client is
 * not a browser as reported by the BasicAuthFilter.isBrowser method.
2. The
 * user requested basic auth in the URL and the
 * BasicAuthFilter.requestedBasicAuth confirms this.
 *
 * in sakai.properties if allow.basic.auth.login = true, then this
feature is
 * enabled in BasicAuthFilter, the determination of non browser clients
is
 * driven by matching user agent headers against a sequence of regex
patterns.
 * These are defined in BasicAuthFilter with the form if the pattern
matches a
 * browser 1pattern or if it does not match 0pattern
 *
 * Additional patterns may be added to sakai.properties as a multiple
string
 * property against login.browser.user.agent
 *
 * The list is matched in order, the first match found being
definitive. If no
 * match is found, then the client is assumed to be a browser.
 *
 * e.g. if itunes was not listed as a client, either:
 *
 * Add
 *
 *    login.browser.user.agent.count=1
 *    login.browser.user.agent.1=0itunes.*
 *
 * to sakai.properties, or
 *
 * Add __auth=basic to the end of the url, e.g.
 *
 *   
http://localhost:8080/access/wiki/123-1231-32123-132123/-.20.rss?someparam=someval&__auth=basic

 *
 * This string is available in
BasicAuthFilter.BASIC_AUTH_LOGIN_REQUEST
 *
 */

Cheers
Stephen

Stephen Marquard, Learning Technologies Co-ordinator
Centre for Educational Technology, University of Cape Town
http://www.cet.uct.ac.za
Email/IM/XMPP: stephen.marquard at uct.ac.za 
Phone: +27-21-650-5037 Cell: +27-83-500-5290 


>>> Aaron Zeckoski <azeckoski at unicon.net> 7/17/2012 3:48 PM >>>
EB generally delegates the auth to Sakai.

>From
/direct/src/java/org/sakaiproject/entitybroker/servlet/SakaiDirectServlet.java

    public void handleUserLogin(HttpServletRequest req,
HttpServletResponse res, String path) {
        // attempt basic auth first
        try {
            if (basicAuth.doAuth(req, res)) {
                return;
            }
        } catch (IOException ioe) {
            throw new RuntimeException("IO Exception intercepted
during logon ", ioe);
        }

        // get the Sakai session (using the cover)
        Session session = SessionManager.getCurrentSession();
....

So you will need to have basic auth enabled to use the basic auth
portion. In that same way, you have to have the session keys enabled
to use that part. Otherwise you have login directly in the same way
you would for the access servlet (using normal user/pass challenge).

-AZ


On Tue, Jul 17, 2012 at 9:24 AM, Bryan Holladay
<holladay at longsight.com> wrote:
> (I accidentally replied to a different email.  This is the one I
> really meant to reply to.)
>
> I just had this problem when trying to test MSGCNTR-687... I haven't
> tried this, but this is what Mar Savitisky suggested:
>
> Is basic auth turned on in your sakai configuration?
>
> #allow basic auth
> allow.basic.auth.login=true
>
>
>
>
> On Mon, Jul 16, 2012 at 7:30 AM, David Horwitz
<david.horwitz at uct.ac.za> wrote:
>> Hi All,
>>
>> Anyone got example code for talking to the EB REST endpoints from
Java?
>> Looking to at an intergration from another system and can't seem to
get
>> the auth to work. Pretty sure there is some basic trick I'm missing
...
>>
>>
>> D
>>
>> _______________________________________________
>> sakai-dev mailing list
>> sakai-dev at collab.sakaiproject.org 
>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev 
>>
>> TO UNSUBSCRIBE: send email to
sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
"unsubscribe"
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org 
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev 
>
> TO UNSUBSCRIBE: send email to
sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
"unsubscribe"



-- 
Aaron Zeckoski - Software Architect - http://tinyurl.com/azprofile 
_______________________________________________
sakai-dev mailing list
sakai-dev at collab.sakaiproject.org 
http://collab.sakaiproject.org/mailman/listinfo/sakai-dev 

TO UNSUBSCRIBE: send email to
sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
"unsubscribe"





###

UNIVERSITY OF CAPE TOWN 

This e-mail is subject to the UCT ICT policies and e-mail disclaimer
published on our website at
http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from
+27 21 650 9111. This e-mail is intended only for the person(s) to whom
it is addressed. If the e-mail has reached you in error, please notify
the author. If you are not the intended recipient of the e-mail you may
not use, disclose, copy, redirect or print the content. If this e-mail
is not related to the business of UCT it is sent by the sender in the
sender's individual capacity.

###
 



More information about the sakai-dev mailing list