Пример #1
0
        protected override bool Execute()
        {
            Login_ADO lAdo = new Login_ADO(Ado);

            if (lAdo.ReadOpen1Fa(DTO.CcnEmail))
            {
                Response.data = JSONRPC.success;
                return(true);
            }
            return(false);
        }
Пример #2
0
        internal string Update1FaTokenForUser(string CcnUsername, string Token)
        {
            Login_ADO lAdo = new Login_ADO(ado);

            if (lAdo.Update1FaTokenForUser(CcnUsername, Token) > 0)
            {
                return(Token);
            }
            else
            {
                return(null);
            }
        }
Пример #3
0
        internal string Update2FA(Login_DTO_Create2FA dto)
        {
            Login_ADO lAdo     = new Login_ADO(ado);
            string    login2FA = TwoFA.GenerateSharedSecret();

            if (lAdo.Update2FA(dto, login2FA) > 0)
            {
                return(login2FA);
            }
            else
            {
                return(null);
            }
        }
Пример #4
0
        internal static void ExtendSession(ADO extendAdo, string CcnUsername)
        {
            try
            {
                DateTime expiry = DateTime.Now.AddSeconds(Configuration_BSO.GetCustomConfig(ConfigType.global, "session.length"));

                Login_ADO lAdo = new Login_ADO(extendAdo);

                lAdo.ExtendSession(CcnUsername, expiry);
            }
            catch (Exception ex)
            {
                //Swallow the error but log the error message.
                Log.Instance.Error("Failed to extend the user session - error message: " + ex.Message);
            }
        }
Пример #5
0
        protected override bool Execute()
        {
            Login_ADO lAdo = new Login_ADO(Ado);

            if (Request.sessionCookie != null)
            {
                lAdo.Logout(Request.sessionCookie.Value);
            }

            Response.sessionCookie = new HttpCookie(API.Common.SessionCookieName)
            {
                Expires = DateTime.Now
            };
            Response.data = JSONRPC.success;
            return(true);
        }
Пример #6
0
        protected override bool Execute()
        {
            Login_BSO lBso = new Login_BSO(Ado);

            Account_ADO aAdo = new Account_ADO();

            ADO_readerOutput response = aAdo.Read(Ado, DTO.CcnEmail);



            if (!response.hasData)
            {
                ActiveDirectory_ADO adAdo = new ActiveDirectory_ADO();
                //adAdo.MergeAdToUsers(ref result);

                var adResult = adAdo.GetAdSpecificDataForEmail(DTO.CcnEmail);


                ////Email address not in the login table, try to get the username from the email address via AD
                //PrincipalContext context = new PrincipalContext(ContextType.Domain);
                //user = UserPrincipal.FindByIdentity(context, DTO.CcnEmail).Name;

                if (adResult == null)
                {
                    Response.error = Label.Get("error.authentication");
                    return(false);
                }


                DTO.CcnUsername = adResult.CcnUsername;
            }
            else
            {
                DTO.CcnUsername = response.data[0].CcnUsername;
            }

            Login_ADO lAdo = new Login_ADO(Ado);

            if (lAdo.ReadOpen2Fa(DTO.CcnUsername))
            {
                Response.data = JSONRPC.success;
                return(true);
            }
            return(false);
        }
Пример #7
0
        internal bool CreateLogin(Login_DTO_Create dto, string samAccountName, string token = null)
        {
            Login_ADO lAdo = new Login_ADO(ado);

            return(lAdo.CreateLogin(dto, samAccountName, token) > 0);
        }
Пример #8
0
        internal int UpdateInvitationToken2Fa(string ccnUsername, string token)
        {
            Login_ADO lAdo = new Login_ADO(ado);

            return(lAdo.UpdateInvitationToken2Fa(ccnUsername, token));
        }
Пример #9
0
        internal bool Update1FA(Login_DTO_Create1FA dto, string NewToken)
        {
            Login_ADO lAdo = new Login_ADO(ado);

            return(lAdo.Update1FA(dto, NewToken) > 0);
        }
Пример #10
0
        internal bool CreateSession(string LgnSession, DateTime expiry, string CcnUsername)
        {
            Login_ADO lAdo = new Login_ADO(ado);

            return(lAdo.CreateSession(LgnSession, expiry, CcnUsername));;
        }
Пример #11
0
        internal ADO_readerOutput Validate1Fa(string Login1Fa, string CcnUsername)
        {
            Login_ADO lAdo = new Login_ADO(ado);

            return(lAdo.Validate1Fa(CcnUsername, Login1Fa));
        }
Пример #12
0
        internal ADO_readerOutput ReadBySession(string token)
        {
            Login_ADO lAdo = new Login_ADO(ado);

            return(lAdo.ReadBySession(token));
        }
Пример #13
0
        internal ADO_readerOutput ReadByToken2Fa(string token, string ccnUsername)
        {
            Login_ADO lAdo = new Login_ADO(ado);

            return(lAdo.ReadBy2FaToken(token, ccnUsername));
        }