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.
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)
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.
2. Download and build this guice example
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:
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:
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=......
C.6. Use singly's "self" API to pull out the following JSON into a key/value map
C.7.1 IF LINKEDIN:
C.7.2 IF FACEBOOK:
C.7.3 IF TWITTER
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:
You should see "Hello World"
Skills: test, json, linkedin, facebook, twitter