You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by Nick Lothian <ni...@essential.com.au> on 2004/12/10 05:14:13 UTC

RE: Portlet specification PLT.20.2 (Security Roles): Clarificatio n Request

> 
> After reading the Portlet Specification, and the related and 
> referred Servlet 2.3 Specification
> over and over again I still don't fully grasp the intention 
> of the writers concerning declarative security.
> 
> My problem is this: should the portlet container allow access 
> to a portlet which has a (valid) security-role-ref
> element defined which the Principal requesting access don't have?
> 

I had never thought of that, but it makes a lot of sense and would be a very
useful bit of functionality.

I'm afraid that I just don't see it written or implied in the spec, though. 

The fact is that functionality (which is reasonably important!) isn't
mentioned in the specification and I don't think the reference to the
Servlet spec is enough to require it.

I agree that it makes sense for it to be included and I suppose it is
possible it was omitted by mistake. I think you'd need to get it added to
the errata
(http://jcp.org/aboutJava/communityprocess/final/jsr168/Portlet_Specificatio
n_Errata.html) if this is the case.

If that isn't the case then I think you'll need to put it in Jetspeed, not
Pluto.

(I'd love for someone on the spec committee to say I'm wrong, though)

Nick

Re: Portlet specification PLT.20.2 (Security Roles): Clarificatio n Request

Posted by Ate Douma <at...@douma.nu>.

Ate Douma wrote:

> 
> Thanks for the reply Stefan.
> I've put in some comments and another question below.
> 
> Stefan Hepper wrote:
> 
>>>> After reading the Portlet Specification, and the related and 
>>>> referred Servlet 2.3 Specification
>>>> over and over again I still don't fully grasp the intention of the 
>>>> writers concerning declarative security.
>>>>
>>>> My problem is this: should the portlet container allow access to a 
>>>> portlet which has a (valid) security-role-ref
>>>> element defined which the Principal requesting access don't have?
>>>>
>> Ate,
>> I don't see any mismatch here. The servlet spec SRV 12.4 defines how 
>> the servlet container maps the security roles to the runtime 
>> environment. So access to the portlet itself is not retricted by role 
>> mapping..
>>
>>
>> There is a difference between the portlet and the servlet spec: in the 
>> portlet spec you cannot protect a portlet from being accessed by 
>> specific roles. We have done this on purpose. I think this is not 
>> appropriate for portlets as in contrary of servlets, the portlet does 
>> not know in which application it is running and there may be several 
>> different instances of the same portlet with different access control 
>> restrictions. 
> 
> 
> I agree on the the last part.
> But, the role definitions defined for a portlet are specifically defined
> for that one portlet and have a functional purpose for that portlet.
> 
> In my opinion, a portlet developer should always identify *all* possible
> functional roles a user can have when accessing the portlet.
> When a user does not have one of those roles, he or she has no business 
> using
> the portlet at all.
> I can't see how preventing the user to access the portlet in that case 
> would
> ever restrict its usage in whatever configuration, application or portal.
> 
> As I've planned to implement this (now probably only as optional) feature,
> I will really appreciate it if you can explain why my view on this isn't 
> valid.
> 
>> I think access control restrictions for portlets must be handled on 
>> the portal level, not by the portlet. The portlet can use J2EE roles 
>> in order to make business decisions, like users in the manager role 
>> are allowed to see the salary of  people, but not access restrictions.
> 
> Without the declarative security, and having the requirement to truly 
> secure
> access to certain portlets in a portal independent way (as I actually 
> have),
> a portlet developer really will have no other option that to require one
> additional (non-functional) role and check on access to the portlet if 
> the user
> has it or not using isUserInRole. 
Hmm, after rereading this, I see myself this isn't actually true. The portlet
can of course just check each and every functional role defined for the
portlet to come to the same conclusion. I wrote it like this because I actually
have portlets with more than 20 different roles and then my previous example
is much easier to implement *and* maintain.
Sorry for the wrong example.

 > If not, the portlet itself the must refuse to
> perform the request and/or throw an exception.
> 
> Although this will work for sure, I think it is a pity this cannot be 
> handled
> by the container. Thats what declarative security was meant for.
> 
> Regards, Ate
> 
>>
>> Stefan
>>
>>
>>
>>
> 
> 
> 
> 
> 


Re: Portlet specification PLT.20.2 (Security Roles): Clarificatio n Request

