You've already forked linux-packaging-mono
Imported Upstream version 3.10.0
Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
//
|
||||
// System.Security.Principal.GenericIdentity.cs
|
||||
//
|
||||
// Author:
|
||||
// Authors:
|
||||
// Miguel de Icaza (miguel@ximian.com)
|
||||
// Marek Safar (marek.safar@gmail.com)
|
||||
//
|
||||
// (C) Ximian, Inc. http://www.ximian.com
|
||||
// Copyright (C) 2004-2006 Novell, Inc (http://www.novell.com)
|
||||
@ -28,12 +29,22 @@
|
||||
//
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
#if NET_4_5
|
||||
using System.Security.Claims;
|
||||
#endif
|
||||
|
||||
namespace System.Security.Principal {
|
||||
|
||||
[Serializable]
|
||||
[ComVisible (true)]
|
||||
public class GenericIdentity : IIdentity {
|
||||
public class GenericIdentity :
|
||||
#if NET_4_5
|
||||
ClaimsIdentity
|
||||
#else
|
||||
IIdentity
|
||||
#endif
|
||||
{
|
||||
|
||||
// field names are serialization compatible with .net
|
||||
private string m_name;
|
||||
@ -49,6 +60,10 @@ namespace System.Security.Principal {
|
||||
|
||||
m_name = name;
|
||||
m_type = type;
|
||||
|
||||
#if NET_4_5
|
||||
AddDefaultClaim (name);
|
||||
#endif
|
||||
}
|
||||
|
||||
public GenericIdentity (string name)
|
||||
@ -56,22 +71,52 @@ namespace System.Security.Principal {
|
||||
{
|
||||
}
|
||||
|
||||
public virtual string AuthenticationType {
|
||||
#if NET_4_5
|
||||
protected GenericIdentity (GenericIdentity identity)
|
||||
: base (identity)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NET_4_5
|
||||
override
|
||||
#else
|
||||
virtual
|
||||
#endif
|
||||
public string AuthenticationType {
|
||||
get {
|
||||
return m_type;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string Name {
|
||||
#if NET_4_5
|
||||
override
|
||||
#else
|
||||
virtual
|
||||
#endif
|
||||
public string Name {
|
||||
get {
|
||||
return m_name;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IsAuthenticated {
|
||||
#if NET_4_5
|
||||
override
|
||||
#else
|
||||
virtual
|
||||
#endif
|
||||
public bool IsAuthenticated {
|
||||
get {
|
||||
return (m_name.Length > 0);
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
public override IEnumerable<Claim> Claims {
|
||||
get {
|
||||
return base.Claims;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -29,12 +29,21 @@
|
||||
//
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
#if NET_4_5
|
||||
using System.Security.Claims;
|
||||
#endif
|
||||
|
||||
namespace System.Security.Principal {
|
||||
|
||||
[Serializable]
|
||||
[ComVisible (true)]
|
||||
public class GenericPrincipal : IPrincipal {
|
||||
public class GenericPrincipal :
|
||||
#if NET_4_5
|
||||
ClaimsPrincipal
|
||||
#else
|
||||
IPrincipal
|
||||
#endif
|
||||
{
|
||||
|
||||
// field names are serialization compatible with .net
|
||||
private IIdentity m_identity;
|
||||
@ -58,11 +67,21 @@ namespace System.Security.Principal {
|
||||
get { return m_roles; }
|
||||
}
|
||||
|
||||
public virtual IIdentity Identity {
|
||||
#if NET_4_5
|
||||
override
|
||||
#else
|
||||
virtual
|
||||
#endif
|
||||
public IIdentity Identity {
|
||||
get { return m_identity; }
|
||||
}
|
||||
|
||||
public virtual bool IsInRole (string role)
|
||||
#if NET_4_5
|
||||
override
|
||||
#else
|
||||
virtual
|
||||
#endif
|
||||
public bool IsInRole (string role)
|
||||
{
|
||||
if (m_roles == null)
|
||||
return false;
|
||||
|
@ -52,6 +52,11 @@ namespace System.Security.Principal {
|
||||
|
||||
static private IntPtr invalidWindows = IntPtr.Zero;
|
||||
|
||||
#if NET_4_5
|
||||
[NonSerialized]
|
||||
public new const string DefaultIssuer = "AD AUTHORITY";
|
||||
#endif
|
||||
|
||||
[SecurityPermission (SecurityAction.Demand, ControlPrincipal=true)]
|
||||
public WindowsIdentity (IntPtr userToken)
|
||||
: this (userToken, null, WindowsAccountType.Normal, false)
|
||||
|
@ -30,13 +30,21 @@
|
||||
using System.Collections;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
#if NET_4_5
|
||||
using System.Security.Claims;
|
||||
#endif
|
||||
|
||||
namespace System.Security.Principal {
|
||||
|
||||
[Serializable]
|
||||
[ComVisible (true)]
|
||||
public class WindowsPrincipal : IPrincipal {
|
||||
|
||||
public class WindowsPrincipal :
|
||||
#if NET_4_5
|
||||
ClaimsPrincipal
|
||||
#else
|
||||
IPrincipal
|
||||
#endif
|
||||
{
|
||||
private WindowsIdentity _identity;
|
||||
// http://groups.google.ca/groups?q=WindowsPrincipal+m_roles&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=OghXf4OgCHA.4228%40tkmsftngp08&rnum=4
|
||||
private string [] m_roles;
|
||||
@ -53,8 +61,12 @@ namespace System.Security.Principal {
|
||||
}
|
||||
|
||||
// properties
|
||||
|
||||
public virtual IIdentity Identity {
|
||||
#if NET_4_5
|
||||
override
|
||||
#else
|
||||
virtual
|
||||
#endif
|
||||
public IIdentity Identity {
|
||||
get { return _identity; }
|
||||
}
|
||||
|
||||
@ -102,7 +114,12 @@ namespace System.Security.Principal {
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IsInRole (string role)
|
||||
#if NET_4_5
|
||||
override
|
||||
#else
|
||||
virtual
|
||||
#endif
|
||||
public bool IsInRole (string role)
|
||||
{
|
||||
if (role == null)
|
||||
return false; // ArgumentNullException
|
||||
|
Reference in New Issue
Block a user