Re: Re: How to digest a customized struts configuration

2003-12-17 Thread Sebastian Linz
Hi Joe,

thank you for your usefull hint. Now it flies :) Of
course I was quite close. I even tried out different
"addSetNext" methods. Following your hint I knew I had
to change something else. But I missed to add a
corresponding "add"-method to my "ActionMapping"
sub-class.

Once again: thank you for your advise.

If anybody is interessted to the solution I would post
it under this thread. Otherwise I won't looking at the
traffic of this thread.

Regards,

Sebastian


 --- Joe Germuska <[EMAIL PROTECTED]> schrieb: > At
9:33 PM +0100 12/16/03, Sebastian Linz wrote:
> >I added my sample rule set using the init parameter
> >within the web
> >deployment descriptor. But I didn't find the way
> how
> >to tell the
> >digester to
> >add the
> >SecurityConstraint bean to my sample action
> mapping.
> >
> >Impatiently waiting for your answers
> 
> You've gotten quite close; it just seems to me that
> you need to add a 
> "setNext" rule at the path 
>
"struts-config/action-mappings/action/security-constraint"
> -- and 
> then guarantee that you only use
> "security-constraint" elements 
> nested inside of action elements that specify a
> subclass of 
> ActionMapping which would accept a
> security-constraint object.
> 
> Joe
> 
> -- 
> Joe Germuska
> [EMAIL PROTECTED]  
> http://blog.germuska.com
>   "We want beef in dessert if we can get it there."
>-- Betty Hogan, Director of New Product
> Development, National 
> Cattlemen's Beef Association
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>  

__

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Logos und Klingeltöne fürs Handy bei http://sms.yahoo.de

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to digest a customized struts configuration

2003-12-16 Thread Sebastian Linz
Hello,

I posted this message a few days ago. Unfortunately I
didn't get a helpful reply. I think I choosed the
wrong subject and that's why I re-posted the message
once again:

I want to ask you for help concerning an extension of
the struts config 
dtd
and how to make these extension available in the
javabeans, 
respectively. In
my case the "roles" tag isn't enough why I added a 
"security-constraint"
tag.
Within a sub-class of RequestProcessor I would like to
check if the 
user in
role satifies the security-constraint to call the
corresponding action. 
A
security-constraint is composed of a module name and a
function access
permission. To do checking I need to be able access
the
securityConstraint-property of
my SessionActionMapping sub-class if I'm right. But I
don't now how to 
tell
the Digester with the right rules how to add the
SecurityConstraint 
bean to
my SessionActionMapping sub-class. There's where I
need help.

So first this is how my DTD looks like:

...







































I wrote an ActionServlet sub-class to define the
public id of my dtd 
for the
digester and activated my ActionServer sub-class threw
the web 
deployment
descriptor. Starting my sample application the action
servlet gets 
correctly
initialized. 

Then I added JavaBeans SecurityConstraint and
AuthConstraint.
SecurityConstraint contains a property authConstraints
type Collection,
getter- and
setter-methods and a addAuthConstraint-method.
AuthConstraint is a 
simple
JavaBean
with properties moduleName and functionName and
getter/setter-methods. 

SampleActionMapping extends SessionActionMapping and
contains a 
property of
type SecurityConstraint. Within the struts-config I
defined my sample 
action
mapping globaly for all action mappings.

All this describes works fine. But now the problem
raises. Following an
excerpt from my SampleRuleSet:

public class SampleRuleSet extends RuleSetBase {

public void addRuleInstances(Digester digester) {

digester.addObjectCreate(
   
"struts-config/action-mappings/action/security-constraint",

"sample.struts.config.SecurityConstraint");

digester.addObjectCreate(
   
"struts-config/action-mappings/action/security-constraint/auth-constraint",
"sample.struts.config.AuthConstraint");
digester.addSetProperties(
   
"struts-config/action-mappings/action/security-constraint/auth-constraint",
"function-name",
"functionName");
digester.addSetProperties(
   
"struts-config/action-mappings/action/security-constraint/auth-constraint",
"module-name",
"moduleName");
digester.addSetNext( 
   
"struts-config/action-mappings/action/security-constraint/auth-constraint",
"addAuthConstraint");   

I added my sample rule set using the init parameter
within the web
deployment descriptor. But I didn't find the way how
to tell the 
digester to
add the
SecurityConstraint bean to my sample action mapping.

Impatiently waiting for your answers

regards

Sebastian


PS: please excuse my english.

__

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Logos und Klingeltöne fürs Handy bei http://sms.yahoo.de

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts User Roles

2003-12-09 Thread Sebastian Linz
Hello Tiago,

I can't tell you where you can find documentation
concerning "roles". But I have taken a look on struts
roles on my own. So I'll write down what I know and
maybe you get a hint.

The struts config dtd defines an attribute "roles" for
the "action" element. The "roles" attribute is
optional and may contain a comma-delimited list of
security role names. These role names are loaded to
the ActionMapping of the related action class during
initialization of the ActionServlet and Actions (if
you want to know exactly what is done when take a look
at the init method of the ActionServlet's source).
When an Action's execute method is called an
ActionMapping object is passed. ActionMapping inherits
the property roles from ActionConfig which is
populated with the role names from the
struts-config.xml during initialization. Within your
action you may access your security role names from
the mapping. For convenience there is a method
getRoleNames so you get the role names within an
array. 

Hope that helps.

I posted a thread last week regarding this issue. But
I didn't get a helpful answer. I wanted to define a
custom struts config dtd to extend the struts config
with an element "security constraint". My problem is
still that I don't know how to configure the digester
using custom rule sets so my sub-class of action
mapping gets populated with my custom tag. Maybe you
have an idea or anyone who reads this thread.

Sincerely yours

Sebastian


 --- Tiago Henrique Costa Rodrigues Alves
<[EMAIL PROTECTED]> schrieb: > Where can
I find Struts Roles documentation?
> 
> Tiago Henrique C. R. Alves
> 
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>  


__

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Logos und Klingeltöne fürs Handy bei http://sms.yahoo.de

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]