si_lance
05-08-2007, 01:09 AM
Has anyone used AOP to set the credentials for a thread attempting database access via a DAO? This is for row-level (vpd) security. Thanks. :)
In Java Spring, one would use UserCredentialsDataSourceAdapter and use the MethodInterceptor interface. Implementing something like this:
public Object invoke(MethodInvocation i) throws Throwable {
// get credentials from secure context
String[] credentials = ... ommitted ...
credentialsDataSourceAdapter.setCredentialsForCurr entThread(credentials[0], credentials[1]);
Object ret=i.proceed();
credentialsDataSourceAdapter.removeCredentialsFrom CurrentThread();
return ret;
}
Is there an equivalent in Spring.NET?
In Java Spring, one would use UserCredentialsDataSourceAdapter and use the MethodInterceptor interface. Implementing something like this:
public Object invoke(MethodInvocation i) throws Throwable {
// get credentials from secure context
String[] credentials = ... ommitted ...
credentialsDataSourceAdapter.setCredentialsForCurr entThread(credentials[0], credentials[1]);
Object ret=i.proceed();
credentialsDataSourceAdapter.removeCredentialsFrom CurrentThread();
return ret;
}
Is there an equivalent in Spring.NET?