You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by metatech <me...@gmail.com> on 2011/07/08 14:36:35 UTC

Re: Configuration of Authorizationt through JAAS

Jean-Baptiste Onofré <jb...@...> writes:

> 
> Hi,
> 
> By default, ServiceMix 3 load the login modules defined in 
> etc/login.properties.
> 

In ServiceMix 4.x, this configuration does not work, the file
"etc/login.properties" does not exist anymore.
You will get the following error : 

Caused by: javax.security.auth.login.LoginException: No LoginModules 
configured for servicemix-domain
	at javax.security.auth.login.LoginContext.
init(LoginContext.java:256)
	at javax.security.auth.login.LoginContext.
<init>(LoginContext.java:367)
	at javax.security.auth.login.LoginContext.
<init>(LoginContext.java:444)
	at
org.apache.servicemix.nmr.core.security.JaasAuthenticationService.
authenticate(JaasAuthenticationService.java:50)

The Java system property "java.security.auth.login.config" does not have any
effect because the configuration is implemented in
org.apache.karaf.jaas.config.impl.OsgiConfiguration

Solution : you need to add your realm in the file
OSGI-INF/blueprint/karaf-jaas-module.xml within the archive
$SERVICEMIX_HOME/system/org/apache/karaf/jaas/org.apache.karaf.jaas.modules/
2.1.3/org.apache.karaf.jaas.modules-2.1.3.jar,
maybe also do a rm -r $SERVICE_HOME/data/cache, and restart ServiceMix.





Re: Configuration of Authorizationt through JAAS

Posted by Freeman Fang <fr...@gmail.com>.
On 2011-7-13, at 下午7:14, metatech wrote:

> Thanks Freeman.
>
> The URL you gave is unavailable for the moment... (but Google Cache  
> has it).
>
> I followed the instructions to create the realm "servicemix-domain"   
> but I
> first had an error (see below).
>
> It worked after adding the two Java packages in my META-INF/MANIFEST :
> Import-Package: .....
> org.apache.karaf.jaas.modules.properties,org.apache.karaf.jaas.modules
>
> Is there any reason why the built-in realm "servicemix-domain" is not
> defined "out-of-the-box" ?
Hi,

This is actually the way how OSGi works, if your bundle need use some  
java class, you need explicitly import the package. But you needn't  
manually edit the  META-INF/MANIFEST yourself, you can configure it  
through maven-bundle-plugin in your bundle's pom.xml, the maven-bundle- 
plugin can take care of the OSGi metadate header in META-INF/MANIFEST .


Freeman
>
> Thanks,
>
> metatech
>
> =====
> Caused by: javax.security.auth.login.LoginException:
> java.lang.IllegalStateException: Can not load or create login module
> org.apache.karaf.jaas.modules.properties.PropertiesLoginModule for  
> bundle
> 209
> 	at
> org 
> .apache 
> .karaf.jaas.boot.ProxyLoginModule.initialize(ProxyLoginModule.java:74)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun 
> .reflect 
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at
> sun 
> .reflect 
> .DelegatingMethodAccessorImpl 
> .invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at javax.security.auth.login.LoginContext.invoke(LoginContext.java: 
> 756)
> 	at javax.security.auth.login.LoginContext.access 
> $000(LoginContext.java:186)
> 	at javax.security.auth.login.LoginContext$4.run(LoginContext.java: 
> 683)
> 	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: 
> 579)
> 	at
> org 
> .apache 
> .servicemix 
> .nmr 
> .core 
> .security 
> .JaasAuthenticationService 
> .authenticate(JaasAuthenticationService.java:65)
>
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Configuration-of-Authorizationt-through-JAAS-tp2839212p4582308.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com










Re: Configuration of Authorizationt through JAAS

Posted by metatech <me...@gmail.com>.
Thanks Freeman.

The URL you gave is unavailable for the moment... (but Google Cache has it).

I followed the instructions to create the realm "servicemix-domain"  but I
first had an error (see below).

It worked after adding the two Java packages in my META-INF/MANIFEST :
Import-Package: .....
org.apache.karaf.jaas.modules.properties,org.apache.karaf.jaas.modules

Is there any reason why the built-in realm "servicemix-domain" is not
defined "out-of-the-box" ?

Thanks,

metatech

=====
Caused by: javax.security.auth.login.LoginException:
java.lang.IllegalStateException: Can not load or create login module
org.apache.karaf.jaas.modules.properties.PropertiesLoginModule for bundle
209
	at
org.apache.karaf.jaas.boot.ProxyLoginModule.initialize(ProxyLoginModule.java:74)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at javax.security.auth.login.LoginContext.invoke(LoginContext.java:756)
	at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
	at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
	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:579)
	at
org.apache.servicemix.nmr.core.security.JaasAuthenticationService.authenticate(JaasAuthenticationService.java:65)




--
View this message in context: http://servicemix.396122.n5.nabble.com/Configuration-of-Authorizationt-through-JAAS-tp2839212p4582308.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Configuration of Authorizationt through JAAS

Posted by Freeman Fang <fr...@gmail.com>.
On 2011-7-8, at 下午8:36, metatech wrote:

> Jean-Baptiste Onofré <jb...@...> writes:
>
>>
>> Hi,
>>
>> By default, ServiceMix 3 load the login modules defined in
>> etc/login.properties.
>>
>
> In ServiceMix 4.x, this configuration does not work, the file
> "etc/login.properties" does not exist anymore.
> You will get the following error :
>
> Caused by: javax.security.auth.login.LoginException: No LoginModules
> configured for servicemix-domain
> 	at javax.security.auth.login.LoginContext.
> init(LoginContext.java:256)
> 	at javax.security.auth.login.LoginContext.
> <init>(LoginContext.java:367)
> 	at javax.security.auth.login.LoginContext.
> <init>(LoginContext.java:444)
> 	at
> org.apache.servicemix.nmr.core.security.JaasAuthenticationService.
> authenticate(JaasAuthenticationService.java:50)
>
> The Java system property "java.security.auth.login.config" does not  
> have any
> effect because the configuration is implemented in
> org.apache.karaf.jaas.config.impl.OsgiConfiguration
>
> Solution : you need to add your realm in the file
> OSGI-INF/blueprint/karaf-jaas-module.xml within the archive
> $SERVICEMIX_HOME/system/org/apache/karaf/jaas/ 
> org.apache.karaf.jaas.modules/
> 2.1.3/org.apache.karaf.jaas.modules-2.1.3.jar,
> maybe also do a rm -r $SERVICE_HOME/data/cache, and restart  
> ServiceMix.
>

Take a look at [1], I don't think you have to hack the  
org.apache.karaf.jaas.modules to add the realm.

[1]http://karaf.apache.org/manual/2.2.3-SNAPSHOT/developers-guide/security-framework.html

Freeman
>
>
>

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com