Add a [InternalOnly] attribute
Closed this issue · 1 comments
undiwahn commented
We want to add an [InternalOnly(bool throwException = true)] attribute. We should be able to apply it to classes, methods, or properties.
The goal of this attribute is to ensure that the object/value it is attached to is NEVER passed out of the Expander. So you may mark Password as internal only to assert that even if it is somehow requested, it'll never get sent over the wire.
This means that the attribute should be checked:
- When expanding an object, similar to an Authorization check. If the object type is InternalOnly, return null
- When reading a property or method. If the source property or method is marked InternalOnly, is should return null instead
In the two above cases, if the throwException property is set (which should be the default) it would throw an Exception of a new type: InternalOnlyViolationException. If it is not set (ie [InternalOnly(false)]) then simply return the null and do not throw.