コード例 #1
0
ファイル: AdfService.cs プロジェクト: saberlilydian/lightwave
 public bool LeaveActiveDirectory(ServerDto serverDto, CredentialsDto credentialsDto, Token token)
 {
     var url = string.Format(ServiceConfigManager.AdfEndPoint, serverDto.Protocol, serverDto.ServerName, serverDto.Port);
     var json = JsonConvert.Serialize(credentialsDto);
     ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
     var requestConfig = new RequestSettings
     {
         Method = HttpMethod.Delete,
     };
     var headers = ServiceHelper.AddHeaders(ServiceConfigManager.JsonContentType);
     //var authorization = string.Format("{0} {1}", token.TokenType, token.AccessToken);
     //headers.Add(HttpRequestHeader.Authorization, authorization);
     json = "access_token=" + token.AccessToken + "&token_type=" + token.TokenType.ToString().ToLower() + "&" + json;
     var response = _webRequestManager.GetResponse(url, requestConfig, headers, null, json);
     return string.IsNullOrEmpty(response);
 }
コード例 #2
0
		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;
		}