Results 1 to 6 of 6

Thread: Problem with attributes sample (Bank)

  1. #1
    Join Date
    Sep 2004
    Posts
    12

    Default Problem with attributes sample (Bank)

    Hello,

    I set up the bank sample in eclipse, and got it to run ok, both as a Junit test and as a java app, using the Main class supplied. Both give me access denied although in both cases I'm using the code as is.

    This is the exception I get:
    net.sf.acegisecurity.AccessDeniedException: Access is denied.
    at net.sf.acegisecurity.vote.UnanimousBased.decide(Un animousBased.java:120)
    at net.sf.acegisecurity.intercept.AbstractSecurityInt erceptor.interceptor(AbstractSecurityInterceptor.j ava:302)
    at net.sf.acegisecurity.intercept.method.MethodSecuri tyInterceptor.invoke(MethodSecurityInterceptor.jav a:82)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :138)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:152)
    at $Proxy0.listAccounts(Unknown Source)
    at sample.attributes.Main.main(Main.java:46)

    Any ideas what the problem is?

    Thanks.

  2. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    I'd suggest it's a configuration issue between your Spring application context and/or the absence of the Commons Attributes generated subclasses. Does it work if you just use a console prompt and the ACEGI_SECURITY/samples/attributes/build.xml "all" target? If it does, try comparing that build file and application context against your configuration.

  3. #3
    Join Date
    Sep 2004
    Posts
    12

    Default

    Thank you for the information.

  4. #4
    Join Date
    Feb 2005
    Posts
    4

    Default Reverse problem

    I seem to have the reverse problem. The DeniedAccess test does not throw an exception when running JUnit from within Eclipse and fails. It works well when run with Maven. Could you please elaborate which configuration issues I should be looking for or point me somehow in the right direction? It must be something with the Commons Attribute. I'm having trouble getting the Ant built running correctly as well. It shows the same behavior as Eclipse.

    Thanks,

    Andreas

  5. #5
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    I haven't setup the Acegi Security Eclipse project file to support execution of the BankTests unit test within the IDE, as it relies on generation of the /samples/attributes/target/commons-attributes/ directory, which contains the BankService$__attributeRepository.java file. If you (i) add that directory as a source folder to the Eclipse project and (ii) add MAVEN_REPO/commons-attributes/jars/commons-attributes-api-2.1.jar, it will work fine (I just ran it against CVS head with the steps described):

    Code:
    2005-02-11 06:28:25,975 DEBUG net.sf.acegisecurity.intercept.AbstractSecurityInterceptor - Secure object: Invocation: method 'balance', arguments [1]; target is of class [sample.attributes.BankServiceImpl]; ConfigAttributes: [ROLE_TELLER, ROLE_PERMISSION_BALANCE]
    2005-02-11 06:28:25,975 DEBUG net.sf.acegisecurity.providers.ProviderManager - Authentication attempt using net.sf.acegisecurity.providers.TestingAuthenticationProvider
    2005-02-11 06:28:25,975 DEBUG net.sf.acegisecurity.intercept.AbstractSecurityInterceptor - Authenticated: net.sf.acegisecurity.providers.TestingAuthenticationToken@12d7a10: Username: test; Password: [PROTECTED]; Authenticated: true; Details: null; Granted Authorities: ROLE_TELLER, ROLE_PERMISSION_LIST
    2005-02-11 06:28:25,991 DEBUG net.sf.acegisecurity.intercept.AbstractSecurityInterceptor - Secure object: Invocation: method 'listAccounts', arguments []; target is of class [sample.attributes.BankServiceImpl]; ConfigAttributes: [ROLE_TELLER, ROLE_PERMISSION_LIST]
    2005-02-11 06:28:26,007 DEBUG net.sf.acegisecurity.providers.ProviderManager - Authentication attempt using net.sf.acegisecurity.providers.TestingAuthenticationProvider
    2005-02-11 06:28:26,007 DEBUG net.sf.acegisecurity.intercept.AbstractSecurityInterceptor - Authenticated: net.sf.acegisecurity.providers.TestingAuthenticationToken@6d084b: Username: test; Password: [PROTECTED]; Authenticated: true; Details: null; Granted Authorities: ROLE_TELLER, ROLE_PERMISSION_LIST
    2005-02-11 06:28:26,007 DEBUG net.sf.acegisecurity.intercept.AbstractSecurityInterceptor - Authorization successful
    2005-02-11 06:28:26,007 DEBUG net.sf.acegisecurity.intercept.AbstractSecurityInterceptor - RunAsManager did not change Authentication object

  6. #6
    Join Date
    Feb 2005
    Posts
    4

    Default

    Cool. Works like a charm now. Thanks.

    Andreas

Similar Threads

  1. Problem with Simple RMI Sample
    By con19m32 in forum Remoting
    Replies: 2
    Last Post: Jun 27th, 2007, 12:38 AM
  2. Replies: 2
    Last Post: Sep 28th, 2005, 11:12 PM
  3. Replies: 2
    Last Post: Jul 28th, 2005, 06:02 PM
  4. Replies: 3
    Last Post: Jun 25th, 2005, 06:14 PM
  5. Replies: 8
    Last Post: Dec 7th, 2004, 06:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •