Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XEP-0484 Fast Token Auth [WIP] #4379

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft

XEP-0484 Fast Token Auth [WIP] #4379

wants to merge 13 commits into from

Conversation

arcusfelis
Copy link
Contributor

@arcusfelis arcusfelis commented Oct 1, 2024

This PR addresses MIM-2047.

Proposed changes include:

  • Token auth logic

TODO:

@mongoose-im
Copy link
Collaborator

mongoose-im commented Oct 1, 2024

mssql_mnesia_27 / odbc_mssql_mnesia / 15e855a
Reports root


dynamic_domains_mssql_mnesia_27 / odbc_mssql_mnesia / 15e855a
Reports root


elasticsearch_and_cassandra_27 / elasticsearch_and_cassandra_mnesia / 15e855a
Reports root/ big
OK: 473 / Failed: 0 / User-skipped: 49 / Auto-skipped: 0


small_tests_27 / small_tests / 15e855a
Reports root / small


small_tests_26 / small_tests / 15e855a
Reports root / small


small_tests_27_arm64 / small_tests / 15e855a
Reports root / small


ldap_mnesia_27 / ldap_mnesia / 15e855a
Reports root/ big
OK: 2346 / Failed: 0 / User-skipped: 915 / Auto-skipped: 0


dynamic_domains_mysql_redis_27 / mysql_redis / 15e855a
Reports root/ big
OK: 4722 / Failed: 1 / User-skipped: 152 / Auto-skipped: 0

fast_SUITE:basic:token_auth_fails_when_token_is_not_found
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alicE_token_auth_fails_when_token_is_not_found_402@domain.example.com">>,
          escalus_tcp,<0.5914.0>,undefined,
          [{port,5223},
           {tls_module,ssl},
           {ssl,true},
           {ssl_opts,[{verify,verify_none}]},
           {username,
             <<"alicE_token_auth_fails_when_token_is_not_found_402">>},
           {server,<<"domain.example.com">>},
           {host,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"23d7475f56c1d0a6">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {sasl2_helper,receive_features,3,
       [{file,"/home/circleci/project/big_tests/tests/sasl2_helper.erl"},
        {line,229}]},
     {sasl2_helper,apply_steps,4,
       [{file,"/home/circleci/project/big_tests/tests/sasl2_helper.erl"},
        {line,47}]},
     {fast_SUITE,token_auth_fails_when_token_is_not_found,1,
       [{file,"/home/circleci/project/big_tests/tests/fast_SUITE.erl"},
        {line,122}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1794}]},
     {test_server,run_test_case_eval1,6,
       [{file,"test_server.erl"},{line,1303}]},
     {test_server,run_test_case_eval,9,
       [{file,"test_server.erl"},{line,1235}]}]}}

Report log


internal_mnesia_27 / internal_mnesia / 15e855a
Reports root/ big
OK: 2488 / Failed: 0 / User-skipped: 773 / Auto-skipped: 0


ldap_mnesia_26 / ldap_mnesia / 15e855a
Reports root/ big
OK: 2346 / Failed: 0 / User-skipped: 915 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_26 / pgsql_mnesia / 15e855a
Reports root/ big
OK: 4755 / Failed: 1 / User-skipped: 119 / Auto-skipped: 0

fast_SUITE:basic:token_auth_fails_when_token_is_not_found
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alicE_token_auth_fails_when_token_is_not_found_409@domain.example.com">>,
          escalus_tcp,<0.5931.0>,undefined,
          [{port,5223},
           {tls_module,ssl},
           {ssl,true},
           {ssl_opts,[{verify,verify_none}]},
           {username,
             <<"alicE_token_auth_fails_when_token_is_not_found_409">>},
           {server,<<"domain.example.com">>},
           {host,<<"localhost">>},
           {password,<<"matygrysa">>},
           {stream_id,<<"45902ed28c219274">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {sasl2_helper,receive_features,3,
       [{file,"/home/circleci/project/big_tests/tests/sasl2_helper.erl"},
        {line,229}]},
     {sasl2_helper,apply_steps,4,
       [{file,"/home/circleci/project/big_tests/tests/sasl2_helper.erl"},
        {line,47}]},
     {fast_SUITE,token_auth_fails_when_token_is_not_found,1,
       [{file,"/home/circleci/project/big_tests/tests/fast_SUITE.erl"},
        {line,122}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1793}]},
     {test_server,run_test_case_eval1,6,
       [{file,"test_server.erl"},{line,1302}]},
     {test_server,run_test_case_eval,9,
       [{file,"test_server.erl"},{line,1234}]}]}}

