wso2 / product-apim

Welcome to the WSO2 API Manager source code! For info on working with the WSO2 API Manager repository and contributing code, click the link below.
http://wso2.github.io/
Apache License 2.0
858 stars 789 forks source link

Space validation for the application name unnecessarily while trying to change the ownership of application in admin portal #5446

Closed riyazathali closed 5 years ago

riyazathali commented 5 years ago

Description It is possible to add applications in the store with spaces in the name and there is no space validation for the application name. But, while changing the owner of an application with spaces in the name in the Admin Portal it does not allow and alerts "Name contains spaces". There is a validation to check the space in the name unnecessarily. While testing the same thing in an application without spaces in the name, it works perfectly to transfer the ownership.

Affected Product Version: APIM 2.6.0 (WUM Stamp 1566994984329)

Also the same result in the below version as well. APIM 2.5.0 (WUM Stamp 1559819540351)

Steps to reproduce:

  1. Sign Up two users in APIM store
  2. Add an Application with space by one user (like "Test App")
  3. Sign in to the WSO2 API-M Admin Portal with the same user.
  4. Click Applications under Settings.
  5. Search for the application that was created by the same user with spaces in the name (i.e Test App)and click Edit.
  6. Try to update the Owner field with the second user's username
malinthaprasan commented 5 years ago

Looks like we can create apps with spaces in React Store but failing when doing key generation.

[2019-09-04 09:52:19,746]  INFO - CarbonAuthenticationUtil 'admin@carbon.super [-1234]' logged in at [2019-09-04 09:52:19,746+0530]
[2019-09-04 09:52:19,754] ERROR - APIUtil Error occurred while creating ServiceProvider for app admin_app1 qwe_PRODUCTION
org.wso2.carbon.identity.application.common.IdentityApplicationManagementException: The Application name admin_app1 qwe_PRODUCTION is not valid! It is not adhering to the regex ^[a-zA-Z0-9._-]*$
    at org.wso2.carbon.identity.application.mgt.ApplicationManagementServiceImpl.doAddApplication(ApplicationManagementServiceImpl.java:1679) ~[org.wso2.carbon.identity.application.mgt_5.14.15.jar:?]
    at org.wso2.carbon.identity.application.mgt.ApplicationManagementServiceImpl.createApplicationWithTemplate(ApplicationManagementServiceImpl.java:172) ~[org.wso2.carbon.identity.application.mgt_5.14.15.jar:?]
    at org.wso2.carbon.identity.application.mgt.ApplicationManagementServiceImpl.createApplication(ApplicationManagementServiceImpl.java:150) ~[org.wso2.carbon.identity.application.mgt_5.14.15.jar:?]
    at org.wso2.carbon.apimgt.keymgt.service.APIKeyMgtSubscriberService.createOAuthApplicationByApplicationInfo_aroundBody0(APIKeyMgtSubscriberService.java:159) [org.wso2.carbon.apimgt.keymgt_6.5.74.SNAPSHOT.jar:?]
    at org.wso2.carbon.apimgt.keymgt.service.APIKeyMgtSubscriberService.createOAuthApplicationByApplicationInfo(APIKeyMgtSubscriberService.java:107) [org.wso2.carbon.apimgt.keymgt_6.5.74.SNAPSHOT.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_211]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_211]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_211]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_211]
    at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212) [axis2_1.6.1.wso2v37.jar:?]
    at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117) [axis2_1.6.1.wso2v37.jar:?]
    at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40) [axis2_1.6.1.wso2v37.jar:?]
    at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110) [axis2_1.6.1.wso2v37.jar:?]
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) [axis2_1.6.1.wso2v37.jar:?]
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:173) [axis2_1.6.1.wso2v37.jar:?]
    at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:148) [axis2_1.6.1.wso2v37.jar:?]