Example #1
0
            protected internal async override Task init()
            {
                var response = await Session.CallAsync(AuthRequest.Login(Parameters.Company, Parameters.Username, Parameters.Password), () => Cookies);

                var accountCookie = Session.Cache.Get("HrbcAccount") as string;

                Session.Logger.LogDebug($"AuthSession init session: {response.Session} HRBCACCOUNT={accountCookie}");
                this.Parameters = (response.IsSuccess)
                    ? PrivateAuthentication.WithSession(response.Session, accountCookie, Parameters)
                    : PrivateAuthentication.NoCredentials;
            }
Example #2
0
            protected internal async override Task init()
            {
                var response = await Session.CallAsync(AuthRequest.Login(Parameters.Company, Parameters.Username, Parameters.Password), () => Cookies);

                this.Parameters = (response.IsSuccess) ? PrivateAuthentication.WithSession(response.Session, Parameters) : PrivateAuthentication.NoCredentials;
            }
Example #3
0
 public LoginAuthSession(PrivateClient client, PrivateSession session, PrivateAuthentication authParameters) : base(client, session, authParameters)
 {
 }
Example #4
0
 internal static PrivateAuthentication WithSession(string session, PrivateAuthentication credentials)
 {
     return(new PrivateAuthentication(credentials.Company, credentials.Username, credentials.Password, session));
 }
 internal static PrivateAuthentication WithSession(string session, string accountinfo, PrivateAuthentication credentials)
 {
     if (!string.IsNullOrEmpty(accountinfo))
     {
         int company = 0;
         int user    = 0;
         var s       = accountinfo.Split('-');
         if (s.Length == 2 && int.TryParse(s[0], out company) && int.TryParse(s[1], out user))
         {
             return(new PrivateAuthentication(credentials.Company, credentials.Username, credentials.Password, session, company, user));
         }
     }
     return(new PrivateAuthentication(credentials.Company, credentials.Username, credentials.Password, session));
 }