wso2 / product-is

Welcome to the WSO2 Identity Server source code! For info on working with the WSO2 Identity Server repository and contributing code, click the link below.
http://wso2.github.io/
Apache License 2.0
748 stars 728 forks source link

customTokenIssuer Extension point on WSO2IS 5.7.0 not working as expected #5327

Closed vi-gupta17 closed 5 years ago

vi-gupta17 commented 5 years ago

I have deployed extension bundle in component/lib folder. WSO2IS still uses JWTTokenIssuer to generate the token. I don't see any error in extension bundle.

I have override OauthTokenIssuerImpl lets say customTokenIssuer to obtain custom created tokens. but when i debug the log, It is instantiating both customTokenIssuer and JWTTokenIssuer but framework do not use customTokenIssuer to generate token.

I have updated identity.xml with customTokenIssuer class.

Is it something I am missing in the POM or missing some entries in any of the XML ?

[2019-05-23 10:53:59,900] INFO {org.wso2.carbon.identity.oauth.config.OAuthServerConfiguration} - An instance of abc.xxx.xxx.xx.customTokenIssuer is created for Identity OAuth token generation.

..........

[2019-05-23 10:54:00,084] DEBUG {org.wso2.carbon.identity.oauth2.util.OAuth2Util} - Added OAuthTokenReqMessageContext to threadlocal [2019-05-23 10:54:00,086] DEBUG {org.wso2.carbon.identity.oauth2.token.JWTTokenIssuer} - JWT Access token builder is initiated [2019-05-23 10:54:00,086] INFO {org.wso2.carbon.identity.oauth.config.OAuthServerConfiguration} - An instance of org.wso2.carbon.identity.oauth2.token.JWTTokenIssuer is created for Identity OAuth token generation.

...................

[2019-05-23 10:54:00,092] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.grant.AbstractAuthorizationGrantHandler} - OAuth application id: XXxXXXXXXXXXXXXX, user access token validity time 3600000ms [2019-05-23 10:54:00,092] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.grant.AbstractAuthorizationGrantHandler} - OAuth application id : XXxXXXXXXXXXXXXX, access token validity time in milliseconds : 3600000 [2019-05-23 10:54:00,096] DEBUG {org.wso2.carbon.identity.oauth2.token.JWTTokenIssuer} - Access token request with token request message context. Authorized user XXxXX@carbon.super [2019-05-23 10:54:00,096] DEBUG {org.wso2.carbon.identity.oauth2.token.JWTTokenIssuer} - User Access Token Life time set to : 3600000ms. [2019-05-23 10:54:00,097] DEBUG {org.wso2.carbon.identity.oauth2.token.JWTTokenIssuer} - JWT Self Signed Access Token Life time set to : 3600000ms. [2019-05-23 10:54:00,098] DEBUG {org.wso2.carbon.identity.oauth2.token.JWTTokenIssuer} - Scope exist for the jwt access token with subject XXxXX@carbon.super and the scope is openid [2019-05-23 10:54:00,154] DEBUG {org.wso2.carbon.identity.oauth2.token.handlers.grant.AbstractAuthorizationGrantHandler} - Existing access token has expired, but refresh token is still valid for client: XXxXXXXXXXXXXXXX. Remaining time: 17420133ms. Using existing refresh token.

As per me only customTokenIssuer should be instantiated and used to generate the token.

mefarazath commented 5 years ago

Which version of IS are you using?

vi-gupta17 commented 5 years ago

Its resolved, I had not selected token issuer in service provider. After selecting the custom class for token issuer, it worked perfectly. I guess we should make a note somewhere in documentation that after deploying custom jar, we have to make change in the service provider

mefarazath commented 5 years ago

@vi-gupta17 Previously we only had the capability to have a single token issuer type across the system. But with IS 5.7.0 onwards we can deploy many custom token type issuers and engage on per service provider. Let me check if this is in the docs. If not we need to fix it.