Report log


dynamic_domains_pgsql_mnesia_27 / pgsql_mnesia / 15e855a
Reports root/ big
OK: 4756 / Failed: 0 / User-skipped: 119 / Auto-skipped: 0


pgsql_cets_27 / pgsql_cets / 15e855a
Reports root/ big
OK: 4632 / Failed: 1 / User-skipped: 186 / Auto-skipped: 0

fast_SUITE:basic:token_auth_fails_when_token_is_not_found
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alicE_token_auth_fails_when_token_is_not_found_402@localhost">>,
          escalus_tcp,<0.6202.0>,undefined,
          [{port,5223},
           {tls_module,ssl},
           {ssl,true},
           {ssl_opts,[{verify,verify_none}]},
           {username,
             <<"alicE_token_auth_fails_when_token_is_not_found_402">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {host,<<"localhost">>},
           {stream_id,<<"efd90e726e72e24c">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {sasl2_helper,receive_features,3,
       [{file,"/home/circleci/project/big_tests/tests/sasl2_helper.erl"},
        {line,229}]},
     {sasl2_helper,apply_steps,4,
       [{file,"/home/circleci/project/big_tests/tests/sasl2_helper.erl"},
        {line,47}]},
     {fast_SUITE,token_auth_fails_when_token_is_not_found,1,
       [{file,"/home/circleci/project/big_tests/tests/fast_SUITE.erl"},
        {line,122}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1794}]},
     {test_server,run_test_case_eval1,6,
       [{file,"test_server.erl"},{line,1303}]},
     {test_server,run_test_case_eval,9,
       [{file,"test_server.erl"},{line,1235}]}]}}

Report log


pgsql_mnesia_27 / pgsql_mnesia / 15e855a
Reports root/ big
OK: 5146 / Failed: 1 / User-skipped: 128 / Auto-skipped: 0

fast_SUITE:basic:token_auth_fails_when_token_is_not_found
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alicE_token_auth_fails_when_token_is_not_found_421@localhost">>,
          escalus_tcp,<0.6065.0>,undefined,
          [{port,5223},
           {tls_module,ssl},
           {ssl,true},
           {ssl_opts,[{verify,verify_none}]},
           {username,
             <<"alicE_token_auth_fails_when_token_is_not_found_421">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {host,<<"localhost">>},
           {stream_id,<<"9ed74180901fcff7">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {sasl2_helper,receive_features,3,
       [{file,"/home/circleci/project/big_tests/tests/sasl2_helper.erl"},
        {line,229}]},
     {sasl2_helper,apply_steps,4,
       [{file,"/home/circleci/project/big_tests/tests/sasl2_helper.erl"},
        {line,47}]},
     {fast_SUITE,token_auth_fails_when_token_is_not_found,1,
       [{file,"/home/circleci/project/big_tests/tests/fast_SUITE.erl"},
        {line,122}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1794}]},
     {test_server,run_test_case_eval1,6,
       [{file,"test_server.erl"},{line,1303}]},
     {test_server,run_test_case_eval,9,
       [{file,"test_server.erl"},{line,1235}]}]}}

Report log


pgsql_mnesia_26 / pgsql_mnesia / 15e855a
Reports root/ big
OK: 5146 / Failed: 1 / User-skipped: 128 / Auto-skipped: 0

fast_SUITE:basic:token_auth_fails_when_token_is_not_found
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alicE_token_auth_fails_when_token_is_not_found_405@localhost">>,
          escalus_tcp,<0.6013.0>,undefined,
          [{port,5223},
           {tls_module,ssl},
           {ssl,true},
           {ssl_opts,[{verify,verify_none}]},
           {username,
             <<"alicE_token_auth_fails_when_token_is_not_found_405">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {host,<<"localhost">>},
           {stream_id,<<"121cf141537fd603">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {sasl2_helper,receive_features,3,
       [{file,"/home/circleci/project/big_tests/tests/sasl2_helper.erl"},
        {line,229}]},
     {sasl2_helper,apply_steps,4,
       [{file,"/home/circleci/project/big_tests/tests/sasl2_helper.erl"},
        {line,47}]},
     {fast_SUITE,token_auth_fails_when_token_is_not_found,1,
       [{file,"/home/circleci/project/big_tests/tests/fast_SUITE.erl"},
        {line,122}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1793}]},
     {test_server,run_test_case_eval1,6,
       [{file,"test_server.erl"},{line,1302}]},
     {test_server,run_test_case_eval,9,
       [{file,"test_server.erl"},{line,1234}]}]}}

