need help on gmail sso - java

I am developing a web application using strut2 framework and using gmail credentials for login to that application. I am able to use google account services for login purpose successfully. Now I am trying to implement SSO between gmail & my application. The use case is "If user is already logged into gmail, I want that user to log automatically into my application".
How should I go about it?

Related

How to authenticate user/password of a Google account on a standalone/desktop application in java

I want to authenticate username/password of google account. So enters the user name and password in a form than i need to verify those credentials using java google api. The Google service on application is already authenticated by using oauth for standalone application which is using service account and private key file. But need to verify the user give him access to the application.
currently i am using service.setUserCredentials of docsService which do not work anymore.
There is a exemple in the google api java library https://developers.google.com/api-client-library/java/google-api-java-client/oauth2#installed_applications

Spring Social Facebook Login

I have follow basic Spring Social Facebook and it worked. But it required me to login on browser.
Do you have any idea how to login with an email and password that input inside the Spring program ?
Diagram:
Other Program (Send email and password) -> Java Spring application (Received and Auth) -> Facebook
Use this opensource library, provided the library to integrate with spring
https://code.google.com/p/socialauth/wiki/GettingStartedWithSpring
This how spring Social login works.
On click of social login, your application will redirect to social provider auth server page,where user provide his own credentials and it authenticate with soical provider and then redirects to application and a connection is prepared for this social user and a local user is mapped to this connection for further access.
There is no point of consuming email and password inside of spring application.You dont have control over social user credentials.
All if you want to consume user details,you should go with spring form login.
Here is the application & blog that supports both form-login and social login(linkedin/twitter/facebook).Hope it will help you.

Kerberos WAS 7 fallback to application authentication(LDAP)

We have implemented kerberos based SSO for my application, it is integrated with domain1.com users and it is working fine. But there are few accounts which are not in domain1.com domain, they are in domain2.com so we wanted to provide our custom login screen for entering user credentials and then we wanted to authenticate it with ldap with our own java code. So the scenario is, if user is trying to access my application then sso should happen automatically if he falls in domain1.com otherwise showing the customised login screen where in he enters user credentials then application will authenticate it and grants the application resources.
How to achieve this?
Websphere 7+ has support for fall back to application authentication mechanism.
In admin console: Do the following steps.
Goto Security > Global security > SPNEGO web authentication
Select Allow fall back to application authentication mechanism
You can find more information here

Google authentication and gmail access in java

I am working on a JSF application.
In which a user should be able to login with gmail/google apps account (redirected to google login page and returned after authentication)
and user should be able to check/delete emails (using Java Gmail) in the subsequent screen.
This application is to be hosted in jboss/tomcat server and not in GAE appspot.
I checked examples to create login and logout urls using GAE API or OAuth2.
https://developers.google.com/appengine/docs/java/users/overview
But it seems it is not possible to access gmail after authentication in the above method.
If somebody can provide any inputs, it is highly appreciated. Thanks for your time.

RESTful webservice with auth for mobile application

I have developed many stateless RESTful webservices for a mobile application in Java and they are working very well.
For example:
http://.../api/coupon
http://.../api/coupon/{id}
...
Now, I have to extend these services because I have to send different data back to the mobile for every user. So I need to know on the server side which user try to get or set information. And I have to prevent the serve of unauthorized users.
There are two different way how user can login into the mobile application:
log in with facebook account
log in with an application account
I need to develop two login and a logout services because the users who use the mobile application have to login into the application.
I read lots of article about auth and RESTful and OAuth.
I think I have to develop two login services with two imput parameters: username and password.
For example:
localLogin(String username, String password) -> token
facebookLogin(String username, String password) -> token
These logon services have to generate a same token and send it back to the mobile application in the http header. And after the login process the mobile client has a token. And the client has to send this token to the server when it makes a RESTful server call.
What do you think? Is my idea good?
If it is, could you help me how can I start to develop this in Java?
If it is not, could you tell me the good way?
You do not need 2 log in procedures. Just use the Facebook SDK!!
i) In your app would be a login with facebook button.
ii) User clicks on it and is then redirected to the facebook login page, where the user enters his credentials and facebook returns a token to you. You do not have to worry about the user's facebook credentials or storing them anywhere! Facebook will handle that for you. Consider the FB login part as black box to your app - you simply make a FB SDK's login call and it will do some processes and give back a access token to your app.
iii) Now, you can exchange the access token for the user's profile information. Enter this profile info to your database - that will ensure authenticated call.
Once you have verified that the user is logged on you can do whatever you want.

Categories