You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Karl Pauls (JIRA)" <ji...@apache.org> on 2008/08/01 14:00:32 UTC

[jira] Created: (FELIX-654) Subject.doAs not supported

Subject.doAs not supported
--------------------------

                 Key: FELIX-654
                 URL: https://issues.apache.org/jira/browse/FELIX-654
             Project: Felix
          Issue Type: Bug
          Components: Framework
    Affects Versions: felix-1.0.4
            Reporter: Karl Pauls
            Assignee: Karl Pauls
             Fix For: felix-1.0.5


Subject.doAs allows to perform work as a particular Subject. It first retrieves the current Thread's AccessControlContext via AccessController.getContext, and then instantiates a new AccessControlContext using the retrieved context along with a new SubjectDomainCombiner (constructed using the provided Subject). Finally, this method invokes AccessController.doPrivileged, passing it the provided PrivilegedAction, as well as the newly constructed AccessControlContext. 

The issue is that the SubjectDomainCombiner does update the relevant ProtectionDomains with the Principals from the Subject associated with this SubjectDomainCombiner by creating a new ProtectionDomain instance for each ProtectionDomain in the currentDomains array. Each new ProtectionDomain instance is created using the CodeSource, Permissions and ClassLoader from the corresponding ProtectionDomain in currentDomains, as well as with the Principals from the Subject associated with this SubjectDomainCombiner. 

This doesn't work well with the OSGi spec due to the fact that each bundle (or revision to be precise) has its own custom ProtectionDomain which is lost when Subject.doAs is used. There is a way to make it work for most scenarios namely, make the custom ProtectionDomain return a speciall PermissionCollection because that is reused by the ProtectionDomain created by the SubjectDomainCombiner if no custom policy is installed (in the later case a different workaround would be needed). 

Currently, Felix doesn't work when Subject.doAs is used and security is enabled. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (FELIX-654) Subject.doAs not supported

Posted by "Karl Pauls (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-654?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Karl Pauls closed FELIX-654.
----------------------------


The reporter of the issue did test it and it seems to work. 

> Subject.doAs not supported
> --------------------------
>
>                 Key: FELIX-654
>                 URL: https://issues.apache.org/jira/browse/FELIX-654
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: felix-1.0.4
>            Reporter: Karl Pauls
>            Assignee: Karl Pauls
>             Fix For: felix-1.2.0
>
>
> Subject.doAs allows to perform work as a particular Subject. It first retrieves the current Thread's AccessControlContext via AccessController.getContext, and then instantiates a new AccessControlContext using the retrieved context along with a new SubjectDomainCombiner (constructed using the provided Subject). Finally, this method invokes AccessController.doPrivileged, passing it the provided PrivilegedAction, as well as the newly constructed AccessControlContext. 
> The issue is that the SubjectDomainCombiner does update the relevant ProtectionDomains with the Principals from the Subject associated with this SubjectDomainCombiner by creating a new ProtectionDomain instance for each ProtectionDomain in the currentDomains array. Each new ProtectionDomain instance is created using the CodeSource, Permissions and ClassLoader from the corresponding ProtectionDomain in currentDomains, as well as with the Principals from the Subject associated with this SubjectDomainCombiner. 
> This doesn't work well with the OSGi spec due to the fact that each bundle (or revision to be precise) has its own custom ProtectionDomain which is lost when Subject.doAs is used. There is a way to make it work for most scenarios namely, make the custom ProtectionDomain return a speciall PermissionCollection because that is reused by the ProtectionDomain created by the SubjectDomainCombiner if no custom policy is installed (in the later case a different workaround would be needed). 
> Currently, Felix doesn't work when Subject.doAs is used and security is enabled. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-654) Subject.doAs not supported

Posted by "Karl Pauls (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-654?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12620298#action_12620298 ] 

Karl Pauls commented on FELIX-654:
----------------------------------

As of revision 683310 Subjec.doAs is working based on the java security policy installed. I need more time to think about a better solution -- hence, will not resolve the issue for now. However, this workaround should make it possible to use felix when security is enabled and subject.doAs is used. 

