Hi, When I tried the recommended approach I encountered this issue [1]. Hence I will be directly calling Soap admin services inside my implementation to proceed with the task.
[1] https://wso2.org/jira/browse/IDENTITY-6860 Thanks, Ushani On Sat, Nov 4, 2017 at 12:05 AM, Ushani Balasooriya <[email protected]> wrote: > Thanks Mushtaq. I will try this. > > On Fri, Nov 3, 2017 at 11:38 PM, Mushthaq Rumy <[email protected]> wrote: > >> Hi Ushani, >> >> AFAIK you can pass null values to initiate a configurationContext as >> shown in [1]. Something like below would do. >> >> configContext = ConfigurationContextFactory.cr >> eateConfigurationContextFromFileSystem(null, null); >> >> And alternatively you can also try this way. >> >> String endPoint = SERVER_URL + "RemoteUserStoreManagerService"; >> RemoteUserStoreManagerServiceStub remoteUserStoreManagerServiceStub = >> new RemoteUserStoreManagerServiceStub(endPoint); >> AuthenticateStub.authenticateStub(userName, password, >> remoteUserStoreManagerServiceStub); >> >> remoteUserStoreManagerServiceStub.addRole(roleName, null, null); >> >> I hope this helps. >> >> [1] - http://shazninazeer.blogspot.com/2014/10/creating-roles-and- >> assigning.html >> >> Thanks & Regards, >> Mushthaq >> >> On Fri, Nov 3, 2017 at 4:33 PM, Ushani Balasooriya <[email protected]> >> wrote: >> >>> Hi, >>> >>> I am going to implement a third party web application for Users and >>> roles creation. >>> >>> Below are the steps I carried out. >>> >>> 1. I have taken the same travelocity web app and customizing it adding a >>> form submission in the home which which loads after the login. >>> 2. I have my jsp form with the correct servlet mapping. >>> 3. In My method, I am trying to add a user role by referring the example >>> given in this doc [1] >>> >>> [1] https://docs.wso2.com/display/IS520/Managing+Users+and+R >>> oles+with+APIs >>> >>> My Question is, >>> >>> Without using the below approach to create a >>> *ConfigurationContextFactory* and authenticating the logged in user, >>> what is the correct way to proceed with my implementation? Since this is >>> looking for the given client.axis2.xml. >>> >>> try { >>> configContext = ConfigurationContextFactory.cr >>> eateConfigurationContextFromFileSystem( >>> "repo", "repo/conf/client.axis2.xml"); >>> authstub = new AuthenticationAdminStub(configContext, SERVER_URL >>> + "AuthenticationAdmin"); >>> >>> // Authenticates as a user having rights to add users. >>> if (authstub.login("admin", "admin", null)) { >>> cookie = (String) authstub._getServiceClient().g >>> etServiceContext().getProperty( >>> HTTPConstants.COOKIE_STRING); >>> >>> >>> In order to call the addRole method in UserStoreManager class, I need to >>> set correct value to the *realm*. Please correct me if my understanding >>> is wrong since I am not much familiar with this. Appreciate your advice. >>> >>> *UserRealm realm = WSRealmBuilder.createWSRealm(SERVER_URL, cookie, >>> configContext); * >>> * UserStoreManager storeManager = realm.getUserStoreManager(); * >>> >>> Thanks, >>> -- >>> *Ushani Balasooriya* >>> Associate Technical Lead - EE; >>> WSO2 Inc; http://www.wso2.com/. >>> Mobile; +94772636796 >>> >>> >>> _______________________________________________ >>> Dev mailing list >>> [email protected] >>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>> >>> >> >> >> -- >> Mushthaq Rumy >> *Software Engineer* >> Mobile : +94 (0) 779 492140 <%2B94%20%280%29%20773%20451194> >> Email : [email protected] >> WSO2, Inc.; http://wso2.com/ >> lean . enterprise . middleware. >> >> <http://wso2.com/signature> >> > > > > -- > *Ushani Balasooriya* > Associate Technical Lead - EE; > WSO2 Inc; http://www.wso2.com/. > Mobile; +94772636796 > > -- *Ushani Balasooriya* Associate Technical Lead - EE; WSO2 Inc; http://www.wso2.com/. Mobile; +94772636796
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
