Ejemplo n.º 1
0
        public ClientControl(CredentialType credentialType, ErrorControl errorControl)
        {
            _credentialType = credentialType;
            ErrorControl    = errorControl;

            switch (credentialType)
            {
            case CredentialType.None:
                break;

            case CredentialType.AdminCredential:
                break;

            case CredentialType.UserCredential:
                _defaultClient = new FIMServiceClient()
                {
                    ClientCredential = CredentialCache.DefaultCredentials as NetworkCredential
                };
                break;

            case CredentialType.ServiceCredential:
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
        public ClientControl(string userName, string password, string domain, ErrorControl errorControl)
        {
            _credentialType = CredentialType.AdminCredential;
            ErrorControl    = errorControl;

            _defaultClient = new FIMServiceClient()
            {
                ClientCredential = new NetworkCredential(userName, password, domain)
            };
        }
Ejemplo n.º 3
0
        public ClientControl(
            ErrorControl errorControl,
            EndpointAddress mexEndpoint, EndpointAddress resourceEndpoint, EndpointAddress resourceFactoryEndpoint, EndpointAddress enumerationEndpoint)
        {
            _credentialType = CredentialType.AdminCredential;
            ErrorControl    = errorControl;

            _defaultClient = new FIMServiceClient(mexEndpoint, resourceEndpoint, resourceFactoryEndpoint, enumerationEndpoint)
            {
                ClientCredential = CredentialCache.DefaultCredentials as NetworkCredential
            };
        }
Ejemplo n.º 4
0
        public ClientControl(
            string userName, string password, string domain, ErrorControl errorControl,
            EndpointAddress mexEndpoint, EndpointAddress resourceEndpoint, EndpointAddress resourceFactoryEndpoint, EndpointAddress enumerationEndpoint)
        {
            _credentialType = CredentialType.AdminCredential;
            ErrorControl    = errorControl;

            _defaultClient = new FIMServiceClient(mexEndpoint, resourceEndpoint, resourceFactoryEndpoint, enumerationEndpoint)
            {
                ClientCredential = new NetworkCredential(userName, password, domain)
            };
        }
Ejemplo n.º 5
0
        private void HandleError(Exception e)
        {
            string faultType = GetExceptionFaultType(e);

            if (faultType.Equals(typeof(Faults.PermissionDeniedFault).ToString()))
            {
                ErrorControl.AddError(new ErrorData(@"Permission denied", faultType));
            }
            else if (faultType.Equals(typeof(Faults.AuthenticationRequiredFault).ToString()))
            {
                ErrorControl.AddError(new ErrorData(@"Authentication failed", faultType));
            }
            else if (faultType.Equals(typeof(Faults.AuthorizationRequiredFault).ToString()))
            {
                ErrorControl.AddError(new ErrorData(@"Operation need to be authorized", faultType));
            }
            else
            {
                ErrorControl.AddError(new ErrorData(@"Unknown error", faultType));
            }
        }