I'm looking for an opportunity to add a validator for tokens #18189
-
For security reasons, it is necessary to prohibit the creation of tokens without expiration or with a validity period of more than 1 year (for example). I tried to go the route of creating a Custom Validator (to create Custom Logics), but unfortunately Netbox does not connect this validator to Is there such a possibility? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Custom validators aren't currently supported for tokens, as you note, because the Token model doesn't inherit That said, I'd also entertain a proposal to introduce a new configuration parameter asserting a minimum expiration time for API tokens. I imagine it's a fairly common need. |
Beta Was this translation helpful? Give feedback.
Custom validators aren't currently supported for tokens, as you note, because the Token model doesn't inherit
CustomValidationMixin
, which provides this functionality. However I see no reason it couldn't be added. You're welcome to submit a feature request citing your use case.That said, I'd also entertain a proposal to introduce a new configuration parameter asserting a minimum expiration time for API tokens. I imagine it's a fairly common need.