From cc110724cfda483505d67c1ac0602a513e623356 Mon Sep 17 00:00:00 2001 From: SkNuwanTissera Date: Fri, 28 Jun 2019 13:12:24 +0530 Subject: [PATCH] INTGW-584 -reformatting the code --- .../TokenRegenerationEventListener.java | 40 +++++++++---------- .../ReadMe.md | 9 +---- 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/mbss-athenticator/components/com.wso2telco.dep.tokenregenerator/src/main/java/com/wso2telco/dep/tokenregenerator/TokenRegenerationEventListener.java b/mbss-athenticator/components/com.wso2telco.dep.tokenregenerator/src/main/java/com/wso2telco/dep/tokenregenerator/TokenRegenerationEventListener.java index 25c1cf9..3344f3a 100644 --- a/mbss-athenticator/components/com.wso2telco.dep.tokenregenerator/src/main/java/com/wso2telco/dep/tokenregenerator/TokenRegenerationEventListener.java +++ b/mbss-athenticator/components/com.wso2telco.dep.tokenregenerator/src/main/java/com/wso2telco/dep/tokenregenerator/TokenRegenerationEventListener.java @@ -31,10 +31,8 @@ import org.wso2.carbon.user.core.common.AbstractUserOperationEventListener; /** - * * Generate a new Access Token on Password Reset * **This Event Listener executes before IdentityMgtEventListener ** - * */ public class TokenRegenerationEventListener extends AbstractUserOperationEventListener { @@ -53,8 +51,9 @@ public int getExecutionOrderId() { /** * Refresh token on password reset - * @param userName username - * @param credential password + * + * @param userName username + * @param credential password * @param userStoreManager userStoreManager * @return true * @throws UserStoreException @@ -64,7 +63,7 @@ public boolean doPostUpdateCredential(String userName, Object credential, UserSt if (log.isDebugEnabled()) { log.debug("Executing TokenRegenerationEventListener"); - log.debug("Username : "+ userName); + log.debug("Username : " + userName); } String threadLocalUsername = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); @@ -75,7 +74,7 @@ public boolean doPostUpdateCredential(String userName, Object credential, UserSt startTenantFlow(userName); if (log.isDebugEnabled()) { - log.debug("Fetching application details for "+userName); + log.debug("Fetching application details for " + userName); } OAuthConsumerAppDTO[] oauthApps = new OAuthAdminService().getAllOAuthApplicationData(); @@ -84,18 +83,18 @@ public boolean doPostUpdateCredential(String userName, Object credential, UserSt OAuth2AccessTokenReqDTO tokenReqDTO = new OAuth2AccessTokenReqDTO(); tokenReqDTO.setGrantType(GRANT_TYPE); - if(oauthApps.length > 0) { + if (oauthApps.length > 0) { issueAccessToken(userName, tokenReqDTO, oauthApps[0]); } else { if (log.isDebugEnabled()) { - log.debug("No Application Found for User: "+userName); + log.debug("No Application Found for User: " + userName); } } - } + } } catch (IdentityOAuthAdminException e) { log.error("Error while Fetching application details ", e); } finally { - endTenantFlow(threadLocalUsername, threadTenantDomain,tenantId); + endTenantFlow(threadLocalUsername, threadTenantDomain, tenantId); } return true; @@ -103,13 +102,13 @@ public boolean doPostUpdateCredential(String userName, Object credential, UserSt private void issueAccessToken(String userName, OAuth2AccessTokenReqDTO tokenReqDTO, OAuthConsumerAppDTO oauthapp) { - final String scope = DataHolder.getInstance().getApiManagerConfigurationService().getAPIManagerConfiguration().getFirstProperty(APIConstants. + final String scope = DataHolder.getInstance().getApiManagerConfigurationService().getAPIManagerConfiguration().getFirstProperty(APIConstants. APPLICATION_TOKEN_SCOPE); - final String[] applicationScope = new String[] {scope}; + final String[] applicationScope = new String[]{scope}; RequestParameter[] requestParameters = new RequestParameter[1]; - RequestParameter requestParameter = new RequestParameter(VALIDITY_PERIOD_KEY,VALIDITY_PERIOD_VALUE); + RequestParameter requestParameter = new RequestParameter(VALIDITY_PERIOD_KEY, VALIDITY_PERIOD_VALUE); tokenReqDTO.setClientId(oauthapp.getOauthConsumerKey()); tokenReqDTO.setClientSecret(oauthapp.getOauthConsumerSecret()); tokenReqDTO.setCallbackURI(oauthapp.getCallbackUrl()); @@ -119,9 +118,9 @@ private void issueAccessToken(String userName, OAuth2AccessTokenReqDTO tokenReqD if (log.isDebugEnabled()) { log.debug("Application Details Fetched Successfully \n" + - "Application name: "+ oauthapp.getApplicationName() + "\n" + - "Consumer_key: "+ oauthapp.getOauthConsumerKey() + "\n" + - "Consumer_secret: "+ oauthapp.getOauthConsumerSecret() + "Application name: " + oauthapp.getApplicationName() + "\n" + + "Consumer_key: " + oauthapp.getOauthConsumerKey() + "\n" + + "Consumer_secret: " + oauthapp.getOauthConsumerSecret() ); } @@ -130,8 +129,8 @@ private void issueAccessToken(String userName, OAuth2AccessTokenReqDTO tokenReqD tokenReqDTO.setRequestParameters(requestParameters); OAuth2Service service = (OAuth2Service) PrivilegedCarbonContext.getThreadLocalCarbonContext() .getOSGiService(OAuth2Service.class); - if(log.isDebugEnabled()) { - log.debug("Starting to issue AccessToken for User "+userName); + if (log.isDebugEnabled()) { + log.debug("Starting to issue AccessToken for User " + userName); } tokenReqDTO.setoAuthClientAuthnContext(getOAuthClientAuthnContext(oauthapp)); @@ -139,8 +138,8 @@ private void issueAccessToken(String userName, OAuth2AccessTokenReqDTO tokenReqD OAuth2AccessTokenRespDTO oAuth2AccessTokenRespDTO = service.issueAccessToken(tokenReqDTO); if (log.isDebugEnabled()) { - log.debug("Generated Access Token :" +oAuth2AccessTokenRespDTO.getAccessToken()); - } + log.debug("Generated Access Token :" + oAuth2AccessTokenRespDTO.getAccessToken()); + } } private OAuthClientAuthnContext getOAuthClientAuthnContext(OAuthConsumerAppDTO oauthapp) { @@ -166,6 +165,7 @@ private void startTenantFlow(String userName) { /** * Executing doPostUpdateCredential method for obtaining new access token + * * @param userName * @param credential * @param userStoreManager diff --git a/mbss-athenticator/components/com.wso2telco.password.validator/ReadMe.md b/mbss-athenticator/components/com.wso2telco.password.validator/ReadMe.md index 2974da6..ec15f62 100644 --- a/mbss-athenticator/components/com.wso2telco.password.validator/ReadMe.md +++ b/mbss-athenticator/components/com.wso2telco.password.validator/ReadMe.md @@ -1,15 +1,8 @@ -Patch Information: ------------ - -Patch ID : WSO2Telco-MIG-2.2.0-00106 -Applies To : wso2telcoids-2.2.0 -Associated JIRA : https://jira.wso2telco.com/jira/browse/MCSDDEV-173 - DESCRIPTION ----------- -This patch includes the fix to avoid entering username as part of the password field during signup process [API STORE] +This avoid entering username as part of the password field during signup process [API STORE] CONFIGURATIONS & INSTALLATION INSTRUCTIONS