amelinium.proto.identity
added in 1.0.0
amelinium service, identity-related protocols and functions.
add-acceptable-type!
(add-acceptable-type! acceptable-tag t)(add-acceptable-type! acceptable-tag t & more)For the given parent tag acceptable-tag (which should be a qualified keyword) and an identity type t, creates a relation so that the identity type is a descendant of the given parent. It also ensures that the parent itself is a descendant of :amelinium.identity/valid tag.
Useful when there is a need to accept a limited set of recognized identity types. Then the detection function can check whether an identity belongs to a parent.
Makes changes in the global identity type hierarchy amelinium.identity.proto/type-hierarchy.
add-subtype!
(add-subtype! parent t)(add-subtype! parent t & more)Adds an identity type t as a subtype of a tag parent. Multiple types can be given. Updates the global identity type hierarchy amelinium.identity.proto/type-hierarchy.
add-type!
(add-type! t)(add-type! t & more)Adds a new identity type to the global identity type hierarchy amelinium.identity.proto/type-hierarchy and marks it as valid.
add-type-string-matcher!
(add-type-string-matcher! f)(add-type-string-matcher! f & more)Adds new identity type string matcher to a global chain. Multiple functions may be given. Each function should accept an input and optional identity type. If the identity type is given then it will be used as a hint to check whether this matcher should be applied.
del-subtype!
(del-subtype! parent t)(del-subtype! parent t & more)Removes an identity type t from being a subtype of a tag parent. Multiple types can be given. Updates the global identity type hierarchy amelinium.identity.proto/type-hierarchy.
del-type!
(del-type! t)(del-type! t & more)Removes an identity type from the global identity type hierarchy amelinium.identity.proto/type-hierarchy.
del-type-string-matcher!
(del-type-string-matcher! n)(del-type-string-matcher! n & more)Deletes identity type string matcher of the given index n from a global chain. Multiple indexes may be given.
Identifiable
protocol
This protocol allows to extend known identity types.
members
literal?
(literal? user-identity)Returns true if the given literal can express identity.
make
(make user-identity)(make user-identity identity-type)Creates amelinium.Identity record by detecting identity type and parsing the identity. If identity-type is given, parsing for the given identity type will be called explicitly. If a parent tag for identity types is given, it will be used to parse and constrain the type.
For the Identity record it simply returns it unless the identity-type is given and it differs from a value of its :id-type field.
type
(type user-identity)(type user-identity identity-type)Returns a keyword describing identity type detected by analyzing the given value (:phone for a phone number, :email for e-mail address, :id for numeric user ID, :uid for UUID). If identity-type or a parent tag for identity types is given, detection functions for the given identity type or (a tag-grouped) identity types will be cherry-picked and result will be constrained to it. Does not perform full validation, just detection.
value
(value user-identity)(value user-identity identity-type)Returns a value of the given identity which is an object which represents it best. If identity-type is given, parsing for the given identity type will be called explicitly. If a parent tag for identity types is given, it will be used to parse and constrain the type.
prioritized-types
Prioritized identity types. If they appear on a valid-types list, they will be placed at the beginning.
type-hierarchy
A type hierarchy for identity types expressed as unqualified and qualified keywords. Any tag derived from :amelinium.identity/valid will be considered valid.
type-string-match
(type-string-match v)(type-string-match v t)Internal function for matching strings on a basis of type-string-matchers.
type-string-matchers
Identity string matchers repository. A vector of functions executed in a sequence until one will return anything but nil.
unaccept-type!
(unaccept-type! acceptable-tag t)(unaccept-type! acceptable-tag t & more)Removes identity type t from the given parent acceptable-tag. Makes changes in the global identity type hierarchy amelinium.identity.proto/type-hierarchy.