Report log


mysql_redis_27 / mysql_redis / 15e855a
Reports root/ big
OK: 5126 / Failed: 2 / User-skipped: 147 / Auto-skipped: 0

fast_SUITE:basic:token_auth_fails_when_token_is_not_found
{error,
  {timeout_when_waiting_for_stanza,
    [{escalus_client,wait_for_stanza,
       [{client,
          <<"alicE_token_auth_fails_when_token_is_not_found_403@localhost">>,
          escalus_tcp,<0.6005.0>,undefined,
          [{port,5223},
           {tls_module,ssl},
           {ssl,true},
           {ssl_opts,[{verify,verify_none}]},
           {username,
             <<"alicE_token_auth_fails_when_token_is_not_found_403">>},
           {server,<<"localhost">>},
           {password,<<"matygrysa">>},
           {host,<<"localhost">>},
           {stream_id,<<"ab8b78b47b437ca0">>}]},
        5000],
       [{file,
          "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
        {line,136}]},
     {sasl2_helper,receive_features,3,
       [{file,"/home/circleci/project/big_tests/tests/sasl2_helper.erl"},
        {line,229}]},
     {sasl2_helper,apply_steps,4,
       [{file,"/home/circleci/project/big_tests/tests/sasl2_helper.erl"},
        {line,47}]},
     {fast_SUITE,token_auth_fails_when_token_is_not_found,1,
       [{file,"/home/circleci/project/big_tests/tests/fast_SUITE.erl"},
        {line,122}]},
     {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1794}]},
     {test_server,run_test_case_eval1,6,
       [{file,"test_server.erl"},{line,1303}]},
     {test_server,run_test_case_eval,9,
       [{file,"test_server.erl"},{line,1235}]}]}}

Report log

carboncopy_SUITE:one2one:dropped_client_doesnt_create_duplicate_carbons
{error,
  {{badmatch,
     [{xmlel,<<"message">>,
        [{<<"from">>,
        <<"alice_dropped_client_doesnt_create_duplicate_carbons_598@localhost">>},
         {<<"to">>,
        <<"alice_dropped_client_doesnt_create_duplicate_carbons_598@localhost/res2">>},
         {<<"xmlns">>,<<"jabber:client">>},
         {<<"type">>,<<"chat">>}],
        [{xmlel,<<"sent">>,
           [{<<"xmlns">>,<<"urn:xmpp:carbons:2">>}],
           [{xmlel,<<"forwarded">>,
            [{<<"xmlns">>,<<"urn:xmpp:forward:0">>}],
            [{xmlel,<<"message">>,
               [{<<"from">>,
                 <<"alice_dropped_client_doesnt_create_duplicate_carbons_598@localhost/res1">>},
                {<<"type">>,<<"chat">>},
                {<<"to">>,
                 <<"bob_dropped_client_doesnt_create_duplicate_carbons_598@localhost/res1">>},
                {<<"xmlns">>,<<"jabber:client">>}],
               [{xmlel,<<"body">>,[],
                  [{xmlcdata,
                     <<"And pious action">>}]}]}]}]}]}]},
   [{carboncopy_SUITE,
      '-dropped_client_doesnt_create_duplicate_carbons/1-fun-0-',4,
      [{file,
         "/home/circleci/project/big_tests/tests/carboncopy_SUITE.erl"},
       {line,189}]},
    {escalus_story,story,4,
      [{file,
         "/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
       {line,72}]},
    {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1794}]},
    {test_server,run_test_case_eval1,6,
      [{file,"test_serv...

Report log

Copy link

codecov bot commented Oct 1, 2024

Codecov Report

Attention: Patch coverage is 84.13793% with 23 lines in your changes missing coverage. Please review.

Project coverage is 82.42%. Comparing base (938c4d0) to head (15e855a).

Files with missing lines Patch % Lines
src/fast/mod_fast.erl 84.21% 9 Missing ⚠️
src/fast/mod_fast_rdbms.erl 82.35% 6 Missing ⚠️
src/fast/mod_fast_backend.erl 71.42% 4 Missing ⚠️
src/c2s/mongoose_c2s.erl 60.00% 2 Missing ⚠️
src/fast/mod_fast_generic.erl 92.30% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4379      +/-   ##
==========================================
- Coverage   85.21%   82.42%   -2.80%     
==========================================
  Files         549      554       +5     
  Lines       33811    33949     +138     
==========================================
- Hits        28812    27981     -831     
- Misses       4999     5968     +969     
Flag Coverage Δ
82.42% <84.13%> (+11.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants