*Jayanga Kaushalya* Software Engineer Mobile: +94777860160 WSO2 Inc. | http://wso2.com lean.enterprise.middleware
On Wed, Jul 27, 2016 at 10:10 PM, Rasika Perera <[email protected]> wrote: > Hi Jayanga and All, > >> >> Thanks for the clarification. Would that mean foo-connector.yml will define >> the connector type configuration and store-config.yml will > be referred foo-connector for different store-connector instances ? Or are we > repeating same configuration on both files? > > Yes, you need to refer connectors that you need to use, in the store-config.yml (As a comma separated list). You can define connector specific configurations in the specific foo-connector.yml or in the store-config.yml. No need to repeat in both locations. > I am using following versions > carbon.security.caas.version: 1.0.0-m2 > and c > arbon.security.userstore.jdbc.version: 1.0.0-m2 > . > And jdbc-connector.yml contains this > (just uncommented defaults) > ; > > name: "jdbc-store-connector" > dataSource: "jdbc/WSO2CARBON_DB" > > If both CAAS and the userstore.jdbc are in the m2 version, then no need to un-comment those configurations. m2 version is defaulted to use the JDBC connector so the relevant configurations will be available in the store-config.yml. Please comment those configurations and use. If you need to use connector specific configurations, then please use the latest format [1] that is available. > Thanks, > Rasika > > [1] https://github.com/wso2-extensions/carbon-security-user-store-jdbc/blob/master/feature/resources/conf/jdbc-authorization-connector.yml Thanks! > > On Wed, Jul 27, 2016 at 6:11 PM, Jayanga Kaushalya <[email protected]> > wrote: > >> [Adding Sameera, Darshana] >> >> On Wed, Jul 27, 2016 at 3:58 PM, Rasika Perera <[email protected]> wrote: >> >>> [Adding Niranjan, Sumedha, Manu] >>> >>> Hi Jayanga, >>> >>> When the user-store connector[1] feature is added carbon-security >>> component is activated. It is true that Carbon-Security component will not >>> up until it satisfy all connectors dependencies. But IMO we need to provide >>> intuitive error message when at least one connector is not provided >>> (definitely bundlecontext is null is not the correct error message). >>> Implementation should demand it, rather than docs. And if you need all >>> connectors to up before your Carbon-Security-Component; try >>> Startup-Order-Resolver which is used in MSF4J (There's a blog[2] on this by >>> Sameera). >>> >> >> There can be multiple connectors available for the CAAS at the run time >> but it should only wait for the connectors that are specified in the >> store-config.yml. Currently there is no feature in the startup resolver to >> specifically wait until the dynamically given component is up. This feature >> will be added into the startup resolver in future. Until that, we will add >> startup resolver to wait until all of the required components to be active >> and it will give a proper warning if there are missing components. >> >>> >>> When turning on default configuration on "jdbc-connector.yml". Now I am >>> getting this error; >>> >>> [2016-07-27 15:47:01,178] ERROR >>> {org.wso2.carbon.security.caas.internal.CarbonSecurityComponent} - Cannot >>> create property=dataSource for >>> JavaBean=org.wso2.carbon.security.caas.internal.config.StoreConnectorConfigEntry@12a09b44 >>> in 'reader', line 16, column 1: >>> name: "jdbc-store-connector" >>> ^ >>> Unable to find property 'dataSource' on class: >>> org.wso2.carbon.security.caas.internal.config.StoreConnectorConfigEntry >>> in 'reader', line 17, column 13: >>> dataSource: "jdbc/WSO2CARBON_DB" >>> ^ >>> Cannot create property=dataSource for >>> JavaBean=org.wso2.carbon.security.caas.internal.config.StoreConnectorConfigEntry@12a09b44 >>> in 'reader', line 16, column 1: >>> name: "jdbc-store-connector" >>> ^ >>> Unable to find property 'dataSource' on class: >>> org.wso2.carbon.security.caas.internal.config.StoreConnectorConfigEntry >>> in 'reader', line 17, column 13: >>> dataSource: "jdbc/WSO2CARBON_DB" >>> >>> Seems like configuration elements are not matched with the mapped >>> object. What should be the correct configuration and any docs?i >>> >> >> What carbon-security-user-store-jdbc version are you using ? Please use >> the configurations that are used in the latest version. >> >>> >>> When debugging this issue I also came across that carbon-security is >>> owning configuration files space of "*-connector.yml" in [3]. Why do we >>> need to introduce a new config file for each connector? Can't we use >>> "connectors.yml" which will contains all connector configurations? >>> >> >> There are two ways to specify connectors related to the carbon security. >> One method is to specify all of the connector details in the main >> store-config.yml [1] and the other way is to specify them in a separate >> configuration file for each connector. Reason for using a single >> configuration file for each connector is that there can be multiple >> connectors from the same type and there are future requirements where there >> can be configurations that are specific to each connector. this will make >> using a single file little bit messy. Connectors are extensions for the >> CAAS and having the configuration file with the extension will make it is >> to pack with. >> >>> >>> Thanks, >>> Rasika >>> >>> [1] https://github.com/wso2-extensions/carbon-security-user-store-jdbc >>> [2] >>> https://medium.com/@sameera.jayasoma/resolving-startup-order-of-carbon-components-in-wso2-carbon-5-0-0-497fe3287e67#.uvmrvsl28 >>> [3] >>> https://github.com/wso2/carbon-security/blob/master/components/org.wso2.carbon.security.caas/src/main/java/org/wso2/carbon/security/caas/internal/config/StoreConfigBuilder.java#L286 >>> >>> [1] >> https://github.com/wso2/carbon-security/blob/v1.0.0-m2/feature/resources/conf/store-config.yml >> >> >> Thanks! >> >>> >>> On Wed, Jul 27, 2016 at 12:48 PM, Jayanga Kaushalya <[email protected]> >>> wrote: >>> >>>> Hi Rasika, >>>> >>>> Is there any active connectors available for user stores? There should >>>> be at least a single connector present for each store to activate the >>>> carbon security successfully. >>>> >>>> Thanks! >>>> >>>> *Jayanga Kaushalya* >>>> Software Engineer >>>> Mobile: +94777860160 >>>> WSO2 Inc. | http://wso2.com >>>> lean.enterprise.middleware >>>> >>>> On Tue, Jul 26, 2016 at 11:04 PM, Rasika Perera <[email protected]> >>>> wrote: >>>> >>>>> Hi Thanuja, >>>>> >>>>> This issue got resolved by updating version into 1.0.0-m2. Now I am >>>>> getting BundleContext is null exception. >>>>> >>>>> java.lang.IllegalStateException: BundleContext is null. >>>>>> at >>>>>> org.wso2.carbon.security.caas.internal.CarbonSecurityDataHolder.getBundleContext(CarbonSecurityDataHolder.java:125) >>>>>> at >>>>>> org.wso2.carbon.security.caas.api.util.CarbonSecurityUtils.getCallbackHandlers(CarbonSecurityUtils.java:39) >>>>>> at >>>>>> org.wso2.carbon.security.caas.api.ProxyCallbackHandler.handle(ProxyCallbackHandler.java:65) >>>>>> at >>>>>> javax.security.auth.login.LoginContext$SecureCallbackHandler$1.run(LoginContext.java:939) >>>>>> at >>>>>> javax.security.auth.login.LoginContext$SecureCallbackHandler$1.run(LoginContext.java:936) >>>>>> at java.security.AccessController.doPrivileged(Native Method) >>>>>> at >>>>>> javax.security.auth.login.LoginContext$SecureCallbackHandler.handle(LoginContext.java:936) >>>>>> at >>>>>> org.wso2.carbon.security.caas.api.module.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:103) >>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at >>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) >>>>>> at >>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) >>>>>> at java.lang.reflect.Method.invoke(Method.java:497) >>>>>> at >>>>>> javax.security.auth.login.LoginContext.invoke(LoginContext.java:755) >>>>>> at >>>>>> javax.security.auth.login.LoginContext.access$000(LoginContext.java:195) >>>>>> at >>>>>> javax.security.auth.login.LoginContext$4.run(LoginContext.java:682) >>>>>> at >>>>>> javax.security.auth.login.LoginContext$4.run(LoginContext.java:680) >>>>>> at java.security.AccessController.doPrivileged(Native Method) >>>>>> at >>>>>> javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680) >>>>>> at >>>>>> javax.security.auth.login.LoginContext.login(LoginContext.java:587) >>>>>> at >>>>>> org.wso2.carbon.uuf.sample.simpleauth.bundle.SimpleAuthHandler.authenticateByCaas(SimpleAuthHandler.java:60) >>>>> >>>>> >>>>> When debugging found that CarbonSecurityComponent's @Activate >>>>> method[1] is not invoked by OSGi. Then checked bundles on osgi console, >>>>> both fragment and bundle is Active. >>>>> >>>>> 79|Active | 4|org.wso2.carbon.security.caas (1.0.0.m2) >>>>>> 80|Resolved | 1|org.wso2.carbon.security.caas.boot (1.0.0.m2) >>>>> >>>>> >>>>> Any thoughts on resolving this issue? >>>>> >>>>> [1] >>>>> https://github.com/wso2/carbon-security/blob/release-1.0.0-m2/components/org.wso2.carbon.security.caas/src/main/java/org/wso2/carbon/security/caas/internal/CarbonSecurityComponent.java#L80 >>>>> >>>>> On Tue, Jul 26, 2016 at 6:18 PM, Thanuja Jayasinghe <[email protected]> >>>>> wrote: >>>>> >>>>>> Hi Rasika, >>>>>> >>>>>> This issue happens when 'carbon-security-caas' module does not >>>>>> activate properly. Can you debug the code [1], and check whether activate >>>>>> method is getting called. >>>>>> >>>>>> [1] - >>>>>> https://github.com/wso2/carbon-security/blob/master/components/org.wso2.carbon.security.caas/src/main/java/org/wso2/carbon/security/caas/internal/CarbonSecurityComponent.java#L80 >>>>>> >>>>>> Thanks, >>>>>> >>>>>> On Mon, Jul 25, 2016 at 7:09 PM, Rasika Perera <[email protected]> >>>>>> wrote: >>>>>> >>>>>>> Hi All, >>>>>>> >>>>>>> I am trying to invoke basic authentication with CAAS. I have >>>>>>> installed "org.wso2.carbon.security.caas.feature" and imported following >>>>>>> packages; >>>>>>> >>>>>>> org.wso2.carbon.security.caas.api.*, >>>>>>> org.wso2.carbon.kernel.context, >>>>>>> org.wso2.carbon.messaging >>>>>>> >>>>>>> Further I have added config location into the startup script; >>>>>>> >>>>>>> -Djava.security.auth.login.config="$CARBON_HOME/conf/security/carbon-jaas.config"\ >>>>>>> >>>>>>> My code snippet is as below (based on JAAS sample[1]); >>>>>>> >>>>>>> PrivilegedCarbonContext.destroyCurrentContext(); >>>>>>> CarbonMessage carbonMessage = new DefaultCarbonMessage(); >>>>>>> carbonMessage.setHeader("Authorization", "Basic " + Base64.getEncoder() >>>>>>> .encodeToString("admin:admin".getBytes()) >>>>>>> ); >>>>>>> >>>>>>> ProxyCallbackHandler callbackHandler = new >>>>>>> ProxyCallbackHandler(carbonMessage); >>>>>>> LoginContext loginContext = new LoginContext("CarbonSecurityConfig", >>>>>>> callbackHandler); >>>>>>> loginContext.login(); >>>>>>> >>>>>>> I am getting following error at the line "loginContext.login()"; >>>>>>> >>>>>>> Caused by: javax.security.auth.login.LoginException: unable to find >>>>>>> LoginModule class: >>>>>>> org.wso2.carbon.security.caas.api.module.UsernamePasswordLoginModule >>>>>>> at >>>>>>> javax.security.auth.login.LoginContext.invoke(LoginContext.java:794) >>>>>>> at >>>>>>> javax.security.auth.login.LoginContext.access$000(LoginContext.java:195) >>>>>>> at >>>>>>> javax.security.auth.login.LoginContext$4.run(LoginContext.java:682) >>>>>>> at >>>>>>> javax.security.auth.login.LoginContext$4.run(LoginContext.java:680) >>>>>>> at java.security.AccessController.doPrivileged(Native Method) >>>>>>> at >>>>>>> javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680) >>>>>>> at >>>>>>> javax.security.auth.login.LoginContext.login(LoginContext.java:587) >>>>>>> at >>>>>>> org.wso2.carbon.uuf.sample.simpleauth.bundle.SimpleAuthHandler.authenticate(SimpleAuthHandler.java:45) >>>>>>> >>>>>>> Further I have found this occurs when LoginContext is trying load >>>>>>> the class "UsernamePasswordLoginModule" using Bootstrap class >>>>>>> loader. >>>>>>> >>>>>>> Any thoughts on how to fix this issue? >>>>>>> >>>>>>> [1] >>>>>>> https://github.com/wso2/carbon-security/blob/master/tests/osgi-tests/src/test/java/org/wso2/carbon/security/caas/test/osgi/JAASTests.java >>>>>>> -- >>>>>>> With Regards, >>>>>>> >>>>>>> *Rasika Perera* >>>>>>> Software Engineer >>>>>>> LinkedIn: http://lk.linkedin.com/in/rasika90 >>>>>>> >>>>>>> [image: wso2-signature-general.png] <https://wso2.com/signature> >>>>>>> >>>>>>> WSO2 Inc. www.wso2.com >>>>>>> lean.enterprise.middleware >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> *Thanuja Lakmal* >>>>>> Senior Software Engineer >>>>>> WSO2 Inc. http://wso2.com/ >>>>>> *lean.enterprise.middleware* >>>>>> Mobile: +94715979891 +94758009992 >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> With Regards, >>>>> >>>>> *Rasika Perera* >>>>> Software Engineer >>>>> LinkedIn: http://lk.linkedin.com/in/rasika90 >>>>> >>>>> [image: wso2-signature-general.png] <https://wso2.com/signature> >>>>> >>>>> WSO2 Inc. www.wso2.com >>>>> lean.enterprise.middleware >>>>> >>>>> _______________________________________________ >>>>> Dev mailing list >>>>> [email protected] >>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>> >>>>> >>>> >>> >>> >>> -- >>> With Regards, >>> >>> *Rasika Perera* >>> Software Engineer >>> LinkedIn: http://lk.linkedin.com/in/rasika90 >>> >>> [image: wso2-signature-general.png] <https://wso2.com/signature> >>> >>> WSO2 Inc. www.wso2.com >>> lean.enterprise.middleware >>> >> >> > > > -- > With Regards, > > *Rasika Perera* > Software Engineer > LinkedIn: http://lk.linkedin.com/in/rasika90 > > [image: wso2-signature-general.png] <https://wso2.com/signature> > > WSO2 Inc. www.wso2.com > lean.enterprise.middleware >
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