> Subject.doAs not supported
> --------------------------
>
>                 Key: FELIX-654
>                 URL: https://issues.apache.org/jira/browse/FELIX-654
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: felix-1.0.4
>            Reporter: Karl Pauls
>            Assignee: Karl Pauls
>             Fix For: felix-1.2.0
>
>
> Subject.doAs allows to perform work as a particular Subject. It first retrieves the current Thread's AccessControlContext via AccessController.getContext, and then instantiates a new AccessControlContext using the retrieved context along with a new SubjectDomainCombiner (constructed using the provided Subject). Finally, this method invokes AccessController.doPrivileged, passing it the provided PrivilegedAction, as well as the newly constructed AccessControlContext. 
> The issue is that the SubjectDomainCombiner does update the relevant ProtectionDomains with the Principals from the Subject associated with this SubjectDomainCombiner by creating a new ProtectionDomain instance for each ProtectionDomain in the currentDomains array. Each new ProtectionDomain instance is created using the CodeSource, Permissions and ClassLoader from the corresponding ProtectionDomain in currentDomains, as well as with the Principals from the Subject associated with this SubjectDomainCombiner. 
> This doesn't work well with the OSGi spec due to the fact that each bundle (or revision to be precise) has its own custom ProtectionDomain which is lost when Subject.doAs is used. There is a way to make it work for most scenarios namely, make the custom ProtectionDomain return a speciall PermissionCollection because that is reused by the ProtectionDomain created by the SubjectDomainCombiner if no custom policy is installed (in the later case a different workaround would be needed). 
> Currently, Felix doesn't work when Subject.doAs is used and security is enabled. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-654) Subject.doAs not supported

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-654?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard S. Hall updated FELIX-654:
----------------------------------

    Fix Version/s:     (was: felix-1.0.5)
                   felix-1.2.0

> Subject.doAs not supported
> --------------------------
>
>                 Key: FELIX-654
>                 URL: https://issues.apache.org/jira/browse/FELIX-654
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: felix-1.0.4
>            Reporter: Karl Pauls
>            Assignee: Karl Pauls
>             Fix For: felix-1.2.0
>
>
> Subject.doAs allows to perform work as a particular Subject. It first retrieves the current Thread's AccessControlContext via AccessController.getContext, and then instantiates a new AccessControlContext using the retrieved context along with a new SubjectDomainCombiner (constructed using the provided Subject). Finally, this method invokes AccessController.doPrivileged, passing it the provided PrivilegedAction, as well as the newly constructed AccessControlContext. 
> The issue is that the SubjectDomainCombiner does update the relevant ProtectionDomains with the Principals from the Subject associated with this SubjectDomainCombiner by creating a new ProtectionDomain instance for each ProtectionDomain in the currentDomains array. Each new ProtectionDomain instance is created using the CodeSource, Permissions and ClassLoader from the corresponding ProtectionDomain in currentDomains, as well as with the Principals from the Subject associated with this SubjectDomainCombiner. 
> This doesn't work well with the OSGi spec due to the fact that each bundle (or revision to be precise) has its own custom ProtectionDomain which is lost when Subject.doAs is used. There is a way to make it work for most scenarios namely, make the custom ProtectionDomain return a speciall PermissionCollection because that is reused by the ProtectionDomain created by the SubjectDomainCombiner if no custom policy is installed (in the later case a different workaround would be needed). 
> Currently, Felix doesn't work when Subject.doAs is used and security is enabled. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (FELIX-654) Subject.doAs not supported

Posted by "Karl Pauls (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-654?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Karl Pauls resolved FELIX-654.
------------------------------

    Resolution: Fixed

I think the current fix is reasonable and seems to work -- hence, I will close this issue soon. 

> Subject.doAs not supported
> --------------------------
>
>                 Key: FELIX-654
>                 URL: https://issues.apache.org/jira/browse/FELIX-654
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: felix-1.0.4
>            Reporter: Karl Pauls
>            Assignee: Karl Pauls
>             Fix For: felix-1.2.0
>
>
> Subject.doAs allows to perform work as a particular Subject. It first retrieves the current Thread's AccessControlContext via AccessController.getContext, and then instantiates a new AccessControlContext using the retrieved context along with a new SubjectDomainCombiner (constructed using the provided Subject). Finally, this method invokes AccessController.doPrivileged, passing it the provided PrivilegedAction, as well as the newly constructed AccessControlContext. 
> The issue is that the SubjectDomainCombiner does update the relevant ProtectionDomains with the Principals from the Subject associated with this SubjectDomainCombiner by creating a new ProtectionDomain instance for each ProtectionDomain in the currentDomains array. Each new ProtectionDomain instance is created using the CodeSource, Permissions and ClassLoader from the corresponding ProtectionDomain in currentDomains, as well as with the Principals from the Subject associated with this SubjectDomainCombiner. 
> This doesn't work well with the OSGi spec due to the fact that each bundle (or revision to be precise) has its own custom ProtectionDomain which is lost when Subject.doAs is used. There is a way to make it work for most scenarios namely, make the custom ProtectionDomain return a speciall PermissionCollection because that is reused by the ProtectionDomain created by the SubjectDomainCombiner if no custom policy is installed (in the later case a different workaround would be needed). 
> Currently, Felix doesn't work when Subject.doAs is used and security is enabled. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.