Hi,

Please check out the following and let me know if this works for you...

Cheers,

Ashwin...

-----------------------------------------------------------

List<Permission> permissionsList = new ArrayList<Permission>();
Permission permission = new WildcardPermission("zone1:*");
permissionsList.add(permission);

final ShiroSecurityPolicy routeXPolicy = new
ShiroSecurityPolicy("./src/test/resources/securityconfig.ini", passPhrase,
true, permissionsList);

permissionsList = new ArrayList<Permission>();
permission = new WildcardPermission("zone2:*");
permissionsList.add(permission);

final ShiroSecurityPolicy routeYPolicy = new
ShiroSecurityPolicy("./src/test/resources/securityconfig.ini", passPhrase,
true, permissionsList);

RouteBuilder builder = new RouteBuilder() {
    public void configure() {
        onException(CamelAuthorizationException.class)
            .to("mock:authorizationException");

        from("seda:a")
            .choice()
                .when(header("foo").isEqualTo("bar"))
                    .policy(routeXPolicy)
                    .to("seda:b")
                .when(header("foo").isEqualTo("cheese"))
                    .policy(routeYpolicy)
                    .to("seda:c")
                .otherwise()
                    .to("mock:error");
    }
};

-------- securityConfig.ini ------------

[users]
# user 'ringo' with password 'starr' and the 'rte-X-access' role
ringo = starr, rte-X-access
# user 'george' with password 'harrison' and the 'rte-X-access' role
george = harrison, rte-X-access
# user 'john' with password 'lennon' and the 'rte-Y-access' role
john = lennon, rte-Y-access
# user 'paul' with password 'mccartney' and the 'rte-Y-access' role
paul = mccartney, rte-Y-access

[roles]
# 'rte-X-access' role has all permissions, indicated by the wildcard '*'
rte-X-access = zone1:*

# 'rte-Y-access' role has all permissions, indicated by the wildcard '*'
rte-Y-access = zone2:*

----------------------------------------

-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com 

Blog: http://opensourceknowledge.blogspot.com 
---------------------------------------------------------
--
View this message in context: 
http://camel.465427.n5.nabble.com/Is-anyone-really-using-shiro-framework-with-camel-tp5573583p5578406.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to