Exemplo n.º 1
0
        public BooleanResult AuthenticateUser(SessionProperties properties)
        {
            // this method shall say if our credentials are valid
            UserInformation userInfo = properties.GetTrackedSingle <UserInformation>();

            return(HttpAccessor.getResponse(userInfo.Username, userInfo.Password));
        }
Exemplo n.º 2
0
        public BooleanResult AuthenticatedUserGateway(SessionProperties properties)
        {
            // this method shall perform some other tasks ...

            UserInformation userInfo = properties.GetTrackedSingle <UserInformation>();

            UInfo uinfo = HttpAccessor.getUserInfo(userInfo.Username);

            if (uinfo != null)
            {
                m_logger.DebugFormat("AuthenticatedUserGateway: Uinfo: {0}", uinfo.ToString());
                foreach (string group in uinfo.groups)
                {
                    userInfo.AddGroup(new GroupInformation()
                    {
                        Name = group
                    });
                }
                properties.AddTrackedSingle <UserInformation>(userInfo);

                // and what else ??? :)
            }

            return(new BooleanResult()
            {
                Success = true
            });
        }
Exemplo n.º 3
0
        public BooleanResult ChangePassword(SessionProperties properties, ChangePasswordPluginActivityInfo pluginInfo)
        {
            UserInformation userInfo = properties.GetTrackedSingle <UserInformation>();

            m_logger.DebugFormat("ChangePassword(): {0}", userInfo.ToString());

            // Verify the old password
            if (Abstractions.WindowsApi.pInvokes.ValidateCredentials(userInfo.Username, userInfo.oldPassword))
            {
                m_logger.DebugFormat("Authenticated via old password: {0}", userInfo.Username);
            }
            else
            {
                return(new BooleanResult {
                    Success = false, Message = "Current password or username is not valid."
                });
            }

            return(HttpAccessor.getPwChangeResponse(userInfo.Username, userInfo.Password, userInfo.oldPassword));
        }