CustomAttributes cache per script engine #540
-
I am trying to use a CustomAttributeLoader to implement API security level and version control, where every user/script may have a different set of available exposed types and methods. As of my understand, this is not quite possible since the cache in CustomAttributes is global and the first executed script will cache the custom attributes. Clearing the cache before every script would add a great performance penalty, and also would not quite work in a multi tenant application. Currently the only way forward is to add a specific access control method to every exposed method. That would however not be possible if one would want to add security levels to .NET classes/methods. If a ScriptEngine optionally could contain a local CustomAttributes cache, it would be possible to create pools of engines, differentiated by their capabilities. Is there another way to solve this use case? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 15 replies
-
Hi @ebrandin,
The title mentions per-engine caching, but here you refer to users and scripts. Can you describe the relationship between users, scripts, and engines in your architecture?
Per-engine attribute caching seems doable, but it's a departure from standard .NET attribute semantics, which support one static set of attributes per resource. That might be OK, but we'd prefer to explore other options first.
It seems like you wish to expose your entire API to all clients, and then use attributes to rope off restricted areas. Would it not be possible instead to expose only the portions each client is allowed to access? Thanks! |
Beta Was this translation helpful? Give feedback.
Thanks. We'll look into this for an upcoming release.