AuthorizationManager duplicate logins

Home Forums kbmMW AuthorizationManager duplicate logins

Viewing 3 reply threads
  • Author
    Posts
    • #56056
      Babis Michael
      Participant

      Hello,

      Any ideas why i get double logins on a couple of clients (randomly) with mwaoAutoLogin ?

      From logs i see the same ip and port:
      01/12/2021 04:21| 79.129.108.174:9581 Login [HELENGAR]
      01/12/2021 04:21| 79.129.108.174:9581 Login [HELENGAR]

      Thank you

    • #56065
      kimbomadsen
      Keymaster

      Hi,

      Most likely because the client do not provide the Token for subsequent requests. The token should be returned to the client upon first request where you log the client in and all the client’s requests should provide that token instead of the username/password.

      Kim/C4D

      • #56067
        Babis Michael
        Participant

        Hello,

        I do clear the token if i detect disconnection from the server because if i do not do that the Server’s AuthorizationManagerLogin will not fire when the server restarts.

        Example:

        Run the Server
        Run the Client
        Client connects and Server’s AuthorizationManagerLogin will fire (Client.Token will get a value)
        Close Server
        Run Server
        Client will connect but AuthorizationManagerLogin will not fire.

        Thank you

    • #56114
      Babis Michael
      Participant

      UP

    • #56128
      kimbomadsen
      Keymaster

      The only thing I can think of, is that the clients somehow are using/getting the same token?

      • #56367
        Babis Michael
        Participant

        Hello Kim,
        Checked that and no!

        The “Trace” of duplicate login:

        30/03/2022 09:31| 635450D7EE5A422991BB89EDA6132A6C TRACE: MyUser:33088) Login: Logged in. Actor=MyUser:33088, Role=USER, Location=127.0.0.1:33088 At(UTC)=30/3/2022 6:31:56 πμ
        30/03/2022 09:47| 635450D7EE5A422991BB89EDA6132A6C TRACE: MyUser:33088) Logout: LoginToken=635450D7EE5A422991BB89EDA6132A6C
        30/03/2022 09:47| 404D861FAB464DBD9D832D1B150AD166 TRACE: MyUser:53421) Login: Logged in. Actor=MyUser:53421, Role=USER, Location=127.0.0.1:53421 At(UTC)=30/3/2022 6:47:43 πμ
        30/03/2022 10:06| 404D861FAB464DBD9D832D1B150AD166 TRACE: MyUser:53421) Logout: LoginToken=404D861FAB464DBD9D832D1B150AD166
        30/03/2022 10:08| A41785AAF86E4B6CA4B24DA82ACBA9E6 TRACE: MyUser:54034) Login: Logged in. Actor=MyUser:54034, Role=USER, Location=127.0.0.1:54034 At(UTC)=30/3/2022 7:08:02 πμ
        30/03/2022 10:08| TRACE: MyUser:54034) Login: Actor already logged in. Actor MyUser:54034, Role=USER, At(UTC)=30/3/2022 7:08:02 πμ // <— HERE!!! It attempts for the 2nd time to login but it’s already logged as you can see above
        30/03/2022 10:08| A41785AAF86E4B6CA4B24DA82ACBA9E6 TRACE: MyUser:54034) Logout: LoginToken=A41785AAF86E4B6CA4B24DA82ACBA9E6
        30/03/2022 10:08| 7B606826CA9E4F3B84BA89CEDC590971 TRACE: MyUser:54036) Login: Logged in. Actor=MyUser:54036, Role=USER, Location=127.0.0.1:54036 At(UTC)=30/3/2022 7:08:03 πμ

        If the user is already logged in it will still call “OnLoginSucces” so can you add a flags to “ctx” to know that the user is already logged ?
        eg:

        ctx.AlreadyLogged := True; // <– add this new variable
        ctx.Message:=’Already logged in’;
        ctx.TraceMessage:=’Login: Actor already logged in. Actor ‘+ctx.Actor.Name+’, Role=’+ctx.Role.Name+’, At(UTC)=’+DateTimeToStr(Result.LastAuthorized);
        DoOnLoginSuccess(ctx);

        Thank you

         

         

        • This reply was modified 3 years, 8 months ago by Babis Michael.
        • #56369
          Babis Michael
          Participant

          I found a better solution!
          Since our user is already logged in we shouldn’t call DoOnLoginSuccess(ctx); because it’s already called the first time!

          ctx.TraceMessage:=’Login: Actor already logged in. Actor ‘+ctx.Actor.Name+’, Role=’+ctx.Role.Name+’, At(UTC)=’+DateTimeToStr(Result.LastAuthorized);
          //DoOnLoginSuccess(ctx); <– Remove me!

          • This reply was modified 3 years, 8 months ago by Babis Michael.
          • #56501
            kimbomadsen
            Keymaster

            I agree on your last suggestion so will remove the call to DoOnLoginSuccess when the user is already logged in.

            /Kim/C4D

Viewing 3 reply threads
  • You must be logged in to reply to this topic.