//-----------------------------------------------------------------------
//
// Copyright (c) Outercurve Foundation. All rights reserved.
//
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.Runtime.InteropServices;
using System.Security.Principal;
using DotNetOpenAuth.Messaging;
///
/// Represents an OAuth consumer that is impersonating a known user on the system.
///
[SuppressMessage("Microsoft.Interoperability", "CA1409:ComVisibleTypesShouldBeCreatable", Justification = "Not cocreatable.")]
[Serializable]
[ComVisible(true)]
public class OAuthIdentity : IIdentity {
///
/// Initializes a new instance of the class.
///
/// The username.
internal OAuthIdentity(string username) {
Requires.NotNullOrEmpty(username, "username");
this.Name = username;
}
#region IIdentity Members
///
/// Gets the type of authentication used.
///
/// The constant "OAuth"
///
/// The type of authentication used to identify the user.
///
public string AuthenticationType {
get { return "OAuth"; }
}
///
/// Gets a value indicating whether the user has been authenticated.
///
/// The value true
/// true if the user was authenticated; otherwise, false.
///
public bool IsAuthenticated {
get { return true; }
}
///
/// Gets the name of the user who authorized the OAuth token the consumer is using for authorization.
///
///
/// The name of the user on whose behalf the code is running.
///
public string Name { get; private set; }
#endregion
}
}