You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Simon <si...@outlook.com> on 2016/02/05 11:51:33 UTC

Is instance based security possible?

>From my understanding OSGi security 

i.e. tow instance of the same class MyClass which is part of bundle MyBundle
share the same security conditions defined for bundle MyBundle. So if I have
the following:

[code]
MyClass a = new MyClass("dirA");
MyClass b = new MyClass("dirB"); 
[/code]

These two classes will share the same security permission when for example
using this:

[code]
ALLOW {
  [org.osgi.service.condpermadmin.BundleLocationCondition "MyBundle.jar"]
  ( java.io.FilePermission "dirA" "read,write" )
  ( java.io.FilePermission "dirB" "read,write" )
} "MyCheck"
[/code]

However what if I want to make sure that MyClass instance "A" never access
"dirB" and instance "B" never access "dirA".

Is there a way how this is possible without actually packaging MyClass in
two different bundles? (obviously using different symbolic names, etc for
each bundle)?



--
View this message in context: http://apache-felix.18485.x6.nabble.com/Is-instance-based-security-possible-tp5016405.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: is it possible to send a stop to a service running in a different bundle ?

Posted by ismail berrada <is...@yahoo.fr>.
 Hello
You can have a list of current bundles and theirs states from the BundleContextThen you can make any operation from your bundle.You can access the bundle context from the Activator class
 

    Le Mercredi 10 février 2016 16h20, Hubert Felber <Hu...@abacus.ch> a écrit :
 
 

 Hi,

I would like to send a stop to a service running in another bundle ?
Can this be done?

Explanation:

Service B in Bundle B has a dependency on Service A in Bundle A , so B
will  stop  a f t e r  service A stopped. Service A knows the service B
.
I want to stop service B as soon as service A reveceives a stop and  b
e f o r e  service A has finally stopped , not after.

Is there a way?

Thank you
Regards 
Hubert


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org



 
  

Re: is it possible to send a stop to a service running in a different bundle ?

Posted by Neil Bartlett <nj...@gmail.com>.
Services are not “stopped” because they are not threads, nor do they “run”.

You can unregister a service, and yes you can do this when another service you depend on goes away. The best way to do this is with Declarative Services, which can create a mandatory dependency as follows:

@Component // provides the “A” service
public class AImpl implements A {
    @Reference
    private B b;
}

This creates a mandatory reference from your A component to the B service. If the B service goes away, then your A component will be destroyed and the A service will be unregistered.

Regards,
Neil



> On 10 Feb 2016, at 15:19, Hubert Felber <Hu...@abacus.ch> wrote:
> 
> Hi,
> 
> I would like to send a stop to a service running in another bundle ?
> Can this be done?
> 
> Explanation:
> 
> Service B in Bundle B has a dependency on Service A in Bundle A , so B
> will  stop  a f t e r  service A stopped. Service A knows the service B
> .
> I want to stop service B as soon as service A reveceives a stop and  b
> e f o r e  service A has finally stopped , not after.
> 
> Is there a way?
> 
> Thank you
> Regards 
> Hubert
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


is it possible to send a stop to a service running in a different bundle ?

Posted by Hubert Felber <Hu...@abacus.ch>.
Hi,

I would like to send a stop to a service running in another bundle ?
Can this be done?

Explanation:

Service B in Bundle B has a dependency on Service A in Bundle A , so B
will  stop  a f t e r  service A stopped. Service A knows the service B
.
I want to stop service B as soon as service A reveceives a stop and  b
e f o r e  service A has finally stopped , not after.

Is there a way?

Thank you
Regards 
Hubert


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Is instance based security possible?

Posted by Karl Pauls <ka...@gmail.com>.
Out of the box, no - I don't think this is possible.

You might be able to make something work but it would depend a lot on your
specific set-up and you'd need to be able to make the instances cooperate
somehow (i.e., a generic solution probably is not possible - the only thing
you might get to work generically is to make it based on Threads an follow
a JAAS like approach but it doesn't sound like this is what you are looking
for).

regards,

Karl

On Fri, Feb 5, 2016 at 11:51 AM, Simon <si...@outlook.com> wrote:

> From my understanding OSGi security
>
> i.e. tow instance of the same class MyClass which is part of bundle
> MyBundle
> share the same security conditions defined for bundle MyBundle. So if I
> have
> the following:
>
> [code]
> MyClass a = new MyClass("dirA");
> MyClass b = new MyClass("dirB");
> [/code]
>
> These two classes will share the same security permission when for example
> using this:
>
> [code]
> ALLOW {
>   [org.osgi.service.condpermadmin.BundleLocationCondition "MyBundle.jar"]
>   ( java.io.FilePermission "dirA" "read,write" )
>   ( java.io.FilePermission "dirB" "read,write" )
> } "MyCheck"
> [/code]
>
> However what if I want to make sure that MyClass instance "A" never access
> "dirB" and instance "B" never access "dirA".
>
> Is there a way how this is possible without actually packaging MyClass in
> two different bundles? (obviously using different symbolic names, etc for
> each bundle)?
>
>
>
> --
> View this message in context:
> http://apache-felix.18485.x6.nabble.com/Is-instance-based-security-possible-tp5016405.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Karl Pauls
karlpauls@gmail.com