MetaCPAN: Week #7

2 views
Skip to first unread message

Moritz Onken

unread,
Jul 13, 2011, 12:30:48 PM7/13/11
to tpf-gsoc...@googlegroups.com, Clinton Gormley, Olaf Alders
Hi,

week #7 was all about the api-server. I successfully moved from a plack-based framework to catalyst. It took me much more time than I had anticipated. Mainly because there were almost no tests and writing those was quite a pain and involved faking a whole cpan and all of its index files. At least there is now a solid foundation for tests, so new code can be tested quite easily.

Next thing was authentication. Since we want to keep the front-end as slim as possible, I implemented the whole authentication layer in the api-server. It was quite straight forward. I implemented a custom store for the session that puts the data in ElasticSearch. Then there are the controller classes that communicate with the OAuth endpoints of Twitter, Facebook and GitHub. Since all of them use a slightly different version / implementation of OAuth there is no single controller for catalyst that could help me there. So I ended up implementing them myself with help of Facebook::Graph and Net::Twitter. After hours and hours of testing and try & error I finally managed to get a working authentication, at least for the api-server.

Nex was the integration of the front-end with the api authentication. Naturally, I chose to do this using OAuth as well. The api-server is now an OAuth provider and the front-end its client. This pattern makes it possible to add more clients to the api-server easily (e.g. iCPAN). Although the api-server takes care of the authentication, you can chose from the front-end which service you want to authenticate against. On a successful authentication, you will be redirected from the api-server to the front-end. The front-end will then log you in and has access to the user data that is stored on the api-server. To make actually use of being logged in, I added a form to edit the user profile.

Now that we have authentication, the real fun can begin. We are already discussing how we are going to implement tagging of modules and distributions. I'm not quite sure how we are going to store the tags along with the modules. ElasticSearch doesn't give you much options, especially if you want to integrate the tags in your search query. We will see how this works out, but as of now I don't have good idea of how to store them.

Cheers,
mo

Reply all
Reply to author
Forward
0 new messages