Expand my Community achievements bar.

External authentication question

Avatar

Level 3
Hello There,



After reading the last pages of the cocomo bible i would like
to make sure i got it right:



I create room on the fly or pre-create a bunch.

Btw can i check how many room of template type A are
available with cocomo api ?



- Using server script i create rooms from template (or not)
and provision them programmatically.

- When my loged in user clicks on a link "lets try this
cocomo app" i request a session for room x and generates an
authToken for my dear user. (So i need to keep a list of available
rooms on my server side).



- Now i pass two things to my client swf app: the room URL
and the authoken ? thats where i am not so sure.

- Client connects to the app without having to input
anything.



An other question

Is there some Hook possible for a cocomo session to call a
url when the session ends or a user leaves?

How can i check that a session ended ? i.e my room moved from
active to ended.



Thanks a lot,



Greg

6 Replies

Avatar

Former Community Member


Hi Greg (hey, a real name!),



You can create rooms any time, and we don't limit the number
of rooms.



You're absolutely right, you'd pass the URL and the
authtoken to the client somehow (flashvars, or fetch from the
client via HTTPs).



Re: session end - we've been thinking about this one - how
would you use this sort of feature? And how would you expect it to
be implemented?



thanks

nigel

Avatar

Level 3
Hi Nigel,



Well actually i was thinking about measuring the session
time. But that could be done with the client listening for cocomo
server connection and poll the time every minute to my webserver,
if the polling stop i can assume that the session ended.



I also wanted to know when a session ended to tell my
webserver user A and B are done, which would then generate some
stats, compile screenshots uploaded to the server during the
session into a pdf etc. The thing is, how do you differentiate a
real stop from a dropped connection, you can't. I guess it is
possible to know all connected user to Cocomo service with the api
? For external auth that would be handy to have.



Thinking more about it, i really can't see what you could do
since we can not program the backend. Making some POST or GET call
to urls but then how do we decide the data to be pass.Making some
default one user id and elapsed time maybe ?



My experience in api design is low but that are some
interesting problems.

Avatar

Employee
Regarding session ended vs. reconnection, on the server side
we allow for some time after all users are gone before we declare
the session "ended". If there was a network glitch and users start
reconnecting during that window, they'll rejoin the current
session.



Regarding session end: with the next SDK iteration calling
AccountManager.getSession("room") will return the same session
secret while a room is currently running and a new one if the room
wasn't running. So, calling getSession() once in a while would give
you some idea of what's going on. I am also working on some account
status and room status API that would tell you which sessions are
active and how many users are currently in each sessions.



These API require "polling" the hosted services so they
shouldn't be abused. And I'll think about a "push" mechanism, but
it may get very "chatty" if you have a lot of rooms running in your
a account that open and close all the time.



Maybe you could try an hybrid approach where your clients
monitor the "roster" and send a message to the server when the
roster size goes down to "1" (only one client left) and the server
uses that message to check back with Cocomo to get the correct
status.



Avatar

Level 3
Thats good, that means i could use the session status to
declare a session ended.



I have some little problem validating an external
authentication.



I have a python server script which does the following:



room =
http://connectnow.acrobat.com/coulixor/base



am = cocomo.accountmanager(room)

am.login(user, password)



Then in a /test i do



room = am.createRoom("foobar3", None)

sess = am.getSession("foobar3")

# the secret is clear since its beta i will regenerate it

secret = "06b6c8b4ca1e40e6a2f83e2da0da7c7b"

token1 = sess.getAuthenticationToken(secret,
request.user.username, request.user.id, 50)



print tokent1

# gives
exx=eDp0ZWFjaGVyMTo6YmFzZToyOmZvb2JhcjM6NTA6ODIyNWYwNWZmYjM1NDg0NmYwNDQ5MzM5ZTA1OGI0ZDM2NTY1N2M0OQ==





Now in my flex client i did the following:

<rtc:AdobeHSAuthenticator


authenticationKey="exx=eDp0ZWFjaGVyMTo6YmFzZToyOmZvb2JhcjM6NTA6ODIyNWYwNWZmYjM1NDg0NmYwNDQ5MzM5ZTA1OGI0ZDM2NTY1N2M0OQ=="


id="auth"

authenticationFailure="{showConnError(event);}"

/>

<rtc:ConnectSessionContainer

id="sessionContainer"

width="100%" height="100%"

authenticator="{auth}"

roomURL="
http://connectnow.acrobat.com/coulixor/foobar3"

creationComplete="{startup();}"



>



Which unforgettably raises the following error:



Cocomo Beta Build # : 0.9

requestInfo
http://connectnow.acrobat.com/coulixor/foobar3?exx=eDp0ZWFjaGVyMTo6YmFzZToyOmZvb2JhcjM6NTA6ODIyNWYwN...

=============== null

getMeetingInfo: status=0

#THROWING ERROR# bad authentication key

SOMETHING WRONG [Event type="authenticationFailure"
bubbles=false cancelable=false eventPhase=2]



Did i overlook something ?

Admitting that would work, and autopromote user is true in my
room the nodes shouls be created by the client, his username
encoded in the token should appears in the cocomo dev console
foobar3 room detail and i will be happy.



Thanks for the help.



Avatar

Level 3
My mistake after looking at the external auth i got it sorted
and my user given owner rights get loged in straight to the cocomo
app whohoo.



Small thing to notice.

In the Python example,

Its written



am = cocomo.accountmanager(room)



where it should be account



am = cocomo.accountmanager(account)

then login,

then create / delete rooms.



No ? thats what the ruby n rail does with "new" example.



Thats a good first step.

I am preparing a bunch of questions for monday.

Avatar

Employee
I finally took the time to look at the example, and I have no
idea of why I named everything "room" instead of "account"
(actually, I know. My original example was dealing with a single
room).



Anyway, thanks for pointing it out. I update the example and
it'll be in the next version of the SDK.