anchor.diff:  %% @end
   %%--------------------------------------------------------------------
   -spec validate(entity_logic:req()) -> entity_logic:validity_verificator().
  +validate(#el_req{operation = create, gri = #gri{aspect = preauthorize}}) -> #{
  +    required => #{
  +        <<"token">> => {token, any}
  +    },
  +    optional => #{
  +        <<"peerIp">> => {ipv4_address, any}
  +    }
  +};
  +validate(#el_req{operation = create, gri = #gri{aspect = verify_identity}}) -> #{
  +    required => #{
  +        <<"token">> => {token, any}
  +    },
  +    optional => #{
  +        <<"peerIp">> => {ipv4_address, any}
  +    }
  +};
  +
   validate(#el_req{operation = create, gri = #gri{aspect = {user_named_token, UserId}}}) ->
       ?NAMED_TOKEN_VALIDATOR(?SUB(user, UserId));
   validate(#el_req{operation = create, gri = #gri{aspect = {provider_named_token, ProviderId}}}) ->
  
positive.code: %%--------------------------------------------------------------------
  -spec authorize(entity_logic:req(), entity_logic:entity()) -> boolean().
  % Users and providers are authorized to perform all operations on their tokens
  authorize(#el_req{auth = ?USER(UserId), gri = #gri{aspect = {user_named_tokens, UserId}}}, _) ->
      true;
  authorize(#el_req{auth = ?USER(UserId), gri = #gri{aspect = {user_named_token, UserId}}}, _) ->
  
negative.code:     create_temporary_token(?SUB(user, UserId), Data);
  
  create(#el_req{gri = #gri{id = undefined, aspect = {provider_temporary_token, ProviderId}}, data = Data}) ->
      create_temporary_token(?SUB(?ONEPROVIDER, ProviderId), Data);
  
  create(#el_req{auth = Auth, gri = #gri{id = undefined, aspect = preauthorize}, data = Data}) ->
      Token = maps:get(<<"token">>, Data),
      PeerIp = maps:get(<<"peerIp">>, Data, undefined),
      case token_auth:verify_access_token(Token, PeerIp, aai:auth_to_audience(Auth)) of
          {ok, #auth{subject = Subject}} ->
              {ok, value, Subject};
          {error, _} = Error ->
              Error
      end;
  
  create(#el_req{auth = Auth, gri = #gri{id = undefined, aspect = verify_identity}, data = Data}) ->
      Token = maps:get(<<"token">>, Data),
      PeerIp = maps:get(<<"peerIp">>, Data, undefined),
      case token_auth:verify_identity(Token, PeerIp, aai:auth_to_audience(Auth)) of
          {ok, Subject} ->
              {ok, value, Subject};
          {error, _} = Error ->
              Error
      end.
  
  
  %%--------------------------------------------------------------------
  