Hi all,

I am a pretty novice programmer when it comes to PHP and I am just
learning to use Cake. My expertise is in "stateful" environment
(desktop clients, flash clients, etc). I have some questions about the
best way to do what I need and I was hoping someone here might up to
giving me some advice.

Anyway, I am trying to use Cake to provide the MVC architecture for a
web app I am building. We already have REST APIs available to access
the data so I want to use those.

I am getting stuck on (a) how to handle authentication and (b) how to
get the data.

The way that authentication works in our system is:

1) Make request to login service at fixed url
2) The response will contain a session ID (I will call this mySession)
and new URL for all future requests
3) Make all future requests at new URL, and include session id.

So the problem I am having is how to properly model this?

So far I have come up with creating an "auth component" which works
similar to the CakePHP auth component. It checks for a valid mySession
ID and if it is there, it allows the application to continue,
otherwise it redirects to the login page. When the user logs in, this
component will store the mySession ID as well as the apiUrl in the
Session.

The 2nd problem is how to access data...I thought the best way would
be to add a http service to the models which would make the request
for data and then override the find function to leverage this.
However, now the problem is I can't access the session from the Model
to get the keys I need so maybe that isn't the right way?

I looked into using a custom datasource but the examples have been
very thin and not very helpful, and I still run into the problem how
to pass my session and api values.

Thanks for any help you can provide!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to