Skip to content

Commit 1bbe6ca

Browse files
Fix #19 issue, adding AccountAuthenticationFacet class
1 parent 688c84b commit 1bbe6ca

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

case.jsonld

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,6 +1809,22 @@
18091809
}
18101810
}
18111811
]
1812+
},
1813+
{
1814+
"@id": "kb:6b735727-56a7-562d-af4f-dffdb7ad96bd",
1815+
"@type": "uco-observable:ObservableObject",
1816+
"uco-core:hasFacet": [
1817+
{
1818+
"@id": "kb:6706063d-7303-523b-802c-3a48e0f4ac7b",
1819+
"@type": "uco-observable:AccountAuthenticationFacet",
1820+
"uco-observable:password": "bee,flies,on,passion,flowers,2467",
1821+
"uco-observable:passwordType": "plain-text",
1822+
"uco-observable:passwordLastChanged": {
1823+
"@type": "xsd:dateTime",
1824+
"@value": "2024-06-07T15:09:19+00:00"
1825+
}
1826+
}
1827+
]
18121828
}
18131829
]
18141830
}

case_mapping/uco/observable.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,35 @@ def __init__(self, identifier=None, is_active=True, issuer_id=None):
232232
)
233233

234234

235+
class AccountAuthenticationFacet(FacetEntity):
236+
def __init__(
237+
self,
238+
password: Optional[str] = None,
239+
password_last_changed: Optional[datetime] = None,
240+
password_type: Optional[str] = None,
241+
):
242+
"""
243+
An account authentication facet is a grouping of characteristics unique
244+
to the mechanism of accessing an account.
245+
:param password: Specifies an authentication password.
246+
:param password_last_changed: The date and time that the password was last changed.
247+
:param password_type: The type of password, for instance plain-text or encrypted.
248+
"""
249+
super().__init__()
250+
self["@type"] = "uco-observable:AccountAuthenticationFacet"
251+
self._str_vars(
252+
**{
253+
"uco-observable:password": password,
254+
"uco-observable:passwordType": password_type,
255+
}
256+
)
257+
self._datetime_vars(
258+
**{
259+
"uco-observable:passwordLastChanged": password_last_changed,
260+
}
261+
)
262+
263+
235264
class FacetMobileAccount(FacetEntity):
236265
def __init__(
237266
self,
@@ -1721,6 +1750,7 @@ def __init__(self, disk_type=None, size=None, partition=None):
17211750
"uco-observable:AutonomousSystem": ObservableAutonomousSystem,
17221751
"uco-observable:AutonomousSystemFacet": FacetAutonomousSystem,
17231752
"uco-observable:AccountFacet": FacetAccount,
1753+
"uco-observable:AccountAuthenticationFacet": AccountAuthenticationFacet,
17241754
"uco-observable:ContentDataFacet": FacetContentData,
17251755
"uco-observable:ApplicationFacet": FacetApplication,
17261756
"uco-observable:ApplicationVersion": ObservableApplicationVersion,

example.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,21 @@ def _next_timestamp() -> datetime:
933933
event_rec_object.append_facets(event_rec_object_facet)
934934
bundle.append_to_uco_object(event_rec_object)
935935

936+
###################################
937+
# Adding an AccountAuthentication #
938+
###################################
939+
940+
authentication_account_object = uco.observable.ObservableObject()
941+
password_last_changed = datetime.strptime("2024-06-07T15:09:19", "%Y-%m-%dT%H:%M:%S")
942+
authentication_account_facet = uco.observable.AccountAuthenticationFacet(
943+
password="bee,flies,on,passion,flowers,2467",
944+
password_last_changed=password_last_changed,
945+
password_type="plain-text",
946+
)
947+
authentication_account_object.append_facets(authentication_account_facet)
948+
bundle.append_to_uco_object(authentication_account_object)
949+
950+
936951
##################
937952
# Print the case #
938953
##################

0 commit comments

Comments
 (0)