nova_auth_claims (nova_auth v0.2.0)
View SourceClaims mapping engine. Transforms provider-specific claims (e.g., OIDC userinfo or JWT claims) into nova_auth actor maps. Supports static key-renaming maps or callback functions for complex transformations.
Summary
Functions
Map raw claims to an actor map using the given mapping spec.
Map raw claims and merge into an existing actor map. New keys overwrite existing ones.
Functions
-spec map(Mapping, Claims) -> map() when Mapping :: #{binary() => atom()} | {module(), atom()}, Claims :: map().
Map raw claims to an actor map using the given mapping spec.
Static map renames binary claim keys to atom keys:
Mapping = #{~"sub" => id, ~"email" => email, ~"groups" => roles},
Claims = #{~"sub" => ~"abc", ~"email" => ~"user@example.com"},
map(Mapping, Claims).
%% => #{id => ~"abc", email => ~"user@example.com"}Callback form allows arbitrary transformation:
Mapping = {my_module, map_claims},
map(Mapping, Claims).
%% => my_module:map_claims(Claims)
-spec map(Mapping, Claims, Base) -> map() when Mapping :: #{binary() => atom()} | {module(), atom()}, Claims :: map(), Base :: map().
Map raw claims and merge into an existing actor map. New keys overwrite existing ones.