aboutsummaryrefslogtreecommitdiff
path: root/SocketHttpListener.Portable/Net/HttpListenerBasicIdentity.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-12-18 00:44:33 -0500
committerGitHub <noreply@github.com>2016-12-18 00:44:33 -0500
commite7cebb91a73354dc3e0d0b6340c9fbd6511f4406 (patch)
tree6f1c368c766c17b7514fe749c0e92e69cd89194a /SocketHttpListener.Portable/Net/HttpListenerBasicIdentity.cs
parent025905a3e4d50b9a2e07fbf4ff0a203af6604ced (diff)
parentaaa027f3229073e9a40756c3157d41af2a442922 (diff)
Merge pull request #2350 from MediaBrowser/beta
Beta
Diffstat (limited to 'SocketHttpListener.Portable/Net/HttpListenerBasicIdentity.cs')
-rw-r--r--SocketHttpListener.Portable/Net/HttpListenerBasicIdentity.cs70
1 files changed, 70 insertions, 0 deletions
diff --git a/SocketHttpListener.Portable/Net/HttpListenerBasicIdentity.cs b/SocketHttpListener.Portable/Net/HttpListenerBasicIdentity.cs
new file mode 100644
index 000000000..faa26693d
--- /dev/null
+++ b/SocketHttpListener.Portable/Net/HttpListenerBasicIdentity.cs
@@ -0,0 +1,70 @@
+using System.Security.Principal;
+
+namespace SocketHttpListener.Net
+{
+ public class HttpListenerBasicIdentity : GenericIdentity
+ {
+ string password;
+
+ public HttpListenerBasicIdentity(string username, string password)
+ : base(username, "Basic")
+ {
+ this.password = password;
+ }
+
+ public virtual string Password
+ {
+ get { return password; }
+ }
+ }
+
+ public class GenericIdentity : IIdentity
+ {
+ private string m_name;
+ private string m_type;
+
+ public GenericIdentity(string name)
+ {
+ if (name == null)
+ throw new System.ArgumentNullException("name");
+
+ m_name = name;
+ m_type = "";
+ }
+
+ public GenericIdentity(string name, string type)
+ {
+ if (name == null)
+ throw new System.ArgumentNullException("name");
+ if (type == null)
+ throw new System.ArgumentNullException("type");
+
+ m_name = name;
+ m_type = type;
+ }
+
+ public virtual string Name
+ {
+ get
+ {
+ return m_name;
+ }
+ }
+
+ public virtual string AuthenticationType
+ {
+ get
+ {
+ return m_type;
+ }
+ }
+
+ public virtual bool IsAuthenticated
+ {
+ get
+ {
+ return !m_name.Equals("");
+ }
+ }
+ }
+}