Пример #1
0
        public BooleanResult AuthenticatedUserGateway(SessionProperties properties)
        {
            // this method shall perform some other tasks ...

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

            UInfo uinfo = CognitoAccessor.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
            });
        }
Пример #2
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(CognitoAccessor.getPwChangeResponse(userInfo.Username, userInfo.Password, userInfo.oldPassword));
        }