Beispiel #1
0
        private void Snippet1()
        {
            //<snippet1>
            // Create a service host.
            Uri         httpUri = new Uri("http://localhost/Calculator");
            ServiceHost sh      = new ServiceHost(typeof(Calculator), httpUri);

            // Create a binding that uses a WindowsServiceCredential.
            WSHttpBinding b = new WSHttpBinding(SecurityMode.Message);

            b.Security.Message.ClientCredentialType = MessageCredentialType.Windows;

            // Add an endpoint.
            sh.AddServiceEndpoint(typeof(ICalculator), b, "WindowsCalculator");

            // Get a reference to the WindowsServiceCredential object.
            WindowsServiceCredential winCredential =
                sh.Credentials.WindowsAuthentication;

            // Print out values.
            Console.WriteLine("IncludeWindowsGroup: {0}",
                              winCredential.IncludeWindowsGroups);
            Console.WriteLine("UserNamePasswordValidationMode: {0}",
                              winCredential.AllowAnonymousLogons);

            Console.ReadLine();
            //</snippet1>
        }
 internal void ApplyConfiguration(WindowsServiceCredential windows)
 {
     if (windows == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("windows");
     }
     windows.AllowAnonymousLogons = this.AllowAnonymousLogons;
     windows.IncludeWindowsGroups = this.IncludeWindowsGroups;
 }
Beispiel #3
0
 public ServiceCredentials()
 {
     UserNameAuthentication           = new UserNamePasswordServiceCredential();
     ClientCertificate                = new X509CertificateInitiatorServiceCredential();
     ServiceCertificate               = new X509CertificateRecipientServiceCredential();
     WindowsAuthentication            = new WindowsServiceCredential();
     IssuedTokenAuthentication        = new IssuedTokenServiceCredential();
     SecureConversationAuthentication = new SecureConversationServiceCredential();
     _exceptionMapper = new ExceptionMapper();
 }
Beispiel #4
0
 public ServiceCredentials()
 {
     userName                = new UserNamePasswordServiceCredential();
     clientCertificate       = new X509CertificateInitiatorServiceCredential();
     serviceCertificate      = new X509CertificateRecipientServiceCredential();
     windows                 = new WindowsServiceCredential();
     this.issuedToken        = new IssuedTokenServiceCredential();
     this.secureConversation = new SecureConversationServiceCredential();
     exceptionMapper         = new ExceptionMapper();
 }
 public ServiceCredentials()
 {
     this.userName           = new UserNamePasswordServiceCredential();
     this.clientCertificate  = new X509CertificateInitiatorServiceCredential();
     this.serviceCertificate = new X509CertificateRecipientServiceCredential();
     this.windows            = new WindowsServiceCredential();
     this.issuedToken        = new IssuedTokenServiceCredential();
     this.peer = new PeerCredential();
     this.secureConversation = new SecureConversationServiceCredential();
 }
 protected ServiceCredentials(ServiceCredentials other)
 {
     if (other == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("other");
     }
     this.userName           = new UserNamePasswordServiceCredential(other.userName);
     this.clientCertificate  = new X509CertificateInitiatorServiceCredential(other.clientCertificate);
     this.serviceCertificate = new X509CertificateRecipientServiceCredential(other.serviceCertificate);
     this.windows            = new WindowsServiceCredential(other.windows);
     this.issuedToken        = new IssuedTokenServiceCredential(other.issuedToken);
     this.peer = new PeerCredential(other.peer);
     this.secureConversation = new SecureConversationServiceCredential(other.secureConversation);
 }
Beispiel #7
0
 protected ServiceCredentials(ServiceCredentials other)
 {
     if (other == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(other));
     }
     UserNameAuthentication           = new UserNamePasswordServiceCredential(other.UserNameAuthentication);
     ClientCertificate                = new X509CertificateInitiatorServiceCredential(other.ClientCertificate);
     ServiceCertificate               = new X509CertificateRecipientServiceCredential(other.ServiceCertificate);
     WindowsAuthentication            = new WindowsServiceCredential(other.WindowsAuthentication);
     IssuedTokenAuthentication        = new IssuedTokenServiceCredential(other.IssuedTokenAuthentication);
     SecureConversationAuthentication = new SecureConversationServiceCredential(other.SecureConversationAuthentication);
     _saveBootstrapTokenInSession     = other._saveBootstrapTokenInSession;
     _exceptionMapper = other._exceptionMapper;
 }
Beispiel #8
0
 protected ServiceCredentials(ServiceCredentials other)
 {
     if (other == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(other));
     }
     userName                    = new UserNamePasswordServiceCredential(other.userName);
     clientCertificate           = new X509CertificateInitiatorServiceCredential(other.clientCertificate);
     serviceCertificate          = new X509CertificateRecipientServiceCredential(other.serviceCertificate);
     windows                     = new WindowsServiceCredential(other.windows);
     this.issuedToken            = new IssuedTokenServiceCredential(other.issuedToken);
     this.secureConversation     = new SecureConversationServiceCredential(other.secureConversation);
     saveBootstrapTokenInSession = other.saveBootstrapTokenInSession;
     exceptionMapper             = other.exceptionMapper;
 }
 internal WindowsServiceCredential(WindowsServiceCredential other)
 {
     this.allowAnonymousLogons = other.allowAnonymousLogons;
     this.includeWindowsGroups = other.includeWindowsGroups;
     this.isReadOnly = other.isReadOnly;
 }
 internal WindowsServiceCredential(WindowsServiceCredential other)
 {
     this.allowAnonymousLogons = other.allowAnonymousLogons;
     this.includeWindowsGroups = other.includeWindowsGroups;
     this.isReadOnly           = other.isReadOnly;
 }