| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- //-----------------------------------------------------------------------------
- // Copyright (c) Microsoft Corporation. All rights reserved.
- //-----------------------------------------------------------------------------
- namespace System.ServiceModel.Security
- {
- using System.ServiceModel;
- public sealed class UserNamePasswordClientCredential
- {
- string userName;
- string password;
- bool isReadOnly;
- internal UserNamePasswordClientCredential()
- {
- // empty
- }
- internal UserNamePasswordClientCredential(UserNamePasswordClientCredential other)
- {
- this.userName = other.userName;
- this.password = other.password;
- this.isReadOnly = other.isReadOnly;
- }
- public string UserName
- {
- get
- {
- return this.userName;
- }
- set
- {
- ThrowIfImmutable();
- this.userName = value;
- }
- }
- public string Password
- {
- get
- {
- return this.password;
- }
- set
- {
- ThrowIfImmutable();
- this.password = value;
- }
- }
- internal void MakeReadOnly()
- {
- this.isReadOnly = true;
- }
- void ThrowIfImmutable()
- {
- if (this.isReadOnly)
- {
- throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.ObjectIsReadOnly)));
- }
- }
- }
- }
|