Random Utilities, user identity protocols.
Random Utilities, user identity protocols.
(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
:io.randomseed.utils.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
io.randomseed.utils.identity.proto/type-hierarchy.
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 `:io.randomseed.utils.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 `io.randomseed.utils.identity.proto/type-hierarchy`.
(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
io.randomseed.utils.identity.proto/type-hierarchy.
Adds an identity type `t` as a subtype of a tag `parent`. Multiple types can be given. Updates the global identity type hierarchy `io.randomseed.utils.identity.proto/type-hierarchy`.
(add-type! t)(add-type! t & more)Adds a new identity type to the global identity type hierarchy
io.randomseed.utils.identity.proto/type-hierarchy and marks it as valid.
Adds a new identity type to the global identity type hierarchy `io.randomseed.utils.identity.proto/type-hierarchy` and marks it as valid.
(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.
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! 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
io.randomseed.utils.identity.proto/type-hierarchy.
Removes an identity type `t` from being a subtype of a tag `parent`. Multiple types can be given. Updates the global identity type hierarchy `io.randomseed.utils.identity.proto/type-hierarchy`.
(del-type! t)(del-type! t & more)Removes an identity type from the global identity type hierarchy
io.randomseed.utils.identity.proto/type-hierarchy.
Removes an identity type from the global identity type hierarchy `io.randomseed.utils.identity.proto/type-hierarchy`.
(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.
Deletes identity type string matcher of the given index `n` from a global chain. Multiple indexes may be given.
This protocol allows to extend known identity types.
This protocol allows to extend known identity types.
(literal? user-identity)Returns true if the given literal can express identity.
Returns `true` if the given literal can express identity.
(make user-identity)(make user-identity identity-type)Creates io.randomseed.utils.identity.types.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.
Creates `io.randomseed.utils.identity.types.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 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.
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 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.
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 identity types. If they appear on a valid-types list, they will be
placed at the beginning.
Prioritized identity types. If they appear on a `valid-types` list, they will be placed at the beginning.
A type hierarchy for identity types expressed as unqualified and qualified
keywords. Any tag derived from :io.randomseed.utils.identity/valid will be considered
valid.
A type hierarchy for identity types expressed as unqualified and qualified keywords. Any tag derived from `:io.randomseed.utils.identity/valid` will be considered valid.
(type-string-match v)(type-string-match v t)Internal function for matching strings on a basis of type-string-matchers.
Internal function for matching strings on a basis of `type-string-matchers`.
Identity string matchers repository. A vector of functions executed in a sequence
until one will return anything but nil.
Identity string matchers repository. A vector of functions executed in a sequence until one will return anything but `nil`.
(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 io.randomseed.utils.identity.proto/type-hierarchy.
Removes identity type `t` from the given parent `acceptable-tag`. Makes changes in the global identity type hierarchy `io.randomseed.utils.identity.proto/type-hierarchy`.
List of valid types, regenerated each time types are added or deleted.
List of valid types, regenerated each time types are added or deleted.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |