1
0
mirror of synced 2026-08-05 17:57:15 +00:00

SEC-97: Format Acegi Security source code in accordance with latest Jalopy configuration.

This commit is contained in:
Ben Alex
2006-05-23 13:38:33 +00:00
parent 49800018e9
commit ab12817b7a
654 changed files with 17379 additions and 21566 deletions
@@ -1,4 +1,4 @@
/* Copyright 2004 Acegi Technology Pty Limited
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@ package sample.attributes;
* @author Ben Alex
* @version $Id$
*
* @@net.sf.acegisecurity.SecurityConfig("ROLE_TELLER")
*/
public interface BankService {
//~ Methods ================================================================
@@ -1,4 +1,4 @@
/* Copyright 2004 Acegi Technology Pty Limited
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ package sample.attributes;
* @version $Id$
*/
public class BankServiceImpl implements BankService {
//~ Methods ================================================================
//~ Methods ========================================================================================================
public float balance(String accountNumber) {
return 42000000;
@@ -1,4 +1,4 @@
/* Copyright 2004, 2005 Acegi Technology Pty Limited
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,10 @@ package sample.attributes;
import org.acegisecurity.AccessDeniedException;
import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.GrantedAuthorityImpl;
import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.context.SecurityContextImpl;
import org.acegisecurity.providers.TestingAuthenticationToken;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -33,13 +35,28 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
* @version $Id$
*/
public class Main {
//~ Methods ================================================================
//~ Methods ========================================================================================================
/**
* This can be done in a web app by using a filter or <code>SpringMvcIntegrationInterceptor</code>.
*/
private static void createSecureContext() {
TestingAuthenticationToken auth = new TestingAuthenticationToken("test", "test",
new GrantedAuthority[] {
new GrantedAuthorityImpl("ROLE_TELLER"), new GrantedAuthorityImpl("ROLE_PERMISSION_LIST")
});
SecurityContextHolder.getContext().setAuthentication(auth);
}
private static void destroySecureContext() {
SecurityContextHolder.setContext(new SecurityContextImpl());
}
public static void main(String[] args) throws Exception {
createSecureContext();
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"applicationContext.xml");
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
BankService service = (BankService) context.getBean("bankService");
// will succeed
@@ -56,21 +73,4 @@ public class Main {
destroySecureContext();
}
/**
* This can be done in a web app by using a filter or
* <code>SpringMvcIntegrationInterceptor</code>.
*/
private static void createSecureContext() {
TestingAuthenticationToken auth = new TestingAuthenticationToken("test",
"test",
new GrantedAuthority[] {new GrantedAuthorityImpl("ROLE_TELLER"), new GrantedAuthorityImpl(
"ROLE_PERMISSION_LIST")});
SecurityContextHolder.getContext().setAuthentication(auth);
}
private static void destroySecureContext() {
SecurityContextHolder.setContext(new SecurityContextImpl());
}
}