Hi Sriragu,

On Tue, Feb 5, 2013 at 7:41 AM, Sriragu Arudsothy <[email protected]> wrote:

> Hai Suresh, Prabath,
>
>                             In the identity.oauth - 4.0.5 component throws
> the above exception when return the generated access token from
> TokenIssuer.issue().
>
> (1)
> Exception: org.apache.axis2.AxisFault:
> org.apache.axis2.databinding.ADBException: Unexpected subelement {
> http://dto.oauth2.identity.carbon.wso2.org/xsd}expiresInMillis
>  at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
> at
> org.wso2.carbon.identity.oauth2.stub.OAuth2ServiceStub.fromOM(OAuth2ServiceStub.java:1252)
>  at
> org.wso2.carbon.identity.oauth2.stub.OAuth2ServiceStub.issueAccessToken(OAuth2ServiceStub.java:481)
>
>
> Solution: In the OAuthAccessTokenRespDTO has expiresIn(sec) as well as
> expiresinmillis properties. When the token is generated we set the
> expiresin(sec) only. expiresinmillis just multiplies the expiresin * 1000.
> After I commented the expiresinmillis property at the above class it works
> fine / No exception. The access token is returned and displayed. Able to
> access the REST API.
>
> (2) Currently, When the app get registered the client ID/ secret
> /username/tenentid ...etc are set through the OAuthAppDO. But when retrieve
> the stored app, we retrieve OAuthAppDO does not include the username(authz
> user). Bz currently, The "GET_APP_INFO" query string defined at the
> SqlQueries.java at the identity.oauth.dao does not retrieve the username of
> the authorized user instead it retrieves the cliend id/secret/appname/.
>

This username is not the authorized user, it's the user who created the
app. You can get the authorized user when you are validating the access
token.

>
> Solution: I have added a new query includes the username retrieval as
> well. Otherwise we are unable to set the authzUser property of the
> TokenRequestMessageContext object which is used to generates the
> AccessToken. With the OLD query if I invoke the
> accessTokenValidationResponse.getAuthorizedUser() returns null. But it
> works fine with the NEW QUERY and I was able to create the user registry
> instance with username. With the old query It does not create the user
> registry instance and REST calls were failed.
>
> (3) Hai suresh, We can also retrieve the TenanID of the authzuser via
> OAuthAppDo. If we define a property to get/set the tenentID at the
> tokenReqMsgContext, we can retrieve the tenantID from the
> AccessTokenValidationResponse object. Therefore we can create user registry
> instance with (username, tenantID).
>
> Once you have the username, you can get the tenant ID as bellow,

                                           int  tenantId =
IdentityUtil.getTenantIdOFUser(username);


> WDYT?
>
> Thanks!
> Sriragu
>
>
>
>


-- 
Suresh Attanayake
Software Engineer; WSO2 Inc. http://wso2.com/
Blog : http://sureshatt.blogspot.com/
Twitter : https://twitter.com/sureshatt
LinkedIn : http://lk.linkedin.com/in/sureshatt
Mobile : +94755012060,+94770419136,+94710467976
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to