[jboss-user] [Security & JAAS/JBoss] - Re: How Security.drl file can be refreshed at runtime withou

surenderok do-not-reply at jboss.com
Wed Feb 4 00:46:45 EST 2009


Hi...

Write the following code in to click event Ex : .xhtml file..

//jboss-seam.jar 2.1.1

/*
		 * Sreshtaya Softech India Pvt Ltd.
		 * 
		 */
		
		/*Getting Security.drl from context which is mentioned in Component.xml Ex : <drools:rule-base name="securityRules">
		<drools:rule-files>
			security.drl
		</drools:rule-files>
	</drools:rule-base>*/

		org.jboss.seam.drools.RuleBase ruleBase=   (org.jboss.seam.drools.RuleBase)   Contexts.getApplicationContext().get("securityRules");
		
		//Getting RuleBasedPermissionResolver from context
		  RuleBasedPermissionResolver ruleBasedPermissionResolver=   (RuleBasedPermissionResolver)   Contexts.getSessionContext().get("org.jboss.seam.security.ruleBasedPermissionResolver");
		
			
				  try {
				//Applying new rules to context
					  ruleBase.compileRuleBase();
					  
				//Loading all rules to Context	  
					  ruleBasedPermissionResolver.setSecurityContext(ruleBase.getRuleBase().newStatefulSession());			 
													
				} catch (Exception e) {
				
					e.printStackTrace();
				}

Thats it without restatring the Jboss server all rules can apply at runtime..

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4206788#4206788

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4206788



More information about the jboss-user mailing list