JACCConfigurationpublic class JACCConfiguration extends Object Adds Hibernate permissions to roles via JACC |
Fields Summary |
---|
private static final Log | log | private final javax.security.jacc.PolicyConfiguration | policyConfiguration |
Constructors Summary |
---|
public JACCConfiguration(String contextId)
try {
policyConfiguration = PolicyConfigurationFactory
.getPolicyConfigurationFactory()
.getPolicyConfiguration( contextId, false );
}
catch (ClassNotFoundException cnfe) {
throw new HibernateException( "JACC provider class not found", cnfe );
}
catch (PolicyContextException pce) {
throw new HibernateException( "policy context exception occurred", pce );
}
|
Methods Summary |
---|
public void | addPermission(java.lang.String role, java.lang.String entityName, java.lang.String action)
if ( action.equals( "*" ) ) {
action = "insert,read,update,delete";
}
StringTokenizer tok = new StringTokenizer( action, "," );
while ( tok.hasMoreTokens() ) {
String methodName = tok.nextToken().trim();
EJBMethodPermission permission = new EJBMethodPermission(
entityName,
methodName,
null, // interfaces
null // arguments
);
if ( log.isDebugEnabled() ) {
log.debug( "adding permission to role " + role + ": " + permission );
}
try {
policyConfiguration.addToRole( role, permission );
}
catch (PolicyContextException pce) {
throw new HibernateException( "policy context exception occurred", pce );
}
}
|
|