I am trying to configure two identity server in wso2is, one is google idp and other one wso2is itself. My requirement is if user select wso2 IdP they will be able to access user information from wso2 idp and if they select google IdP they will be able to access user information from google account. So my question is for both idp there are different API to generate access token, then how I can identify which IdP user selected so that I can generate access token.
-
Not clear what you are trying to achieve, so basically do you want to get an access token from either WSO2 Identity Server or Google IDP based on the IDP user selects to authenticate from?– farasathMay 27 2016 at 17:37
-
yes, exactly what I want, please help– deenMay 27 2016 at 18:18
-
do you want both options (WSO2 IS and Google) for the same App or simply want to do both separately?– farasathMay 27 2016 at 19:32
-
I want both for same app– deenMay 27 2016 at 19:49
-
posted an answer. try that out and let me know whether that works out– farasathMay 27 2016 at 20:06
So by understanding your requirements from you description Here's how you can achieve what you want to do,
Create a google OAuth app and get it's client_credentials and client_secret. Register a callback_url such as "https://localhost/callbackGoogle"
Register the google idp as an IDP in WSO2 Identity Server, under federated authenticaters section of the IDP fill in the Google Authenticator with the details of the OAuth app created in Google
Create a service provider in WSO2 IS and enable OAuth inbound authentication. Register a callbackurl such "https://localhost/callbackWSO2"
Under the Local & Outbound Authentication Configuration section of the Service provider select Advanced option
Add the local and federated authenticater in step 1
Now register two servlets, one for callback url of googleIDP and other for the callback registered for WSO2 IS
Now you request for an access token from the service provider you will be redirected to a login page with two options ( Local IS or Google IDP)
- Based on the IDP chosen to authenticate by the user one of the servlets will be hit and you can identify which IDP user used to authenticate easily.
[ 1 ] https://docs.wso2.com/pages/viewpage.action?pageId=49092446
-
the token details are redirected to your callback_url, therefore you can either register a servlet for the callback url and extract the token details from the request when the OAuth provider redirects and hits your servlet register under the callback.– farasathMay 27 2016 at 20:24
-
thank you so much for your kind help, I'll try it and hope I'll get more help from your side. thanx again– deenMay 27 2016 at 20:36
-
I have one more question, how I can know which idp get selected by user in my servlet class?– deenMay 27 2016 at 20:43
-
just a small clarification, do you google idp to issue the access token or simply authenticate with google idp and let WSO2 issue access tokens?– farasathMay 28 2016 at 9:48
-
my requirement is if user select wso2is ipd all information related to that user will be access from generated access token and if user select google idp then user information from google contact will be access from access token. So how I'll get access token according to different idp(wso2is idp or google idp). please give me some idea.– deenMay 28 2016 at 14:35
Not the answer you're looking for? Browse other questions tagged oauth-2.0 google-api wso2 wso2is or ask your own question.
1 Answers
So by understanding your requirements from you description Here's how you can achieve what you want to do,
Create a google OAuth app and get it's client_credentials and client_secret. Register a callback_url such as "https://localhost/callbackGoogle"
Register the google idp as an IDP in WSO2 Identity Server, under federated authenticaters section of the IDP fill in the Google Authenticator with the details of the OAuth app created in Google
Create a service provider in WSO2 IS and enable OAuth inbound authentication. Register a callbackurl such "https://localhost/callbackWSO2"
Under the Local & Outbound Authentication Configuration section of the Service provider select Advanced option
Add the local and federated authenticater in step 1
Now register two servlets, one for callback url of googleIDP and other for the callback registered for WSO2 IS
Now you request for an access token from the service provider you will be redirected to a login page with two options ( Local IS or Google IDP)
- Based on the IDP chosen to authenticate by the user one of the servlets will be hit and you can identify which IDP user used to authenticate easily.
[ 1 ] https://docs.wso2.com/pages/viewpage.action?pageId=49092446