Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] RE: PerClauses( or single-signon-authorization)

Dear all, sorry for replying to myself but my last effort was far too ugly.

What, gentle readers, is wrong with the following?

---------------------------------------------------------------------
import javax.security.auth.Subject;


public abstract aspect AuthAspect pertarget(target(Subject)){


    public abstract pointcut authOperations();


    around():authOperations() && !cflowbelow(authOperations()){

        Subject s = (Subject)thisJoinPoint.getTarget();

        if(s == null) throw new AuthorizationException("No subject
associated");

        try{

            Subject.doAsPrivileged(s, new PrivilegedExceptionAction(){

                public Object run() throws Exception{

 
AccessController.checkPermission(getPermission(thisJoinPoint));

                    return proceed();

                }}, null);
               
        }catch(PrivilegedActionException e){

            throw new AuthorizationException(e.getException());

        }

    }


    protected abstract Permission getPermission(JoinPoint point);

}
-----------------------------------------------------------------

craig collings


#####################################################################################
Notice of Confidential information 
The information contained in this electronic mail is CONFIDENTIAL INFORMATION and may
be LEGALLY PRIVILEGED, intended only for the individual or entity named above. If you
are not the intended recipient, you are hereby notified that the use, dissemination,
distribution, or copying of this document is strictly prohibited. If you have received
this electronic message in error, please immediately notify us by return or telephone
call collect to 07 577 6049) and destroy the original message. Thank you, ABN AMRO Craigs Limited.

This e-mail message has been scanned and cleared by MailMarshal   www.marshalsoftware.com 

#####################################################################################


Back to the top