Posted by Ate Douma <at...@douma.nu>.
Thanks for the reply Stefan.
I've put in some comments and another question below.

Stefan Hepper wrote:
>>> After reading the Portlet Specification, and the related and referred 
>>> Servlet 2.3 Specification
>>> over and over again I still don't fully grasp the intention of the 
>>> writers concerning declarative security.
>>>
>>> My problem is this: should the portlet container allow access to a 
>>> portlet which has a (valid) security-role-ref
>>> element defined which the Principal requesting access don't have?
>>>
> Ate,
> I don't see any mismatch here. The servlet spec SRV 12.4 defines how the 
> servlet container maps the security roles to the runtime environment. So 
> access to the portlet itself is not retricted by role mapping..
> 
> 
> There is a difference between the portlet and the servlet spec: in the 
> portlet spec you cannot protect a portlet from being accessed by 
> specific roles. We have done this on purpose. I think this is not 
> appropriate for portlets as in contrary of servlets, the portlet does 
> not know in which application it is running and there may be several 
> different instances of the same portlet with different access control 
> restrictions. 

I agree on the the last part.
But, the role definitions defined for a portlet are specifically defined
for that one portlet and have a functional purpose for that portlet.

In my opinion, a portlet developer should always identify *all* possible
functional roles a user can have when accessing the portlet.
When a user does not have one of those roles, he or she has no business using
the portlet at all.
I can't see how preventing the user to access the portlet in that case would
ever restrict its usage in whatever configuration, application or portal.

As I've planned to implement this (now probably only as optional) feature,
I will really appreciate it if you can explain why my view on this isn't valid.

>I think access control restrictions for portlets must be 
> handled on the portal level, not by the portlet. The portlet can use 
> J2EE roles in order to make business decisions, like users in the 
> manager role are allowed to see the salary of  people, but not access 
> restrictions.
Without the declarative security, and having the requirement to truly secure
access to certain portlets in a portal independent way (as I actually have),
a portlet developer really will have no other option that to require one
additional (non-functional) role and check on access to the portlet if the user
has it or not using isUserInRole. If not, the portlet itself the must refuse to
perform the request and/or throw an exception.

Although this will work for sure, I think it is a pity this cannot be handled
by the container. Thats what declarative security was meant for.

Regards, Ate

> 
> Stefan
> 
> 
> 
> 


Re: Portlet specification PLT.20.2 (Security Roles): Clarificatio n Request

Posted by Stefan Hepper <st...@apache.org>.
Nick Lothian wrote:

>>After reading the Portlet Specification, and the related and 
>>referred Servlet 2.3 Specification
>>over and over again I still don't fully grasp the intention 
>>of the writers concerning declarative security.
>>
>>My problem is this: should the portlet container allow access 
>>to a portlet which has a (valid) security-role-ref
>>element defined which the Principal requesting access don't have?
>>
>>    
>>
>
>I had never thought of that, but it makes a lot of sense and would be a very
>useful bit of functionality.
>
>I'm afraid that I just don't see it written or implied in the spec, though. 
>
>The fact is that functionality (which is reasonably important!) isn't
>mentioned in the specification and I don't think the reference to the
>Servlet spec is enough to require it.
>
>I agree that it makes sense for it to be included and I suppose it is
>possible it was omitted by mistake. I think you'd need to get it added to
>the errata
>(http://jcp.org/aboutJava/communityprocess/final/jsr168/Portlet_Specificatio
>n_Errata.html) if this is the case.
>
>If that isn't the case then I think you'll need to put it in Jetspeed, not
>Pluto.
>
>(I'd love for someone on the spec committee to say I'm wrong, though)
>
>Nick
>
>
>  
>
Ate,
I don't see any mismatch here. The servlet spec SRV 12.4 defines how the 
servlet container maps the security roles to the runtime environment. So 
access to the portlet itself is not retricted by role mapping..


There is a difference between the portlet and the servlet spec: in the 
portlet spec you cannot protect a portlet from being accessed by 
specific roles. We have done this on purpose. I think this is not 
appropriate for portlets as in contrary of servlets, the portlet does 
not know in which application it is running and there may be several 
different instances of the same portlet with different access control 
restrictions. I think access control restrictions for portlets must be 
handled on the portal level, not by the portlet. The portlet can use 
J2EE roles in order to make business decisions, like users in the 
manager role are allowed to see the salary of  people, but not access 
restrictions.

Stefan