Hi Shiva,

Please use reply all including the dev list :) So that others will be able
to chip in with their ideas as well...

There is a small catch there. Even if you managed to pass the
tenantDomain as a query param to the token endpoint it will not reach your
extended password grant handler. The reason is this line of code in our
current implementation[1], which limits the password grant type to pass
username, password parameters only to the grant handler. We have fixed this
in master where we pass all the parameters sent in the token.

There is a small trick to get this working. You can write a grant handler
extending the password grant handler but register it as a custom grant
instead of grant_type=password, let's say you register it as
grant_type=custom1, then in the token request you can send the
tenantDomain as a parameter like below,

"grant_type=custom1&username=ddd&password&tenantDomain=abc.com",

within the grant handler, you can access any parameter sent using,

 // extract request parameters
 RequestParameter[] parameters =
oAuthTokenReqMessageContext.getOauth2AccessTokenReqDTO().getRequestParameters();

All the details you need to implement a custom grant type are in [2] with
examples. Give it a try! :)


[1] https://github.com/wso2-support/identity-inbound-auth-
oauth/blob/support-5.3.3/components/org.wso2.carbon.
identity.oauth.endpoint/src/main/java/org/wso2/carbon/
identity/oauth/endpoint/token/OAuth2TokenEndpoint.java#L273-L275

[2]
https://docs.wso2.com/display/IS530/Writing+a+Custom+OAuth+2.0+Grant+Type


Thanks,
Farasath Ahamed
Software Engineer, WSO2 Inc.; http://wso2.com
Mobile: +94777603866
Blog: blog.farazath.com
Twitter: @farazath619 <https://twitter.com/farazath619>
<http://wso2.com/signature>



On Tue, Sep 5, 2017 at 10:16 PM, <[email protected]> wrote:

> Yes absolutely 😊 is there any way or alternate way?
>
>
>
> *From:* Farasath Ahamed [mailto:[email protected]]
> *Sent:* 05 September 2017 22:14
> *To:* [email protected]; WSO2 Developers' List <[email protected]>
> *Subject:* Re: [Dev] Where can I find /token endpoint source code.
>
>
>
>
>
>
>
> On Tue, Sep 5, 2017 at 10:06 PM, <[email protected]> wrote:
>
> Hi Ahamed,
>
>
>
> Thank you for your response I found the configuration files. Is it
> possible to change the /token context attribute to take a path variable in
> /token and pass that to /oauth2/token. Eg.
>
>
>
> <api xmlns="http://ws.apache.org/ns/synapse"; name="_WSO2AMTokenAPI_"
> context="/{domain}/token">
>
>
>
> And your ultimate target is to pass this particular parameter to the
> password grant handler is it?
>
>
>
>
>
> Thank You,
>
> Shiva Kumar KR
>
>
>
> *From:* Farasath Ahamed [mailto:[email protected]]
> *Sent:* 05 September 2017 21:26
> *To:* [email protected]
> *Cc:* WSO2 Developers' List <[email protected]>
> *Subject:* Re: [Dev] Where can I find /token endpoint source code.
>
>
>
> Hi Shiva,
>
>
>
> /token exposed is actually a proxy to /oauth2/token which is the actual
> endpoint that handles your token request. Souce code for OAuth2 Token
> Endpoint can be found in [1].
>
> You can find the proxy configuration for /token in
> APIM_HOME/repository/deployment/server/synapse-configs/
> default/api/_TokenAPI_.xml
>
>
>
>
>
> [1] https://github.com/wso2-extensions/identity-inbound-auth
> -oauth/blob/v5.3.4/components/org.wso2.carbon.identity.
> oauth.endpoint/src/main/java/org/wso2/carbon/identity/
> oauth/endpoint/token/OAuth2TokenEndpoint.java
>
>
>
>
>
> Thanks,
>
> Farasath
>
>
> Farasath Ahamed
>
> Software Engineer, WSO2 Inc.; http://wso2.com
>
> Mobile: +94777603866
>
> Blog: blog.farazath.com
>
> Twitter: @farazath619 <https://twitter.com/farazath619>
>
> <http://wso2.com/signature>
>
>   <http://wso2.com/signature>
>
>   <http://wso2.com/signature>
>
>   <http://wso2.com/signature>
>
> On Tue, Sep 5, 2017 at 9:13 PM, <*[email protected]*> wrote:
> <http://wso2.com/signature>
>
> Hi WSO2 team, <http://wso2.com/signature>
>
>   <http://wso2.com/signature>
>
> I want to know in which class /token url request is handled. It will be
> very helpful for me if any one suggest which class name and project.
> <http://wso2.com/signature>
>
>   <http://wso2.com/signature>
>
> Thank You, <http://wso2.com/signature>
>
> Shiva Kumar KR <http://wso2.com/signature>
>
>
> _______________________________________________
> Dev mailing list
> *[email protected]*
> *http://wso2.org/cgi-bin/mailman/listinfo/dev* <http://wso2.com/signature>
>
>   <http://wso2.com/signature>
>
>   <http://wso2.com/signature>
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to