示例#1
0
 public void OnClickAddButton(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(TxtUsername.StringValue))
     {
         UIErrorHelper.ShowAlert("Please enter valid username", "Alert");
     }
     else if (string.IsNullOrEmpty(TxtPassword.StringValue))
     {
         UIErrorHelper.ShowAlert("Please enter valid Password", "Alert");
     }
     else if (string.IsNullOrEmpty(TxtDomain.StringValue))
     {
         UIErrorHelper.ShowAlert("Please enter valid Domain", "Alert");
     }
     else
     {
         ActiveDirectoryJoinRequestDto = new ActiveDirectoryJoinRequestDto()
         {
             Username           = TxtUsername.StringValue,
             Password           = TxtPassword.StringValue,
             Domain             = TxtDomain.StringValue,
             OrganizationalUnit = TxtOU.StringValue
         };
         this.Close();
         NSApplication.SharedApplication.StopModalWithCode(1);
     }
 }
        private bool LeaveActiveDirectory(ActiveDirectoryJoinRequestDto dto)
        {
            bool success = false;

            ActionHelper.Execute(delegate() {
                var auth           = SnapInContext.Instance.AuthTokenManager.GetAuthToken(Server);
                var credentialsDto = new CredentialsDto {
                    Username = dto.Username, Password = dto.Password
                };
                success = SnapInContext.Instance.ServiceGateway.Adf.LeaveActiveDirectory(auth.ServerDto, credentialsDto, auth.Token);
            });
            return(success);
        }
示例#3
0
        public ActiveDirectoryJoinInfoDto JoinActiveDirectory(ServerDto server, ActiveDirectoryJoinRequestDto ad, Token token)
        {
            var url  = string.Format(_serviceConfigManager.GetAdfEndPoint(), server.Protocol, server.ServerName, server.Port);
            var json = JsonConvert.Serialize(ad);

            ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
            var requestConfig = new RequestSettings
            {
                Method = HttpMethod.Post,
            };
            var headers = ServiceHelper.AddHeaders(ServiceConstants.JsonContentType);

            json = "access_token=" + token.AccessToken + "&token_type=" + token.TokenType.ToString().ToLower() + "&" + json;
            var response = _webRequestManager.GetResponse(url, requestConfig, headers, null, json);

            return(JsonConvert.Deserialize <ActiveDirectoryJoinInfoDto>(response));
        }
        public void OnClickAddButton(object sender, EventArgs e)
        {
            var activeDirectoryJoinRequestDto = new ActiveDirectoryJoinRequestDto()
            {
                Username           = TxtUsername.StringValue,
                Password           = TxtPassword.StringValue,
                Domain             = TxtDomain.StringValue,
                OrganizationalUnit = TxtOU.StringValue
            };
            var success = LeaveActiveDirectory(activeDirectoryJoinRequestDto);

            if (success)
            {
                UIErrorHelper.ShowAlert("AD leave operation was succesful. Please reboot the node.", "Information");
            }
            else
            {
                UIErrorHelper.ShowAlert("AD leave operation failed.", "Information");
                return;
            }
            this.Close();
            NSApplication.SharedApplication.StopModalWithCode(1);
        }
示例#5
0
        private ActiveDirectoryJoinInfoDto JoinActiveDirectory(ActiveDirectoryJoinRequestDto dto)
        {
            var auth = SnapInContext.Instance.AuthTokenManager.GetAuthToken(DisplayName);

            return(SnapInContext.Instance.ServiceGateway.Adf.JoinActiveDirectory(auth.ServerDto, dto, auth.Token));
        }