e79aa3c0ed
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
67 lines
1.6 KiB
C#
67 lines
1.6 KiB
C#
//-----------------------------------------------------------------------------
|
|
// 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)));
|
|
}
|
|
}
|
|
}
|
|
}
|