MOVE SINGLY SOCIAL LOGIN EXAMPLE FROM SPRING TO GUICE AND ADD PERSISTENCE

MOVE SINGLY SOCIAL LOGIN EXAMPLE FROM SPRING TO GUICE AND ADD PERSISTENCE

Closed - This job posting has been filled and work has been completed.

Job Description

TASK: MOVE SINGLY SOCIAL LOGIN EXAMPLE FROM SPRING TO GUICE AND ADD PERSISTENCE

Lots of details, but it isn't that complicated. Here is an outline of what I am looking for

========
OVERVIEW: We want to harness Singly, which is a social login tool. Their OOTB example uses Spring and we want to use Guice. Furthermore, we want to grab some of their data and save it to a db.
========
DELIVERABLES:
A. WAR successfully deployed and running on both Cloud Foundry and cloudbees.
B. Source code of what you have done (should be original works with no GPL/LGPL usage). Although this is a demo sample, the code should be
quality and have java doc comments, proper error handling, etc.
C. MySQL Database and test table created as described below
D. Brief instructions on how to deploy the war using both Cloud Foundry and cloudbees (I am new to both and comparing) and instructions on how you created the DB and tables (what tool did the host provide to create the table)
========
STEPS:
1. Download and build the singly sdk. Log in to singly to get a test key.
May want to look at the spring example for reference.
https://github.com/Singly/singly-java/tree/master/sdk
https://singly.com/docs/libraries/getting_started_java
https://singly.com/docs/libraries/getting_started_java#Running-the-Spring-MVC-Example

2. Download and build this guice example
https://github.com/danbim/template-guice-jersey-tomcat

3. Remove the /REST in configureServlets so commands are hitting the root

4. Use both Cloud Foundry and cloudbees (account will be provided)

5. Create a mySQL db named "MH" and a table named "user". Schema is forthcoming before the project gets too far along.

6. Add some injected variables on app load (configureServlets). We need to read 3 index.html pages--one for authenticated, one for rerouted, and one for not authenticated. They should be read from disk (hardcoded path is fine for now) and stored as a guice singleton, for later dependency injection when needed.

7. Wire in the singly authentication, possibly in a Guice filter.

A. NOT AUTHENTICATED+BASE URL: If you type in the root / URL and are not authenticated, the app displays a simple html similar to

/authentication.html (see AuthenticationController example) but with only 3 services
In our case we only care about the following 3 services:
service=linkedin
service=twitter
service=facebook


B. NOT AUTHENTICATED+REROUTED: If you type in any other url and are not authenticated, the app redirects you back to the root page. You get the same authentication page as above but an additional warning "You must be authenticated to view this page." Leverage the injected version referenced above so we can custom the look/feel.

So for example, if you go to the following url:
http://localhost:8080/template-guice-jersey-tomcat/hello
You should *not* see "Hello World" and should see the url forward back to / and our "You must be authenticated to view this page." html page.


C. AUTHENTICATED+BASE URL:
C.1 Check the session to see if we are authenticated
C.2 If not in session, check the user's cookies for an access_token.

------
From here below, please put in a "Singly.java" class and provide a junit test. There should be no session/cookie dependencies in this class.

You can call the following url to verify authentication: https://api.singly.com/profile?verify=true&access_token=......

If C.1 or C.2 is valid and you have a valid token

C.3 Flush the injected index.html so the client instantly gets results

C.4 Store the access_token to the user's cookie

C.5. Use singly's "profile" API to pull out the following JSON into a key/value map https://api.singly.com/profile?verify=true&access_token=......

email

C.6. Use singly's "self" API to pull out the following JSON into a key/value map

C.7.1 IF LINKEDIN:
https://singly.com/docs/linkedin#self
https://api.singly.com/services/linkedin/self?access_token=.......
[Fields forthcoming]

C.7.2 IF FACEBOOK:
https://singly.com/docs/facebook#self
https://api.singly.com/services/facebook/self?access_token=.......
[Fields forthcoming]


C.7.3 IF TWITTER
https://singly.com/docs/twitter#self
https://api.singly.com/services/twitter/self?access_token=.......
[Fields forthcoming]

If any fields are missing log as a warning and skip them. For each auth type, there will be an image url which you should grab and save to the server.

C.8. PERSIST RESULTS: Make a JDBC call to the database table created above to illustrate storing the data connectivity. You can just hardcode it in for now quick-and-dirty as we are going to replace with our own proprietary persistence module anyway so we just need to see the db connectivity working and all the fields cited above being properly read.

D. AUTHENTICATED+OTHER URL:
check C.1 and C.2 but skip any further actions and allow the Guice TemplateResource to be called. In this case, if you go to the following url:
http://localhost:8080/template-guice-jersey-tomcat/hello
You should see "Hello World"

---
Skills: test, json, linkedin, facebook, twitter