forked from p15670423/monkey
Common: Small style improvements in credentials.py
This commit is contained in:
parent
5608bb3f11
commit
c8f131e6b0
|
@ -19,7 +19,7 @@ def get_plaintext(secret: Union[SecretStr, SecretBytes, None, str]) -> Optional[
|
||||||
|
|
||||||
|
|
||||||
class Credentials(InfectionMonkeyBaseModel):
|
class Credentials(InfectionMonkeyBaseModel):
|
||||||
"""Represents a credential pair (some form of identity and a secret)"""
|
"""Represents a credential pair (an identity and a secret)"""
|
||||||
|
|
||||||
identity: Optional[Identity]
|
identity: Optional[Identity]
|
||||||
"""Identity part of credentials, like a username or an email"""
|
"""Identity part of credentials, like a username or an email"""
|
||||||
|
@ -30,6 +30,6 @@ class Credentials(InfectionMonkeyBaseModel):
|
||||||
class Config:
|
class Config:
|
||||||
json_encoders = {
|
json_encoders = {
|
||||||
# This makes secrets dumpable to json, but not loggable
|
# This makes secrets dumpable to json, but not loggable
|
||||||
SecretStr: lambda v: v.get_secret_value() if v else None,
|
SecretStr: get_plaintext,
|
||||||
SecretBytes: lambda v: v.get_secret_value() if v else None,
|
SecretBytes: get_plaintext,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue