0
votes
oauth 2.0 - Knowing whether requested idp is google idp or wso2 idp - Stack Overflow
Asked
Viewed 110 times
0

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.

5
  • 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?
    – farasath
    May 27 2016 at 17:37
  • yes, exactly what I want, please help
    – deen
    May 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?
    – farasath
    May 27 2016 at 19:32
  • I want both for same app
    – deen
    May 27 2016 at 19:49
  • posted an answer. try that out and let me know whether that works out
    – farasath
    May 27 2016 at 20:06
1

So by understanding your requirements from you description Here's how you can achieve what you want to do,

  1. Create a google OAuth app and get it's client_credentials and client_secret. Register a callback_url such as "https://localhost/callbackGoogle"

  2. 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

  3. Create a service provider in WSO2 IS and enable OAuth inbound authentication. Register a callbackurl such "https://localhost/callbackWSO2"

  4. Under the Local & Outbound Authentication Configuration section of the Service provider select Advanced option

  5. Add the local and federated authenticater in step 1

  6. Now register two servlets, one for callback url of googleIDP and other for the callback registered for WSO2 IS

  7. 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)

enter image description here

  1. 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

8
  • 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.
    – farasath
    May 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
    – deen
    May 27 2016 at 20:36
  • I have one more question, how I can know which idp get selected by user in my servlet class?
    – deen
    May 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?
    – farasath
    May 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.
    – deen
    May 28 2016 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.

 
1
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?farasath
yes, exactly what I want, please helpdeen
do you want both options (WSO2 IS and Google) for the same App or simply want to do both separately?farasath
I want both for same appdeen
posted an answer. try that out and let me know whether that works outfarasath

1 Answers

1
votes

So by understanding your requirements from you description Here's how you can achieve what you want to do,

  1. Create a google OAuth app and get it's client_credentials and client_secret. Register a callback_url such as "https://localhost/callbackGoogle"

  2. 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

  3. Create a service provider in WSO2 IS and enable OAuth inbound authentication. Register a callbackurl such "https://localhost/callbackWSO2"

  4. Under the Local & Outbound Authentication Configuration section of the Service provider select Advanced option

  5. Add the local and federated authenticater in step 1

  6. Now register two servlets, one for callback url of googleIDP and other for the callback registered for WSO2 IS

  7. 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)

enter image description here

  1. 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